Source-Changes-HG archive

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

[src/trunk]: src add support for the interesting parts of ISO-2 and KOI8-R fonts



details:   https://anonhg.NetBSD.org/src/rev/0da934a93d94
branches:  trunk
changeset: 765864:0da934a93d94
user:      drochner <drochner%NetBSD.org@localhost>
date:      Wed Jun 08 10:25:21 2011 +0000

description:
add support for the interesting parts of ISO-2 and KOI8-R fonts
to the vga(4) driver

diffstat:

 sys/dev/ic/vga.c                 |  64 ++++++++++++++++++++++++++++++++++++++-
 sys/dev/wscons/wsconsio.h        |   3 +-
 usr.sbin/wsfontload/wsfontload.8 |  27 ++++++++++------
 usr.sbin/wsfontload/wsfontload.c |   3 +-
 4 files changed, 82 insertions(+), 15 deletions(-)

diffs (176 lines):

diff -r ed0791965581 -r 0da934a93d94 sys/dev/ic/vga.c
--- a/sys/dev/ic/vga.c  Wed Jun 08 10:14:16 2011 +0000
+++ b/sys/dev/ic/vga.c  Wed Jun 08 10:25:21 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vga.c,v 1.106 2010/12/09 23:33:30 christos Exp $ */
+/* $NetBSD: vga.c,v 1.107 2011/06/08 10:25:21 drochner Exp $ */
 
 /*
  * Copyright (c) 1995, 1996 Carnegie-Mellon University.
@@ -28,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vga.c,v 1.106 2010/12/09 23:33:30 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vga.c,v 1.107 2011/06/08 10:25:21 drochner Exp $");
 
 /* for WSCONS_SUPPORT_PCVTFONTS */
 #include "opt_wsdisplay_compat.h"
@@ -311,7 +311,9 @@
 #define vga_valid_primary_font(f) \
        (f->wsfont->encoding == WSDISPLAY_FONTENC_IBM || \
        f->wsfont->encoding == WSDISPLAY_FONTENC_ISO || \
-       f->wsfont->encoding == WSDISPLAY_FONTENC_ISO7)
+       f->wsfont->encoding == WSDISPLAY_FONTENC_ISO2 || \
+       f->wsfont->encoding == WSDISPLAY_FONTENC_ISO7 || \
+       f->wsfont->encoding == WSDISPLAY_FONTENC_KOI8_R)
 
 struct egavga_font *
 egavga_getfont(struct vga_config *vc, struct vgascreen *scr, const char *name,
@@ -1335,6 +1337,32 @@
 
 #endif /* WSCONS_SUPPORT_ISO7FONTS */
 
+static const uint16_t iso2_unichars[0x60] = {
+       0x00A0, 0x0104, 0x02D8, 0x0141, 0x00A4, 0x013D, 0x015A, 0x00A7,
+       0x00A8, 0x0160, 0x015E, 0x0164, 0x0179, 0x00AD, 0x017D, 0x017B,
+       0x00B0, 0x0105, 0x02DB, 0x0142, 0x00B4, 0x013E, 0x015B, 0x02C7,
+       0x00B8, 0x0161, 0x015F, 0x0165, 0x017A, 0x02DD, 0x017E, 0x017C,
+       0x0154, 0x00C1, 0x00C2, 0x0102, 0x00C4, 0x0139, 0x0106, 0x00C7,
+       0x010C, 0x00C9, 0x0118, 0x00CB, 0x011A, 0x00CD, 0x00CE, 0x010E,
+       0x0110, 0x0143, 0x0147, 0x00D3, 0x00D4, 0x0150, 0x00D6, 0x00D7,
+       0x0158, 0x016E, 0x00DA, 0x0170, 0x00DC, 0x00DD, 0x0162, 0x00DF,
+       0x0155, 0x00E1, 0x00E2, 0x0103, 0x00E4, 0x013A, 0x0107, 0x00E7,
+       0x010D, 0x00E9, 0x0119, 0x00EB, 0x011B, 0x00ED, 0x00EE, 0x010F,
+       0x0111, 0x0144, 0x0148, 0x00F3, 0x00F4, 0x0151, 0x00F6, 0x00F7,
+       0x0159, 0x016F, 0x00FA, 0x0171, 0x00FC, 0x00FD, 0x0163, 0x02D9
+};
+
+static const uint16_t koi8_unichars[0x40] = {
+       0x044E, 0x0430, 0x0431, 0x0446, 0x0434, 0x0435, 0x0444, 0x0433,
+       0x0445, 0x0438, 0x0439, 0x043A, 0x043B, 0x043C, 0x043D, 0x043E,
+       0x043F, 0x044F, 0x0440, 0x0441, 0x0442, 0x0443, 0x0436, 0x0432,
+       0x044C, 0x044B, 0x0437, 0x0448, 0x044D, 0x0449, 0x0447, 0x044A,
+       0x042E, 0x0410, 0x0411, 0x0426, 0x0414, 0x0415, 0x0424, 0x0413,
+       0x0425, 0x0418, 0x0419, 0x041A, 0x041B, 0x041C, 0x041D, 0x041E,
+       0x041F, 0x042F, 0x0420, 0x0421, 0x0422, 0x0423, 0x0416, 0x0412,
+       0x042C, 0x042B, 0x0417, 0x0428, 0x042D, 0x0429, 0x0427, 0x042A
+};
+
 static int _vga_mapchar(void *, const struct egavga_font *, int, u_int *);
 
 static int
@@ -1350,6 +1378,36 @@
                        *index = ' ';
                        return (0);
                }
+       case WSDISPLAY_FONTENC_ISO2:
+               if (uni < 0xa0) {
+                       *index = uni;
+                       return (5);
+               } else {
+                       int i;
+                       for (i = 0; i < 0x60; i++) {
+                               if (uni == iso2_unichars[i]) {
+                                       *index = i + 0xa0;
+                                       return (5);
+                               }
+                       }
+                       *index = 0xa4; /* currency sign */
+                       return (0);
+               }
+       case WSDISPLAY_FONTENC_KOI8_R:
+               if (uni < 0x80) {
+                       *index = uni;
+                       return (5);
+               } else {
+                       int i;
+                       for (i = 0; i < 0x40; i++) {
+                               if (uni == koi8_unichars[i]) {
+                                       *index = i + 0xc0;
+                                       return (5);
+                               }
+                       }
+                       *index = 0x94; /* box */
+                       return (0);
+               }
        case WSDISPLAY_FONTENC_IBM:
                return (pcdisplay_mapchar(id, uni, index));
 #ifdef WSCONS_SUPPORT_PCVTFONTS
diff -r ed0791965581 -r 0da934a93d94 sys/dev/wscons/wsconsio.h
--- a/sys/dev/wscons/wsconsio.h Wed Jun 08 10:14:16 2011 +0000
+++ b/sys/dev/wscons/wsconsio.h Wed Jun 08 10:25:21 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: wsconsio.h,v 1.95 2011/02/06 18:26:53 tsutsui Exp $ */
+/* $NetBSD: wsconsio.h,v 1.96 2011/06/08 10:25:21 drochner Exp $ */
 
 /*
  * Copyright (c) 1996, 1997 Christopher G. Demetriou.  All rights reserved.
@@ -404,6 +404,7 @@
 #define        WSDISPLAY_FONTENC_PCVT 2
 #define        WSDISPLAY_FONTENC_ISO7 3 /* greek */
 #define        WSDISPLAY_FONTENC_ISO2 4 /* east european */
+#define        WSDISPLAY_FONTENC_KOI8_R 5 /* russian */
        u_int fontwidth, fontheight, stride;
 #define        WSDISPLAY_MAXFONTSZ     (512*1024)
        int bitorder, byteorder;
diff -r ed0791965581 -r 0da934a93d94 usr.sbin/wsfontload/wsfontload.8
--- a/usr.sbin/wsfontload/wsfontload.8  Wed Jun 08 10:14:16 2011 +0000
+++ b/usr.sbin/wsfontload/wsfontload.8  Wed Jun 08 10:25:21 2011 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: wsfontload.8,v 1.24 2009/03/09 19:24:33 joerg Exp $
+.\"    $NetBSD: wsfontload.8,v 1.25 2011/06/08 10:25:21 drochner Exp $
 .\"
 .\" Copyright (c) 1999, 2001
 .\"    Matthias Drochner.  All rights reserved.
@@ -85,17 +85,24 @@
 .It Fl e Ar encoding
 Sets the encoding of the font.
 This can be either a symbolic abbreviation or a numeric value.
-Currently recognized abbreviations are
-.Ql iso
-for ISO-8859-1 encoding,
-.Ql ibm
-for IBM encoded fonts and
-.Ql pcvt
-for the custom encoding of the supplemental fonts which came with
-the
+Currently recognized abbreviations are:
+.Bl -tag -width xxxxxxx
+.It Ql iso
+ISO-8859-1 encoding
+.It Ql ibm
+IBM encoded fonts
+.It Ql pcvt
+the custom encoding of the supplemental fonts which came with the
 .Bx
 .Dq pcvt
-console driver.
+console driver
+.It Ql iso2
+ISO-8859-2 (east european) encoding
+.It Ql iso7
+ISO-8859-7 (greek) encoding
+.It Ql koi8r
+KOI8-R (russian) encoding
+.El
 Per default,
 .Ql iso
 is assumed.
diff -r ed0791965581 -r 0da934a93d94 usr.sbin/wsfontload/wsfontload.c
--- a/usr.sbin/wsfontload/wsfontload.c  Wed Jun 08 10:14:16 2011 +0000
+++ b/usr.sbin/wsfontload/wsfontload.c  Wed Jun 08 10:25:21 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: wsfontload.c,v 1.14 2009/04/19 02:25:48 lukem Exp $ */
+/* $NetBSD: wsfontload.c,v 1.15 2011/06/08 10:25:21 drochner Exp $ */
 
 /*
  * Copyright (c) 1999
@@ -68,6 +68,7 @@
        {"pcvt", WSDISPLAY_FONTENC_PCVT},
        {"iso7", WSDISPLAY_FONTENC_ISO7},
        {"iso2", WSDISPLAY_FONTENC_ISO2},
+       {"koi8r", WSDISPLAY_FONTENC_KOI8_R},
 };
 
 static void



Home | Main Index | Thread Index | Old Index