? terminus8x16.h
Index: files.wsfont
===================================================================
RCS file: /cvsroot/src/sys/dev/wsfont/files.wsfont,v
retrieving revision 1.15
diff -u -w -r1.15 files.wsfont
--- files.wsfont	2 Feb 2007 02:10:24 -0000	1.15
+++ files.wsfont	27 Apr 2010 19:36:22 -0000
@@ -20,5 +20,6 @@
 				FONT_SONY8x16
 				FONT_SONY12x24
 				FONT_OMRON12x20
+				FONT_TERMINUS8x16
 
 file	dev/wsfont/wsfontdev.c	wsfont needs-flag
Index: wsfont.c
===================================================================
RCS file: /cvsroot/src/sys/dev/wsfont/wsfont.c,v
retrieving revision 1.46
diff -u -w -r1.46 wsfont.c
--- wsfont.c	17 Apr 2010 13:36:22 -0000	1.46
+++ wsfont.c	27 Apr 2010 19:36:22 -0000
@@ -110,6 +110,11 @@
 #include <dev/wsfont/omron12x20.h>
 #endif
 
+#ifdef FONT_TERMINUS8x16
+#define HAVE_FONT 1
+#include <dev/wsfont/terminus8x16.h>
+#endif
+
 /* Make sure we always have at least one font. */
 #ifndef HAVE_FONT
 #define HAVE_FONT 1
@@ -187,6 +192,9 @@
 #ifdef FONT_OMRON12x20
 	{ { NULL, NULL }, &omron12x20, 0, 0, WSFONT_STATIC | WSFONT_BUILTIN },
 #endif
+#ifdef FONT_TERMINUS8x16
+	{ { NULL, NULL }, &terminus8x16, 0, 0, WSFONT_STATIC | WSFONT_BUILTIN },
+#endif
 	{ { NULL, NULL }, NULL, 0, 0, 0 },
 };
 
@@ -835,6 +843,37 @@
 	 0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 181
 };
 
+/* 
+ * map all variants of the box drawing characters to the same basic shapes for
+ * now, encoded like this:
+ *
+ *    1
+ *    1
+ * 888 222
+ *    4
+ *    4
+ *
+ * so an upright line would be 0x05
+ */
+static const u_int16_t netbsd_boxes[] = {
+/* 0x00 */	0x10a, 0x10a, 0x105, 0x105, 0x10a, 0x10a, 0x105, 0x105,
+/* 0x08 */	0x10a, 0x10a, 0x105, 0x105, 0x106, 0x106, 0x106, 0x106,
+/* 0x10 */	0x10c, 0x10c, 0x10c, 0x10c, 0x103, 0x103, 0x103, 0x103,
+/* 0x18 */	0x109, 0x109, 0x109, 0x109, 0x107, 0x107, 0x107, 0x107,
+/* 0x20 */	0x107, 0x107, 0x107, 0x107, 0x10d, 0x10d, 0x10d, 0x10d,
+/* 0x28 */	0x10d, 0x10d, 0x10d, 0x10d, 0x10e, 0x10e, 0x10e, 0x10e,
+/* 0x30 */	0x10e, 0x10e, 0x10e, 0x10e, 0x10b, 0x10b, 0x10b, 0x10b,
+/* 0x38 */	0x10b, 0x10b, 0x10b, 0x10b, 0x10f, 0x10f, 0x10f, 0x10f,
+/* 0x40 */	0x10f, 0x10f, 0x10f, 0x10f, 0x10f, 0x10f, 0x10f, 0x10f,
+/* 0x48 */	0x10f, 0x10f, 0x10f, 0x10f, 0x10a, 0x10a, 0x105, 0x105,
+/* 0x50 */	0x10a, 0x105, 0x106, 0x106, 0x106, 0x10c, 0x10c, 0x10c,
+/* 0x58 */	0x103, 0x103, 0x103, 0x109, 0x109, 0x109, 0x107, 0x107,
+/* 0x60 */	0x107, 0x10d, 0x10d, 0x10d, 0x10e, 0x10e, 0x10e, 0x10b,
+/* 0x68 */	0x10b, 0x10b, 0x10f, 0x10f, 0x10f, 0x106, 0x10c, 0x109,
+/* 0x70 */	0x103, 0,     0,     0,     0x108, 0x101, 0x102, 0x104,
+/* 0x78 */	0x108, 0x101, 0x102, 0x104, 0x10a, 0x105, 0x10a, 0x105
+};
+
 static const u_int8_t iso7_chars_32[] = {
 	175, 0,  0,  0,  0, 162, 0, 161
 };
@@ -848,6 +887,9 @@
 static const struct wsfont_level2_glyphmap iso7_level2_32 =
     { 20, 8, iso7_chars_32, 1 };
 
+static const struct wsfont_level2_glyphmap netbsd_box_drawing =
+    { 0, 128, netbsd_boxes, 2 };
+
 static const struct wsfont_level2_glyphmap *iso7_level1[] = {
 	&iso7_level2_0, NULL, NULL, &iso7_level2_3,
 	NULL, NULL, NULL, NULL,
@@ -857,14 +899,28 @@
 	NULL, NULL, NULL, NULL,
 	NULL, NULL, NULL, NULL,
 	NULL, NULL, NULL, NULL,
-	&iso7_level2_32
+	&iso7_level2_32, NULL, NULL, NULL,
+	NULL, &netbsd_box_drawing
+};
+
+static const struct wsfont_level2_glyphmap *iso_level1[] = {
+	NULL, NULL, NULL, NULL,
+	NULL, NULL, NULL, NULL,
+	NULL, NULL, NULL, NULL,
+	NULL, NULL, NULL, NULL,
+	NULL, NULL, NULL, NULL,
+	NULL, NULL, NULL, NULL,
+	NULL, NULL, NULL, NULL,
+	NULL, NULL, NULL, NULL,
+	NULL, NULL, NULL, NULL,
+	NULL, &netbsd_box_drawing
 };
 
 static const struct wsfont_level1_glyphmap encodings[] = {
-	{ NULL, 0, 0 },			/* WSDISPLAY_FONTENC_ISO */
+	{ iso_level1, 0, 0x26 },	/* WSDISPLAY_FONTENC_ISO */
 	{ ibm437_level1, 0, 38 },	/* WSDISPLAY_FONTENC_IBM */
 	{ NULL, 0, 0 },			/* WSDISPLAY_FONTENC_PCVT */
-	{ iso7_level1, 0, 33 },		/* WSDISPLAY_FONTENC_ISO7 */
+	{ iso7_level1, 0, 0x26 },	/* WSDISPLAY_FONTENC_ISO7 */
 };
 
 #define MAX_ENCODING (sizeof(encodings) / sizeof(encodings[0]))
@@ -879,9 +935,6 @@
 	const struct wsfont_level2_glyphmap *map2;
 	int hi, lo;
 
-	if (font->encoding == WSDISPLAY_FONTENC_ISO)
-		return (c);
-
 	if (font->encoding < 0 || font->encoding >= MAX_ENCODING)
 		return (-1);
 
@@ -894,6 +947,10 @@
 
 	map2 = map1->level2[hi - map1->base];
 
+	/* so we don't need an identical level 2 table for hi == 0 */
+	if (hi == 0 && font->encoding == WSDISPLAY_FONTENC_ISO)
+		return lo;
+ 
 	if (map2 == NULL || lo < map2->base || lo >= map2->base + map2->size)
 		return (-1);
 
