summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2006-10-05 21:10:32 +0000
committerRich Felker <dalias@aerifal.cx>2006-10-05 21:10:32 +0000
commitcffa2eeb2052df70c52fc720add9fe7e31b314e7 (patch)
treed4c80a2f080f3419959e54a462f259776bb37ab4
parentdc6a00a52f6df3c7e66c6535c2489f51fa1fa13a (diff)
the big UCF-font commit!
still a little bit messy, but it works quite well already more to come soon.
-rw-r--r--Makefile2
-rw-r--r--ascii.c222
-rw-r--r--font_load.c18
-rw-r--r--main.c11
-rw-r--r--refresh.c26
-rw-r--r--ucf.c133
-rw-r--r--ucf.h14
-rw-r--r--uuterm.h1
8 files changed, 413 insertions, 14 deletions
diff --git a/Makefile b/Makefile
index 6dd74b2..ba6f5eb 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
# uuterm, Copyright (C) 2006 Rich Felker; licensed under GNU GPL v2 only
-SRCS = main.c term.c comb.c tty.c alloc.c refresh.c ascii.c fbcon.c dblbuf.c
+SRCS = main.c term.c comb.c tty.c alloc.c refresh.c ascii.c ucf.c font_load.c fbcon.c dblbuf.c
OBJS = $(SRCS:.c=.o)
CFLAGS = -O2 -s #-g
diff --git a/ascii.c b/ascii.c
index 8082e4e..f6ac8a7 100644
--- a/ascii.c
+++ b/ascii.c
@@ -1,7 +1,149 @@
/* Standard ASCII console font. If you want to pretend there's a copyright
* on this you'll just be making a fool of yourself. Public domain. */
-static const unsigned char ascii[] = {
+/* ... converted to UCF format; added linedraw chars */
+
+const unsigned char vga_ascii_ucf[] = {
+0x75,0x63,0x66,0xc0,0x00,0x01,0x00,0x00,0x08,0x10,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x00,0x00,0x08,0xb8,0x00,0x00,0x08,0xc0,
+0x00,0x00,0x00,0x07,0x00,0x00,0x00,0xa2,0x00,0x00,0x1f,0x5e,0x00,0x00,0x00,0x61,
+0x00,0x00,0x01,0x2f,0x00,0x00,0x00,0x27,0x00,0x00,0x02,0x52,0x00,0x00,0x00,0x1d,
+0x00,0x00,0x00,0xda,0x00,0x00,0x00,0xc8,0x00,0x00,0xd2,0x38,0x00,0x00,0x00,0x06,
+0x00,0x00,0x07,0xf7,0x00,0x00,0x00,0x02,0x00,0x11,0x00,0x00,0xff,0xff,0xff,0xff,
+0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x04,
+0x00,0x00,0x00,0x05,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x07,0x00,0x00,0x00,0x08,
+0x00,0x00,0x00,0x09,0x00,0x00,0x00,0x0a,0x00,0x00,0x00,0x0b,0x00,0x00,0x00,0x0c,
+0x00,0x00,0x00,0x0d,0x00,0x00,0x00,0x0e,0x00,0x00,0x00,0x0f,0x00,0x00,0x00,0x10,
+0x00,0x00,0x00,0x11,0x00,0x00,0x00,0x12,0x00,0x00,0x00,0x13,0x00,0x00,0x00,0x14,
+0x00,0x00,0x00,0x15,0x00,0x00,0x00,0x16,0x00,0x00,0x00,0x17,0x00,0x00,0x00,0x18,
+0x00,0x00,0x00,0x19,0x00,0x00,0x00,0x1a,0x00,0x00,0x00,0x1b,0x00,0x00,0x00,0x1c,
+0x00,0x00,0x00,0x1d,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,0x1f,0x00,0x00,0x00,0x20,
+0x00,0x00,0x00,0x21,0x00,0x00,0x00,0x22,0x00,0x00,0x00,0x23,0x00,0x00,0x00,0x24,
+0x00,0x00,0x00,0x25,0x00,0x00,0x00,0x26,0x00,0x00,0x00,0x27,0x00,0x00,0x00,0x28,
+0x00,0x00,0x00,0x29,0x00,0x00,0x00,0x2a,0x00,0x00,0x00,0x2b,0x00,0x00,0x00,0x2c,
+0x00,0x00,0x00,0x2d,0x00,0x00,0x00,0x2e,0x00,0x00,0x00,0x2f,0x00,0x00,0x00,0x30,
+0x00,0x00,0x00,0x31,0x00,0x00,0x00,0x32,0x00,0x00,0x00,0x33,0x00,0x00,0x00,0x34,
+0x00,0x00,0x00,0x35,0x00,0x00,0x00,0x36,0x00,0x00,0x00,0x37,0x00,0x00,0x00,0x38,
+0x00,0x00,0x00,0x39,0x00,0x00,0x00,0x3a,0x00,0x00,0x00,0x3b,0x00,0x00,0x00,0x3c,
+0x00,0x00,0x00,0x3d,0x00,0x00,0x00,0x3e,0x00,0x00,0x00,0x3f,0x00,0x00,0x00,0x40,
+0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x42,0x00,0x00,0x00,0x43,0x00,0x00,0x00,0x44,
+0x00,0x00,0x00,0x45,0x00,0x00,0x00,0x46,0x00,0x00,0x00,0x47,0x00,0x00,0x00,0x48,
+0x00,0x00,0x00,0x49,0x00,0x00,0x00,0x4a,0x00,0x00,0x00,0x4b,0x00,0x00,0x00,0x4c,
+0x00,0x00,0x00,0x4d,0x00,0x00,0x00,0x4e,0x00,0x00,0x00,0x4f,0x00,0x00,0x00,0x50,
+0x00,0x00,0x00,0x51,0x00,0x00,0x00,0x52,0x00,0x00,0x00,0x53,0x00,0x00,0x00,0x54,
+0x00,0x00,0x00,0x55,0x00,0x00,0x00,0x56,0x00,0x00,0x00,0x57,0x00,0x00,0x00,0x58,
+0x00,0x00,0x00,0x59,0x00,0x00,0x00,0x5a,0x00,0x00,0x00,0x5b,0x00,0x00,0x00,0x5c,
+0x00,0x00,0x00,0x5d,0x00,0x00,0x00,0x5e,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,
+0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x0d,0x00,0x00,0x00,0x0d,0x00,0x00,0x00,0x0d,
+0x00,0x00,0x00,0x0d,0x00,0x00,0x00,0x0d,0x00,0x00,0x00,0x0d,0xff,0xff,0xff,0xff,
+0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x07,0xff,0xff,0xff,0xff,
+0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x5f,0x00,0x00,0x00,0x60,
+0x00,0x00,0x00,0x61,0x00,0x00,0x00,0x62,0x00,0x00,0x00,0x63,0x00,0x00,0x00,0x64,
+0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x65,
+0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x66,0x00,0x00,0x00,0x67,0x00,0x00,0x00,0x68,
+0x00,0x00,0x00,0x69,0x00,0x00,0x00,0x6a,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+0x00,0x00,0x00,0x6b,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x6c,0x00,0x00,0x00,0x6d,
+0x00,0x00,0x00,0x6e,0x00,0x00,0x00,0x6f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x70,0xff,0xff,0xff,0xff,
+0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x71,0x00,0x00,0x00,0x72,0xff,0xff,0xff,0xff,
+0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x73,0x00,0x00,0x00,0x74,0xff,0xff,0xff,0xff,
+0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x75,0x00,0x00,0x00,0x76,0xff,0xff,0xff,0xff,
+0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x77,0x00,0x00,0x00,0x78,0xff,0xff,0xff,0xff,
+0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x79,0x00,0x00,0x00,0x7a,0xff,0xff,0xff,0xff,
+0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x7b,0x00,0x00,0x00,0x7c,0xff,0xff,0xff,0xff,
+0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x7d,0x00,0x00,0x00,0x7e,0xff,0xff,0xff,0xff,
+0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x7f,0x00,0x00,0x00,0x80,0xff,0xff,0xff,0xff,
+0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x81,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x82,0x00,0x00,0x00,0x83,
+0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x84,0xff,0xff,0xff,0xff,
+0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x85,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+0x00,0x00,0x00,0x86,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x87,
+0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x88,0xff,0xff,0xff,0xff,
+0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x89,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+0x00,0x00,0x00,0x8a,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x8b,
+0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x8c,0xff,0xff,0xff,0xff,
+0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x8d,0x00,0x00,0x00,0x8e,
+0x00,0x00,0x00,0x8f,0x00,0x00,0x00,0x90,0x00,0x00,0x00,0x91,0x00,0x00,0x00,0x92,
+0x00,0x00,0x00,0x93,0x00,0x00,0x00,0x94,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x95,0xff,0xff,0xff,0xff,
+0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x96,0xff,0xff,0xff,0xff,
+0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x97,0xff,0xff,0xff,0xff,
+0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x98,0xff,0xff,0xff,0xff,
+0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x99,0x00,0x00,0x00,0x9a,
+0x00,0x00,0x00,0x9b,0x00,0x00,0x00,0x9c,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+0x00,0x00,0x00,0x9d,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x9e,0xff,0xff,0xff,0xff,
+0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+0x00,0x00,0x00,0x9f,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0xa0,0x00,0x00,0x00,0xa1,
+0xff,0xff,0xff,0xff,0x00,0x00,0x00,0xa2,0x00,0x00,0x00,0xa3,0xff,0xff,0xff,0xff,
+0x80,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0x02,0x00,0x00,0xa4,0x01,0x00,0x00,0xa5,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x18,0x3c,0x3c,0x3c,0x18,0x18,0x18,0x00,0x18,0x18,0x00,0x00,0x00,0x00,
0x00,0x66,0x66,0x66,0x24,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
@@ -97,10 +239,76 @@ static const unsigned char ascii[] = {
0x00,0x00,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x00,0x00,0x00,0x00,
0x00,0x00,0x70,0x18,0x18,0x18,0x0e,0x18,0x18,0x18,0x18,0x70,0x00,0x00,0x00,0x00,
0x00,0x00,0x76,0xdc,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x20,0x7f,0x20,0x10,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x08,0x1c,0x2a,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x02,0x7f,0x02,0x04,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x2a,0x1c,0x08,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x14,0x22,0x7f,0x22,0x14,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x08,0x1c,0x2a,0x08,0x08,0x08,0x08,0x2a,0x1c,0x08,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x02,0x12,0x22,0x7e,0x20,0x10,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x28,0x28,0x38,0x28,0x28,0x00,0x1c,0x08,0x08,0x08,0x08,0x00,0x00,0x00,
+0x00,0x00,0x20,0x20,0x20,0x20,0x38,0x00,0x0e,0x08,0x0c,0x08,0x08,0x00,0x00,0x00,
+0x00,0x00,0x28,0x28,0x28,0x10,0x10,0x00,0x1c,0x08,0x08,0x08,0x08,0x00,0x00,0x00,
+0x00,0x00,0x1c,0x10,0x18,0x10,0x10,0x00,0x0e,0x08,0x0c,0x08,0x08,0x00,0x00,0x00,
+0x00,0x00,0x18,0x20,0x20,0x20,0x18,0x00,0x0e,0x0a,0x0c,0x0a,0x0a,0x00,0x00,0x00,
+0x00,0x00,0x24,0x34,0x3c,0x2c,0x24,0x00,0x08,0x08,0x08,0x08,0x0e,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0x00,0xff,0x00,0x00,0x00,0x00,0x00,0x00,
+0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,
+0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0f,0x08,0x08,0x08,0x08,0x08,0x08,0x08,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3f,0x20,0x27,0x24,0x24,0x24,0x24,0x24,0x24,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xf8,0x08,0x08,0x08,0x08,0x08,0x08,0x08,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfc,0x04,0xe4,0x24,0x24,0x24,0x24,0x24,0x24,
+0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x0f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x27,0x20,0x3f,0x00,0x00,0x00,0x00,0x00,0x00,
+0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0xf8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x24,0x24,0x24,0x24,0x24,0x24,0x24,0xe4,0x04,0xfc,0x00,0x00,0x00,0x00,0x00,0x00,
+0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x0f,0x08,0x08,0x08,0x08,0x08,0x08,0x08,
+0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x27,0x20,0x27,0x24,0x24,0x24,0x24,0x24,0x24,
+0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0xf8,0x08,0x08,0x08,0x08,0x08,0x08,0x08,
+0x24,0x24,0x24,0x24,0x24,0x24,0x24,0xe4,0x04,0xe4,0x24,0x24,0x24,0x24,0x24,0x24,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0x08,0x08,0x08,0x08,0x08,0x08,0x08,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0x00,0xe7,0x24,0x24,0x24,0x24,0x24,0x24,
+0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x24,0x24,0x24,0x24,0x24,0x24,0x24,0xe7,0x00,0xff,0x00,0x00,0x00,0x00,0x00,0x00,
+0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0xff,0x08,0x08,0x08,0x08,0x08,0x08,0x08,
+0x24,0x24,0x24,0x24,0x24,0x24,0x24,0xe7,0x00,0xe7,0x24,0x24,0x24,0x24,0x24,0x24,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0x00,0xff,0x00,0x00,0x00,0x00,0x00,0x00,
+0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3f,0x20,0x27,0x24,0x24,0x24,0x24,0x24,0x24,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfc,0x04,0xe4,0x24,0x24,0x24,0x24,0x24,0x24,
+0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x27,0x20,0x3f,0x00,0x00,0x00,0x00,0x00,0x00,
+0x24,0x24,0x24,0x24,0x24,0x24,0x24,0xe4,0x04,0xfc,0x00,0x00,0x00,0x00,0x00,0x00,
+0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x27,0x20,0x27,0x24,0x24,0x24,0x24,0x24,0x24,
+0x24,0x24,0x24,0x24,0x24,0x24,0x24,0xe4,0x04,0xe4,0x24,0x24,0x24,0x24,0x24,0x24,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0x00,0xe7,0x24,0x24,0x24,0x24,0x24,0x24,
+0x24,0x24,0x24,0x24,0x24,0x24,0x24,0xe7,0x00,0xff,0x00,0x00,0x00,0x00,0x00,0x00,
+0x24,0x24,0x24,0x24,0x24,0x24,0x24,0xe7,0x00,0xe7,0x24,0x24,0x24,0x24,0x24,0x24,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xf8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfc,0x04,0xfc,0x00,0x00,0x00,0x00,0x00,0x00,
+0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x3c,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3f,0x20,0x3f,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3c,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,
+0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,
+0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,
+0x11,0x44,0x11,0x44,0x11,0x44,0x11,0x44,0x11,0x44,0x11,0x44,0x11,0x44,0x11,0x44,
+0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa,
+0xdd,0x77,0xdd,0x77,0xdd,0x77,0xdd,0x77,0xdd,0x77,0xdd,0x77,0xdd,0x77,0xdd,0x77,
+0x00,0x00,0x00,0x00,0x00,0xc0,0xf0,0xfc,0xfe,0xfc,0xf0,0xc0,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x06,0x1e,0x7e,0xfe,0x7e,0x1e,0x06,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x10,0x38,0x7c,0xfe,0x7c,0x38,0x10,0x00,0x00,0x00,0x00,
+0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0x00,
+0x00,0x00,0x3e,0x63,0x5d,0x5d,0x7d,0x7b,0x77,0x77,0x7f,0x77,0x77,0x3e,0x00,0x00,
+0x00,0x00,0x0f,0x38,0x33,0x67,0x7f,0x7f,0x7f,0x7e,0x7f,0x3e,0x3e,0x0f,0x00,0x00,
+0x00,0x00,0xf0,0x1c,0xcc,0xe6,0xe6,0xce,0x3e,0x7e,0xfe,0x7c,0x7c,0xf0,0x00,0x00,
};
-
-const void *ascii_get_glyph(unsigned c)
-{
- if (c - 32 < 95) return ascii + 16*(c-32);
- else return ascii;
-}
diff --git a/font_load.c b/font_load.c
new file mode 100644
index 0000000..33f92dd
--- /dev/null
+++ b/font_load.c
@@ -0,0 +1,18 @@
+#include <fcntl.h>
+#include <unistd.h>
+#include <sys/mman.h>
+
+#include "ucf.h"
+
+int ucf_load(struct ucf *f, const char *filename)
+{
+ int fd = open(filename, O_RDONLY);
+ unsigned char *map;
+ size_t l;
+
+ if (fd < 0) return -1;
+ map = mmap(0, l=lseek(fd, 0, SEEK_END), PROT_READ, MAP_SHARED, fd, 0);
+ close(fd);
+ if (map == MAP_FAILED) return -1;
+ return ucf_init(f, map, l);
+}
diff --git a/main.c b/main.c
index 664a3c7..517644a 100644
--- a/main.c
+++ b/main.c
@@ -1,5 +1,6 @@
/* uuterm, Copyright (C) 2006 Rich Felker; licensed under GNU GPL v2 only */
+#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <signal.h>
@@ -8,11 +9,16 @@
#include <sys/time.h> /* for broken systems */
#include "uuterm.h"
+#include "ucf.h"
+
+int ucf_load(struct ucf *, const char *);
+extern const unsigned char vga_ascii_ucf[];
int main(int argc, char *argv[])
{
struct uuterm t = { };
struct uudisp d = { };
+ struct ucf f = { };
int tty, max;
int i, l;
unsigned char b[256];
@@ -22,8 +28,13 @@ int main(int argc, char *argv[])
setlocale(LC_CTYPE, "");
+ if (ucf_load(&f, getenv("UUTERM_FONT")) < 0
+ && ucf_init(&f, vga_ascii_ucf, -1) < 0)
+ return 1;
+
d.cell_w = 8;
d.cell_h = 16;
+ d.font = &f;
if (uudisp_open(&d) < 0)
return 1;
diff --git a/refresh.c b/refresh.c
index 6b24dbe..ef9aa7f 100644
--- a/refresh.c
+++ b/refresh.c
@@ -1,6 +1,7 @@
/* uuterm, Copyright (C) 2006 Rich Felker; licensed under GNU GPL v2 only */
#include "uuterm.h"
+#include "ucf.h"
static void extract_cell(unsigned *ch, struct uucell *cell)
{
@@ -19,15 +20,21 @@ static void extract_cell(unsigned *ch, struct uucell *cell)
const void *ascii_get_glyph(unsigned);
-static const void *lookup_glyph(unsigned *this, int i, unsigned *prev, unsigned *next)
+static const void *lookup_glyph(struct ucf *f, int i, unsigned *this, unsigned *prev, unsigned *next, int width, int part)
{
- return ascii_get_glyph(this[i]);
+ const unsigned char *a;
+ static const unsigned c[2] = { 0xfffd, 0 };
+ int g = ucf_lookup(f, i, this, prev, next, width);
+ if (g<0 && !i) g = ucf_lookup(f, i, c, c, c, width);
+ if (g>=0) return f->glyphs + f->S * (g + part);
+ return 0;
}
void uuterm_refresh_row(struct uudisp *d, struct uurow *row, int x1, int x2)
{
- unsigned ch[4][sizeof(row->cells[0].c)+1];
+ unsigned ch[4][sizeof(row->cells[0].c)+1], *chp;
int x, i;
+ int width, part;
if (x1) extract_cell(ch[(x1-1)&3], &row->cells[x1-1]);
else memset(ch[3], 0, sizeof(ch[3]));
@@ -35,9 +42,16 @@ void uuterm_refresh_row(struct uudisp *d, struct uurow *row, int x1, int x2)
for (x=x1; x<=x2; x++) {
extract_cell(ch[(x+1)&3], &row->cells[x+1]);
- for (i=0; i<sizeof(ch[0]) && ch[x&3][i]; i++) {
- const void *glyph = lookup_glyph(ch[x&3], i, ch[(x+3)&3], ch[(x+1)&3]);
- uudisp_draw_glyph(d, row->idx, x, glyph, row->cells[x].a & 0xff);
+ if (ch[x&3][0] == UU_FULLWIDTH) {
+ width = 2; part = 0; chp = ch[(x+1)&3];
+ } else if (ch[(x+3)&3][0] == UU_FULLWIDTH) {
+ width = 2; part = 1; chp = ch[x&3];
+ } else {
+ width = 1; part = 0; chp = ch[x&3];
+ }
+ for (i=0; i<sizeof(ch[0]) && chp[i]; i++) {
+ const void *glyph = lookup_glyph(d->font, i, chp, ch[(x+3)&3], ch[(x+1)&3], width, part);
+ if (glyph) uudisp_draw_glyph(d, row->idx, x, glyph, row->cells[x].a & 0xff);
}
}
}
diff --git a/ucf.c b/ucf.c
new file mode 100644
index 0000000..baf9c48
--- /dev/null
+++ b/ucf.c
@@ -0,0 +1,133 @@
+/* uuterm, Copyright (C) 2006 Rich Felker; licensed under GNU GPL v2 only */
+
+/* note: the following implementation of ucf is NOT SECURE. malicious or
+ * damaged files can cause it to crash or possibly enter into an infinite
+ * loop, or cause other parts of the process core to be read as a font,
+ * possibly leading to information leaks. however there is no possibility
+ * of privilege elevation as ucf never writes to memory.
+ *
+ * users needing a robust implementation would be advised to simply run a
+ * sanity check across the whole font file before accepting it, rather than
+ * incurring large bounds-checking penalties at each glyph lookup.
+ */
+
+#include <stddef.h>
+#include "ucf.h"
+
+#define U24(p) ( ((p)[0]<<16) | ((p)[1]<<8) | (p)[2] )
+#define U32(p) ( ((p)[0]<<24) | U24((p)+1) )
+
+int ucf_init(struct ucf *f, const unsigned char *map, size_t len)
+{
+ size_t n;
+ if (memcmp(map, "ucf\300\000\001\000\000", 8))
+ return -1;
+ f->w = map[8];
+ f->h = map[9];
+ f->s = (f->w+7)>>3;
+ f->S = f->s * f->h;
+ f->ranges = map + U32(map+20) + 4;
+ f->gmap = map + U32(map+24);
+ f->glyphs = map + U32(map+28);
+ f->ctab = f->ranges + 8*(f->nranges = U32(f->ranges - 4));
+ return 0;
+}
+
+#define GMAP_WIDTH 1
+
+#define GMAP_FINAL1 0
+#define GMAP_FINAL2 1
+#define GMAP_GLYPH1 2
+#define GMAP_GLYPH2 3
+
+#define RULE_RANGE 4
+#define RULE_ATTACHED_TO 5
+#define RULE_WITH_ATTACHED 6
+#define RULE_FOLLOWS 7
+#define RULE_PRECEDES 8
+
+#define CTAB_MASK 0x3fffffff
+#define CTAB_INDIRECT 0x80000000
+#define CTAB_WIDTH 30
+
+int ucf_lookup(struct ucf *f, int idx, const unsigned *cc,
+ const unsigned *pc, const unsigned *nc, int width)
+{
+ unsigned ch = cc[idx];
+ unsigned a, l, x, i;
+ const unsigned *c;
+ const unsigned char *p;
+
+ for (p=f->ranges, a=0; ch>=(a+=U32(p)); p+=8) {
+ if (ch-a < (l=U32(p+4))) {
+ x = U32(f->ctab+4*(a-1));
+ if (x>>30 != width-1)
+ return -1;
+ return (x & 0x3fffffff) + (ch-a)*width;
+ }
+ ch -= l;
+ }
+ x = U32(f->ctab+4*ch);
+ if (!((x+1) & CTAB_INDIRECT)) {
+ if (x>>CTAB_WIDTH != width-1) return -1;
+ return x & CTAB_MASK;
+ }
+ x &= 0x7fffffff;
+ i = idx;
+ c = cc;
+ for (p=f->gmap+x; ; p+=4) {
+ if (*p <= GMAP_GLYPH2) {
+ if ((*p & GMAP_WIDTH) == width-1) break;
+ else if (*p <= GMAP_FINAL2) return -1;
+ i = idx; c = cc;
+ continue;
+ }
+ x = *p;
+ a = U24(p+1);
+ if (p[4] == RULE_RANGE) {
+ p += 4;
+ l = U24(p+1);
+ } else l = 1;
+ switch (x) {
+ case RULE_ATTACHED_TO:
+ if (i && c[--i]-a < l) continue;
+ break;
+ case RULE_WITH_ATTACHED:
+ if (c[++i]-a < l) continue;
+ break;
+ case RULE_FOLLOWS:
+ if ((c=pc)[i=0]-a < l) continue;
+ break;
+ case RULE_PRECEDES:
+ if ((c=nc)[i=0]-a < l) continue;
+ break;
+ }
+ /* Skip until the next mapping */
+ for (; *p > GMAP_GLYPH2; p+=4);
+ i = idx; c = cc;
+ }
+ return U24(p+1);
+}
+
+#if 0
+#include <stdio.h>
+#include <stdlib.h>
+
+int main(int argc, char *argv[])
+{
+ int i, j;
+ struct ucf f;
+ static char tmp[1000000];
+ ucf_init(&f, tmp, fread(tmp, 1, sizeof tmp, stdin));
+ for (i=1; i<argc; i++) {
+ unsigned x[5] = { strtol(argv[i], NULL, 16), 0 };
+ int g;
+ if (i+1<argc) x[1] = strtol(argv[i+1], NULL, 16);
+ printf("char %.4x maps to glyph %d\n", x[1], g=ucf_lookup(&f, 1, x, x+4, x+4, 1));
+ if (g >= 0) for (j=0; j<16; j++)
+ printf("%.2X", f.glyphs[16*g+j]);
+ printf("\n");
+ }
+ return 0;
+}
+#endif
diff --git a/ucf.h b/ucf.h
new file mode 100644
index 0000000..da238cd
--- /dev/null
+++ b/ucf.h
@@ -0,0 +1,14 @@
+/* uuterm, Copyright (C) 2006 Rich Felker; licensed under GNU GPL v2 only */
+
+#include <stddef.h>
+
+struct ucf
+{
+ int w, h, s, S;
+ const unsigned char *ranges, *ctab, *gmap, *glyphs;
+ unsigned nranges;
+};
+
+int ucf_init(struct ucf *, const unsigned char *, size_t);
+int ucf_lookup(struct ucf *, int, const unsigned *,
+ const unsigned *, const unsigned *, int);
diff --git a/uuterm.h b/uuterm.h
index f392bda..81c4baf 100644
--- a/uuterm.h
+++ b/uuterm.h
@@ -69,6 +69,7 @@ struct uudisp
unsigned char *intext;
unsigned char inbuf[16];
int blink;
+ void *font;
long priv[64];
};