? 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	29 Apr 2010 05:18:43 -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	29 Apr 2010 05:18:43 -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,39 @@
 	 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
+ */
+#define FL |WSFONT_FLAG_OPT
+static const u_int32_t netbsd_boxes[] = {
+/*00*/ 0x0a FL, 0x0a FL, 0x05 FL, 0x05 FL, 0x0a FL, 0x0a FL, 0x05 FL, 0x05 FL,
+/*08*/ 0x0a FL, 0x0a FL, 0x05 FL, 0x05 FL, 0x06 FL, 0x06 FL, 0x06 FL, 0x06 FL,
+/*10*/ 0x0c FL, 0x0c FL, 0x0c FL, 0x0c FL, 0x03 FL, 0x03 FL, 0x03 FL, 0x03 FL,
+/*18*/ 0x09 FL, 0x09 FL, 0x09 FL, 0x09 FL, 0x07 FL, 0x07 FL, 0x07 FL, 0x07 FL,
+/*20*/ 0x07 FL, 0x07 FL, 0x07 FL, 0x07 FL, 0x0d FL, 0x0d FL, 0x0d FL, 0x0d FL,
+/*28*/ 0x0d FL, 0x0d FL, 0x0d FL, 0x0d FL, 0x0e FL, 0x0e FL, 0x0e FL, 0x0e FL,
+/*30*/ 0x0e FL, 0x0e FL, 0x0e FL, 0x0e FL, 0x0b FL, 0x0b FL, 0x0b FL, 0x0b FL,
+/*38*/ 0x0b FL, 0x0b FL, 0x0b FL, 0x0b FL, 0x0f FL, 0x0f FL, 0x0f FL, 0x0f FL,
+/*40*/ 0x0f FL, 0x0f FL, 0x0f FL, 0x0f FL, 0x0f FL, 0x0f FL, 0x0f FL, 0x0f FL,
+/*48*/ 0x0f FL, 0x0f FL, 0x0f FL, 0x0f FL, 0x0a FL, 0x0a FL, 0x05 FL, 0x05 FL,
+/*50*/ 0x0a FL, 0x05 FL, 0x06 FL, 0x06 FL, 0x06 FL, 0x0c FL, 0x0c FL, 0x0c FL,
+/*58*/ 0x03 FL, 0x03 FL, 0x03 FL, 0x09 FL, 0x09 FL, 0x09 FL, 0x07 FL, 0x07 FL,
+/*60*/ 0x07 FL, 0x0d FL, 0x0d FL, 0x0d FL, 0x0e FL, 0x0e FL, 0x0e FL, 0x0b FL,
+/*68*/ 0x0b FL, 0x0b FL, 0x0f FL, 0x0f FL, 0x0f FL, 0x06 FL, 0x0c FL, 0x09 FL,
+/*70*/ 0x03 FL, 0x00 FL, 0x00 FL,    0 FL, 0x08 FL, 0x01 FL, 0x02 FL, 0x04 FL,
+/*78*/ 0x08 FL, 0x01 FL, 0x02 FL, 0x04 FL, 0x0a FL, 0x05 FL, 0x0a FL, 0x05 FL
+};
+#undef FL
+
 static const u_int8_t iso7_chars_32[] = {
 	175, 0,  0,  0,  0, 162, 0, 161
 };
@@ -848,6 +889,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, 4 };
+
 static const struct wsfont_level2_glyphmap *iso7_level1[] = {
 	&iso7_level2_0, NULL, NULL, &iso7_level2_3,
 	NULL, NULL, NULL, NULL,
@@ -857,14 +901,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 +937,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 +949,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);
 
Index: wsfont.h
===================================================================
RCS file: /cvsroot/src/sys/dev/wsfont/wsfont.h,v
retrieving revision 1.20
diff -u -w -r1.20 wsfont.h
--- wsfont.h	17 Apr 2010 13:36:22 -0000	1.20
+++ wsfont.h	29 Apr 2010 05:18:43 -0000
@@ -32,6 +32,9 @@
 #ifndef _WSFONT_H_
 #define _WSFONT_H_ 1
 
+#define WSFONT_FLAGS_MASK	0x7f000000
+#define WSFONT_FLAG_OPT		0x01000000	/* use alternate font */
+
 /*
  * Example:
  *
