From a7f9cff84ac603a0f868da01b8b7eec6d4b4b6a0 Mon Sep 17 00:00:00 2001 From: Ben Harris Date: Mon, 5 Oct 2009 23:40:09 +0100 Subject: [PATCH] Add proper lookups so the small caps are accessible. --- ttxt.c | 117 ++++++++++++++++++++++++++++++++------------------------- 1 file changed, 65 insertions(+), 52 deletions(-) diff --git a/ttxt.c b/ttxt.c index f9676cf..7b6de8e 100644 --- a/ttxt.c +++ b/ttxt.c @@ -70,6 +70,7 @@ */ #include +#include #include #define XSIZE 6 @@ -95,6 +96,8 @@ struct glyph { char data[YSIZE]; int unicode; char const *name; + unsigned char flags; +#define SC 1 /* Character has a small-caps variant. */ } glyphs[] = { /* * The first batch of glyphs comes from the code tables at the end of @@ -134,64 +137,64 @@ struct glyph { {{010,004,002,001,002,004,010,000,000}, 0x003e, "greater" }, {{016,021,002,004,004,000,004,000,000}, 0x003f, "question" }, {{016,021,027,025,027,020,016,000,000}, 0x0040, "at" }, - {{004,012,021,021,037,021,021,000,000}, 0x0041, "A" }, - {{036,021,021,036,021,021,036,000,000}, 0x0042, "B" }, - {{016,021,020,020,020,021,016,000,000}, 0x0043, "C" }, - {{036,021,021,021,021,021,036,000,000}, 0x0044, "D" }, - {{037,020,020,036,020,020,037,000,000}, 0x0045, "E" }, - {{037,020,020,036,020,020,020,000,000}, 0x0046, "F" }, - {{016,021,020,020,023,021,017,000,000}, 0x0047, "G" }, - {{021,021,021,037,021,021,021,000,000}, 0x0048, "H" }, - {{016,004,004,004,004,004,016,000,000}, 0x0049, "I" }, - {{001,001,001,001,001,021,016,000,000}, 0x004a, "J" }, - {{021,022,024,030,024,022,021,000,000}, 0x004b, "K" }, - {{020,020,020,020,020,020,037,000,000}, 0x004c, "L" }, - {{021,033,025,025,021,021,021,000,000}, 0x004d, "M" }, - {{021,021,031,025,023,021,021,000,000}, 0x004e, "N" }, - {{016,021,021,021,021,021,016,000,000}, 0x004f, "O" }, - {{036,021,021,036,020,020,020,000,000}, 0x0050, "P" }, - {{016,021,021,021,025,022,015,000,000}, 0x0051, "Q" }, - {{036,021,021,036,024,022,021,000,000}, 0x0052, "R" }, - {{016,021,020,016,001,021,016,000,000}, 0x0053, "S" }, - {{037,004,004,004,004,004,004,000,000}, 0x0054, "T" }, - {{021,021,021,021,021,021,016,000,000}, 0x0055, "U" }, - {{021,021,021,012,012,004,004,000,000}, 0x0056, "V" }, - {{021,021,021,025,025,025,012,000,000}, 0x0057, "W" }, - {{021,021,012,004,012,021,021,000,000}, 0x0058, "X" }, - {{021,021,012,004,004,004,004,000,000}, 0x0059, "Y" }, - {{037,001,002,004,010,020,037,000,000}, 0x005a, "Z" }, + {{004,012,021,021,037,021,021,000,000}, 0x0041, "A", SC }, + {{036,021,021,036,021,021,036,000,000}, 0x0042, "B", SC }, + {{016,021,020,020,020,021,016,000,000}, 0x0043, "C", SC }, + {{036,021,021,021,021,021,036,000,000}, 0x0044, "D", SC }, + {{037,020,020,036,020,020,037,000,000}, 0x0045, "E", SC }, + {{037,020,020,036,020,020,020,000,000}, 0x0046, "F", SC }, + {{016,021,020,020,023,021,017,000,000}, 0x0047, "G", SC }, + {{021,021,021,037,021,021,021,000,000}, 0x0048, "H", SC }, + {{016,004,004,004,004,004,016,000,000}, 0x0049, "I", SC }, + {{001,001,001,001,001,021,016,000,000}, 0x004a, "J", SC }, + {{021,022,024,030,024,022,021,000,000}, 0x004b, "K", SC }, + {{020,020,020,020,020,020,037,000,000}, 0x004c, "L", SC }, + {{021,033,025,025,021,021,021,000,000}, 0x004d, "M", SC }, + {{021,021,031,025,023,021,021,000,000}, 0x004e, "N", SC }, + {{016,021,021,021,021,021,016,000,000}, 0x004f, "O", SC }, + {{036,021,021,036,020,020,020,000,000}, 0x0050, "P", SC }, + {{016,021,021,021,025,022,015,000,000}, 0x0051, "Q", SC }, + {{036,021,021,036,024,022,021,000,000}, 0x0052, "R", SC }, + {{016,021,020,016,001,021,016,000,000}, 0x0053, "S", SC }, + {{037,004,004,004,004,004,004,000,000}, 0x0054, "T", SC }, + {{021,021,021,021,021,021,016,000,000}, 0x0055, "U", SC }, + {{021,021,021,012,012,004,004,000,000}, 0x0056, "V", SC }, + {{021,021,021,025,025,025,012,000,000}, 0x0057, "W", SC }, + {{021,021,012,004,012,021,021,000,000}, 0x0058, "X", SC }, + {{021,021,012,004,004,004,004,000,000}, 0x0059, "Y", SC }, + {{037,001,002,004,010,020,037,000,000}, 0x005a, "Z", SC }, {{017,010,010,010,010,010,017,000,000}, 0x005b, "bracketleft" }, {{000,020,010,004,002,001,000,000,000}, 0x005c, "backslash" }, {{036,002,002,002,002,002,036,000,000}, 0x005d, "bracketright" }, {{004,012,021,000,000,000,000,000,000}, 0x005e, "asciicircum" }, {{000,000,000,000,000,000,037,000,000}, 0x005f, "underscore" }, {{004,004,002,000,000,000,000,000,000}, 0x201b, "quotereversed" }, - {{000,000,016,001,017,021,017,000,000}, 0x0061, "a" }, - {{020,020,036,021,021,021,036,000,000}, 0x0062, "b" }, - {{000,000,017,020,020,020,017,000,000}, 0x0063, "c" }, - {{001,001,017,021,021,021,017,000,000}, 0x0064, "d" }, - {{000,000,016,021,037,020,016,000,000}, 0x0065, "e" }, - {{002,004,004,016,004,004,004,000,000}, 0x0066, "f" }, - {{000,000,017,021,021,021,017,001,016}, 0x0067, "g" }, - {{020,020,036,021,021,021,021,000,000}, 0x0068, "h" }, - {{004,000,014,004,004,004,016,000,000}, 0x0069, "i" }, - {{004,000,004,004,004,004,004,004,010}, 0x006a, "j" }, - {{010,010,011,012,014,012,011,000,000}, 0x006b, "k" }, - {{014,004,004,004,004,004,016,000,000}, 0x006c, "l" }, - {{000,000,032,025,025,025,025,000,000}, 0x006d, "m" }, - {{000,000,036,021,021,021,021,000,000}, 0x006e, "n" }, - {{000,000,016,021,021,021,016,000,000}, 0x006f, "o" }, - {{000,000,036,021,021,021,036,020,020}, 0x0070, "p" }, - {{000,000,017,021,021,021,017,001,001}, 0x0071, "q" }, - {{000,000,013,014,010,010,010,000,000}, 0x0072, "r" }, - {{000,000,017,020,016,001,036,000,000}, 0x0073, "s" }, - {{004,004,016,004,004,004,002,000,000}, 0x0074, "t" }, - {{000,000,021,021,021,021,017,000,000}, 0x0075, "u" }, - {{000,000,021,021,012,012,004,000,000}, 0x0076, "v" }, - {{000,000,021,021,025,025,012,000,000}, 0x0077, "w" }, - {{000,000,021,012,004,012,021,000,000}, 0x0078, "x" }, - {{000,000,021,021,021,021,017,001,016}, 0x0079, "y" }, - {{000,000,037,002,004,010,037,000,000}, 0x007a, "z" }, + {{000,000,016,001,017,021,017,000,000}, 0x0061, "a", SC }, + {{020,020,036,021,021,021,036,000,000}, 0x0062, "b", SC }, + {{000,000,017,020,020,020,017,000,000}, 0x0063, "c", SC }, + {{001,001,017,021,021,021,017,000,000}, 0x0064, "d", SC }, + {{000,000,016,021,037,020,016,000,000}, 0x0065, "e", SC }, + {{002,004,004,016,004,004,004,000,000}, 0x0066, "f", SC }, + {{000,000,017,021,021,021,017,001,016}, 0x0067, "g", SC }, + {{020,020,036,021,021,021,021,000,000}, 0x0068, "h", SC }, + {{004,000,014,004,004,004,016,000,000}, 0x0069, "i", SC }, + {{004,000,004,004,004,004,004,004,010}, 0x006a, "j", SC }, + {{010,010,011,012,014,012,011,000,000}, 0x006b, "k", SC }, + {{014,004,004,004,004,004,016,000,000}, 0x006c, "l", SC }, + {{000,000,032,025,025,025,025,000,000}, 0x006d, "m", SC }, + {{000,000,036,021,021,021,021,000,000}, 0x006e, "n", SC }, + {{000,000,016,021,021,021,016,000,000}, 0x006f, "o", SC }, + {{000,000,036,021,021,021,036,020,020}, 0x0070, "p", SC }, + {{000,000,017,021,021,021,017,001,001}, 0x0071, "q", SC }, + {{000,000,013,014,010,010,010,000,000}, 0x0072, "r", SC }, + {{000,000,017,020,016,001,036,000,000}, 0x0073, "s", SC }, + {{004,004,016,004,004,004,002,000,000}, 0x0074, "t", SC }, + {{000,000,021,021,021,021,017,000,000}, 0x0075, "u", SC }, + {{000,000,021,021,012,012,004,000,000}, 0x0076, "v", SC }, + {{000,000,021,021,025,025,012,000,000}, 0x0077, "w", SC }, + {{000,000,021,012,004,012,021,000,000}, 0x0078, "x", SC }, + {{000,000,021,021,021,021,017,001,016}, 0x0079, "y", SC }, + {{000,000,037,002,004,010,037,000,000}, 0x007a, "z", SC }, {{003,004,004,010,004,004,003,000,000}, 0x007b, "braceleft" }, {{004,004,004,000,004,004,004,000,000}, 0x00a6, "brokenbar" }, {{030,004,004,002,004,004,030,000,000}, 0x007d, "braceright" }, @@ -526,6 +529,10 @@ main(int argc, char **argv) printf(" StdHW 5 [100]\n"); printf(" StdVW 5 [100]\n"); printf("EndPrivate\n"); + printf("Lookup: 1 0 0 \"smcp: lower-case to small caps\" {\"smcp\"} " + "['smcp' ('latn' <'dflt'>)]\n"); + printf("Lookup: 1 0 0 \"c2sc: upper-case to small caps\" {\"c2sc\"} " + "['smcp' ('latn' <'dflt'>)]\n"); printf("BeginChars: %d %d\n", 65536 + extraglyphs, nglyphs); extraglyphs = 0; for (i = 0; i < nglyphs; i++) { @@ -536,6 +543,12 @@ main(int argc, char **argv) printf("Width: 600\n"); printf("Flags: W\n"); printf("LayerCount: 2\n"); + if ((glyphs[i].flags & SC)) + printf("Substitution2: \"%s\" %c%s.sc\n", + isupper((unsigned char)glyphs[i].name[0]) ? + "c2sc" : "smcp", + tolower((unsigned char)glyphs[i].name[0]), + glyphs[i].name + 1); dochar(glyphs[i].data); printf("EndChar\n"); } -- 2.30.2