chiark / gitweb /
Beginnings of 'GSUB' generation: a table of the lookups we need
authorBen Harris <bjh21@bjh21.me.uk>
Mon, 4 Nov 2024 23:59:09 +0000 (23:59 +0000)
committerBen Harris <bjh21@bjh21.me.uk>
Thu, 14 Nov 2024 22:27:18 +0000 (22:27 +0000)
This is now used to generate the 'name' entries for stylistic sets.

bedstead.c

index 2dd0fc6bdbe6e0e4b729863676488f5afdad4d6c..324490b367ef8da522621bf2e66a8c40cec9ac6a 100644 (file)
@@ -2620,6 +2620,28 @@ static int const nglyphs = NGLYPHS;
 
 static struct glyph const *glyphs_by_name[NGLYPHS];
 
+static struct gsub_lookup {
+       char const *tag;
+       char const *suffix;
+#define SCRIPT_DFLT 0x01
+#define SCRIPT_LATN 0x02
+#define SCRIPT_ALL  0x03       
+       unsigned int scripts;
+       char const *name;
+} const gsub_lookups[] = {
+       { "aalt", NULL,      SCRIPT_ALL },
+       { "smcp", "sc",      SCRIPT_LATN },
+       { "c2sc", "c2sc",    SCRIPT_LATN },
+       { "rtlm", "rtlm",    SCRIPT_ALL },
+       { "ss01", "saa5051", SCRIPT_ALL, "SAA5051" },
+       { "ss02", "saa5052", SCRIPT_ALL, "SAA5052" },
+       { "ss04", "saa5054", SCRIPT_ALL, "SAA5054" },
+       { "ss14", "sep4",    SCRIPT_ALL, "4-cell separated graphics" },
+       { "ss16", "sep6",    SCRIPT_ALL, "6-cell separated graphics" },
+};
+
+#define NGSUB_LOOKUPS (sizeof(gsub_lookups) / sizeof(gsub_lookups[0]))
+
 static void dochar(struct glyph *g);
 static void dochar_plotter(struct glyph *g);
 static void domosaic(struct glyph *g);
@@ -2994,11 +3016,10 @@ main(int argc, char **argv)
        NAME(5, "Version " VERSION);
        NAME(6, fullname_to_fontname(get_fullname()));
        /* Stylistic set names. */
-       NAME(0x101, "SAA5051");
-       NAME(0x102, "SAA5052");
-       NAME(0x104, "SAA5054");
-       NAME(0x114, "4-cell separated graphics");
-       NAME(0x116, "6-cell separated graphics");
+#define NAMEBASE_GSUB 0x100
+       for (i = 0; i < NGSUB_LOOKUPS; i++)
+               if (gsub_lookups[i].name != NULL)
+                       NAME(NAMEBASE_GSUB + i, gsub_lookups[i].name);
        printf(" </name>\n");
 
        printf(" <cmap><tableVersion version='0'/>\n");