Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/wsfont In wsfont_rotate_cw_internal() and wsfont_rot...



details:   https://anonhg.NetBSD.org/src/rev/245b76cc5fc9
branches:  trunk
changeset: 756544:245b76cc5fc9
user:      tsutsui <tsutsui%NetBSD.org@localhost>
date:      Thu Jul 22 13:23:02 2010 +0000

description:
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.

diffstat:

 sys/dev/wsfont/wsfont.c |  24 ++++++++++++++++++------
 1 files changed, 18 insertions(+), 6 deletions(-)

diffs (68 lines):

diff -r c0cf4526edc7 -r 245b76cc5fc9 sys/dev/wsfont/wsfont.c
--- a/sys/dev/wsfont/wsfont.c   Thu Jul 22 12:52:59 2010 +0000
+++ b/sys/dev/wsfont/wsfont.c   Thu Jul 22 13:23:02 2010 +0000
@@ -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,



Home | Main Index | Thread Index | Old Index