chiark / gitweb /
Emit AlternateSets for 'aalt' overrides
authorBen Harris <bjh21@bjh21.me.uk>
Wed, 1 Jan 2025 23:18:13 +0000 (23:18 +0000)
committerBen Harris <bjh21@bjh21.me.uk>
Wed, 1 Jan 2025 23:18:13 +0000 (23:18 +0000)
These are just emitted after the standard AlternateSets, and because
of how TTX works, they end up overriding the standard ones.  This
seems a bit dodgy to me, so I might try to do better later.

bedstead.c

index f351431de8bf048461754bb583203590d10ccd1a..e2410d6191bfd959a7dd2ebaa06e5bfd44b95040 100644 (file)
@@ -2764,7 +2764,8 @@ static void domosaic4(struct glyph *g);
 static void dopanose(void);
 static void docmap(int pid, int eid, int format);
 static void dogsub(void);
-static void doaltsubs(void);
+static void doaltsubs(int noverrides,
+                     const struct alt_sub_override[noverrides]);
 static void dosinglesubs(char const *suffix);
 static void dogpos(void);
 static void glyph_complement(void);
@@ -3639,7 +3640,8 @@ dogsub(void)
                        TTXI("LookupType", 3);
                        TTXI("LookupFlag", 0);
                        printf("     <AlternateSubst>\n");
-                       doaltsubs();
+                       doaltsubs(gsub_features[i].noverrides,
+                                 gsub_features[i].overrides);
                        printf("     </AlternateSubst>\n");
                }
                printf("    </Lookup>\n");
@@ -3651,9 +3653,9 @@ dogsub(void)
 
 /* Find all the mappings from normal to alternative glyphs. */
 static void
-doaltsubs(void)
+doaltsubs(int noverrides, const struct alt_sub_override overrides[noverrides])
 {
-       int i;
+       int i, j;
 
        for (i = 1; i < nglyphs; i++) {
 #define HASDOT(x) (strchr(glyphs_by_name[x]->name, '.') != NULL)
@@ -3673,6 +3675,15 @@ doaltsubs(void)
                        printf("</AlternateSet>\n");
                }
        }
+
+       for (i = 0; i < noverrides; i++) {
+               printf("      <AlternateSet glyph='%s'>", overrides[i].base);
+               for (j = 0; j < MAX_ALT_SUB_OVERRIDE &&
+                            overrides[i].alt[j] != NULL; j++)
+                       printf("<Alternate glyph='%s'/>",
+                              overrides[i].alt[j]);
+               printf("</AlternateSet>\n");
+       }       
 }
 
 /* Find all mappings for a single feature. */