Module Name: src
Committed By: tsutsui
Date: Thu Jul 22 13:23:03 UTC 2010
Modified Files:
src/sys/dev/wsfont: wsfont.c
Log Message:
In wsfont_rotate_cw_internal() and wsfont_rotate_ccw_internal(),
give a new name to rotated fonts so that 8x8 (and other X==Y) fonts
can be used properly on CW and CCW screens.
To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 src/sys/dev/wsfont/wsfont.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/dev/wsfont/wsfont.c
diff -u src/sys/dev/wsfont/wsfont.c:1.49 src/sys/dev/wsfont/wsfont.c:1.50
--- src/sys/dev/wsfont/wsfont.c:1.49 Thu Jul 22 12:52:59 2010
+++ src/sys/dev/wsfont/wsfont.c Thu Jul 22 13:23:02 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: wsfont.c,v 1.49 2010/07/22 12:52:59 tsutsui Exp $ */
+/* $NetBSD: wsfont.c,v 1.50 2010/07/22 13:23:02 tsutsui Exp $ */
/*-
* Copyright (c) 1999, 2000, 2001, 2002 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: wsfont.c,v 1.49 2010/07/22 12:52:59 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wsfont.c,v 1.50 2010/07/22 13:23:02 tsutsui Exp $");
#include "opt_wsfont.h"
@@ -314,9 +314,9 @@
struct wsdisplay_font *
wsfont_rotate_cw_internal(struct wsdisplay_font *font)
{
- int b, n, r, newstride;
+ int b, n, r, namelen, newstride;
struct wsdisplay_font *newfont;
- char *newbits;
+ char *newname, *newbits;
/* Duplicate the existing font... */
newfont = malloc(sizeof(*font), M_DEVBUF, M_WAITOK);
@@ -325,6 +325,12 @@
*newfont = *font;
+ namelen = strlen(font->name) + 4;
+ newname = malloc(namelen, M_DEVBUF, M_WAITOK);
+ strlcpy(newname, font->name, namelen);
+ strlcat(newname, "cw", namelen);
+ newfont->name = newname;
+
/* Allocate a buffer big enough for the rotated font. */
newstride = (font->fontheight + 7) / 8;
newbits = malloc(newstride * font->fontwidth * font->numchars,
@@ -379,9 +385,9 @@
struct wsdisplay_font *
wsfont_rotate_ccw_internal(struct wsdisplay_font *font)
{
- int b, n, r, newstride;
+ int b, n, r, namelen, newstride;
struct wsdisplay_font *newfont;
- char *newbits;
+ char *newname, *newbits;
/* Duplicate the existing font... */
newfont = malloc(sizeof(*font), M_DEVBUF, M_WAITOK);
@@ -390,6 +396,12 @@
*newfont = *font;
+ namelen = strlen(font->name) + 4;
+ newname = malloc(namelen, M_DEVBUF, M_WAITOK);
+ strlcpy(newname, font->name, namelen);
+ strlcat(newname, "ccw", namelen);
+ newfont->name = newname;
+
/* Allocate a buffer big enough for the rotated font. */
newstride = (font->fontheight + 7) / 8;
newbits = malloc(newstride * font->fontwidth * font->numchars,