From: Ben Harris Date: Wed, 6 Nov 2024 20:47:20 +0000 (+0000) Subject: Put single substitutions in the GSUB table X-Git-Tag: bedstead-3.246~48 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~bjharris/git?a=commitdiff_plain;h=27f54ed92662bf4cdf209f7e6d5b433938682664;p=bedstead-debian.git Put single substitutions in the GSUB table --- diff --git a/bedstead.c b/bedstead.c index b82753b..f1d073c 100644 --- a/bedstead.c +++ b/bedstead.c @@ -2661,9 +2661,9 @@ static void dopanose(void); static void docmap(int pid, int eid, int format); static void dogsub(void); static void doaltsubs(void); +static void dosinglesubs(char const *suffix); static void glyph_complement(void); static void bdf_gen(int size); -static void dolookups(struct glyph *); static void doglyph(struct glyph *); static bool @@ -3084,32 +3084,6 @@ main(int argc, char **argv) /* printf("StrokedFont: 1\n"); */ /* printf("StrokeWidth: 50\n"); */ /* } */ - /* printf("Lookup: 1 0 0 \"smcp: lower-case to small caps\" " */ - /* "{\"smcp\" (\"sc\")} " */ - /* "['smcp' ('latn' <'dflt'>)]\n"); */ - /* printf("Lookup: 1 0 0 \"c2sc: upper-case to small caps\" " */ - /* "{\"c2sc\" (\"c2sc\")} " */ - /* "['c2sc' ('latn' <'dflt'>)]\n"); */ - /* printf("Lookup: 1 0 0 \"rtlm: right-to-left mirrored forms\" " */ - /* "{\"rtlm\" (\"rtlm\")} " */ - /* "['rtlm' ('DFLT' <'dflt'> 'latn' <'dflt'>)]\n"); */ - /* printf("Lookup: 1 0 0 \"ss01: SAA5051 forms\" {\"ss01\" (\"saa5051\")} " */ - /* "['ss01' ('DFLT' <'dflt'> 'latn' <'dflt'>)]\n"); */ - /* printf("OtfFeatName: 'ss01' 1033 \"SAA5051\"\n"); */ - /* printf("Lookup: 1 0 0 \"ss02: SAA5052 forms\" {\"ss02\" (\"saa5052\")} " */ - /* "['ss02' ('DFLT' <'dflt'> 'latn' <'dflt'>)]\n"); */ - /* printf("OtfFeatName: 'ss02' 1033 \"SAA5052\"\n"); */ - /* printf("Lookup: 1 0 0 \"ss04: SAA5054 forms\" {\"ss04\" (\"saa5054\")} " */ - /* "['ss04' ('DFLT' <'dflt'> 'latn' <'dflt'>)]\n"); */ - /* printf("OtfFeatName: 'ss04' 1033 \"SAA5054\"\n"); */ - /* printf("Lookup: 1 0 0 \"ss14: 4-cell separated graphics\" " */ - /* "{\"ss14\" (\"sep4\")} " */ - /* "['ss14' ('DFLT' <'dflt'> 'latn' <'dflt'>)]\n"); */ - /* printf("OtfFeatName: 'ss14' 1033 \"4-cell separated graphics\"\n"); */ - /* printf("Lookup: 1 0 0 \"ss16: 6-cell separated graphics\" " */ - /* "{\"ss16\" (\"sep6\")} " */ - /* "['ss16' ('DFLT' <'dflt'> 'latn' <'dflt'>)]\n"); */ - /* printf("OtfFeatName: 'ss16' 1033 \"6-cell separated graphics\"\n"); */ /* printf("Lookup: 257 0 0 \"palt: proportional metrics\" {\"palt\"} " */ /* "['palt' ('DFLT' <'dflt'> 'latn' <'dflt'>)]\n"); */ for (i = 0; i < nglyphs; i++) @@ -3380,6 +3354,7 @@ dogsub(void) TTXI(LookupType, 1); TTXI(LookupFlag, 0); printf(" \n"); + dosinglesubs(gsub_features[i].suffix); printf(" \n"); } printf(" \n"); @@ -3416,6 +3391,21 @@ doaltsubs(void) } } +/* Find all mappings for a single feature. */ +static void +dosinglesubs(char const *suffix) +{ + int i; + char *dot; + + for (i = 0; i < nglyphs; i++) + if ((dot = strchr(glyphs[i].name, '.')) != NULL && + strcmp(dot, suffix) == 0) + printf(" \n", + (int)(dot - glyphs[i].name), + glyphs[i].name, glyphs[i].name); +} + /* Emit a charstring for a glyph. */ static void doglyph(struct glyph *g) @@ -3469,44 +3459,6 @@ dopalt(struct glyph *g) } -static void -dolookups(struct glyph *g) -{ - char prefix[32]; - struct glyph const **found, **gp; - size_t plen; - bool any_alt = false; - - plen = sprintf(prefix, "%s.", g->name); - assert(plen < 32); - - /* Look for related glyphs */ - found = bsearch(&g, glyphs_by_name, nglyphs, sizeof(glyphs_by_name[0]), - &compare_glyphs_by_name); - assert(found != NULL); - for (gp = found + 1; gp < glyphs_by_name + nglyphs; gp++) { - if (strncmp(prefix, (*gp)->name, plen) != 0) break; - any_alt = true; - if (strcmp((*gp)->name + plen, "saa5051") == 0) - printf("Substitution2: \"ss01\" %s\n", (*gp)->name); - if (strcmp((*gp)->name + plen, "saa5052") == 0) - printf("Substitution2: \"ss02\" %s\n", (*gp)->name); - if (strcmp((*gp)->name + plen, "saa5054") == 0) - printf("Substitution2: \"ss04\" %s\n", (*gp)->name); - if (strcmp((*gp)->name + plen, "sep4") == 0) - printf("Substitution2: \"ss14\" %s\n", (*gp)->name); - if (strcmp((*gp)->name + plen, "sep6") == 0) - printf("Substitution2: \"ss16\" %s\n", (*gp)->name); - if (strcmp((*gp)->name + plen, "sc") == 0) - printf("Substitution2: \"smcp\" %s\n", (*gp)->name); - if (strcmp((*gp)->name + plen, "c2sc") == 0) - printf("Substitution2: \"c2sc\" %s\n", (*gp)->name); - if (strcmp((*gp)->name + plen, "rtlm") == 0) - printf("Substitution2: \"rtlm\" %s\n", (*gp)->name); - } - dopalt(g); -} - typedef struct vec { int x, y; } vec;