From f919dbc7aeb1c4803d417657e31e3ab2ab9bbb78 Mon Sep 17 00:00:00 2001 From: Ben Harris Date: Mon, 4 Nov 2024 23:59:09 +0000 Subject: [PATCH] Beginnings of 'GSUB' generation: a table of the lookups we need This is now used to generate the 'name' entries for stylistic sets. --- bedstead.c | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/bedstead.c b/bedstead.c index 2dd0fc6..324490b 100644 --- a/bedstead.c +++ b/bedstead.c @@ -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(" \n"); printf(" \n"); -- 2.30.2