chiark / gitweb /
Skeleton of GPOS support
authorBen Harris <bjh21@bjh21.me.uk>
Wed, 6 Nov 2024 23:05:54 +0000 (23:05 +0000)
committerBen Harris <bjh21@bjh21.me.uk>
Thu, 14 Nov 2024 22:27:18 +0000 (22:27 +0000)
bedstead.c

index f1d073c3504d3c372b6ebc0b180a27bec0946ee8..7209cb1b5226a088cd9f220f1d8f14173c65cadd 100644 (file)
@@ -2662,6 +2662,7 @@ 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 dogpos(void);
 static void glyph_complement(void);
 static void bdf_gen(int size);
 static void doglyph(struct glyph *);
@@ -3127,6 +3128,7 @@ main(int argc, char **argv)
                       (int)realglyph(&glyphs[i])->left_sidebearing);
        printf(" </hmtx>\n");
        dogsub();
+       dogpos();
        printf("</ttFont>\n");
        return EXIT_SUCCESS;
 }
@@ -3406,6 +3408,40 @@ dosinglesubs(char const *suffix)
                               glyphs[i].name, glyphs[i].name);
 }
 
+
+static void
+dogpos(void)
+{
+
+       /* We only support one 'GPOS' lookup, 'palt'. */
+       printf(" <GPOS>\n");
+       TTXS(Version, "0x00010000");
+       printf("  <ScriptList>\n");
+       printf("   <ScriptRecord>\n");
+       TTXS(ScriptTag, "DFLT");
+       printf("    <Script><DefaultLangSys>\n");
+       TTXI(ReqFeatureIndex, 0xffff); /* No required feature. */
+       TTXI(FeatureIndex, 0);
+       printf("    </DefaultLangSys></Script>\n");
+       printf("   </ScriptRecord>\n");
+       printf("  </ScriptList>\n");
+       printf("  <FeatureList>\n");
+       printf("   <FeatureRecord>\n");
+       TTXS(FeatureTag, "palt");
+       printf("    <Feature>\n");
+       TTXI(LookupListIndex, 0);
+       printf("    </Feature>\n");
+       printf("   </FeatureRecord>\n");
+       printf("  </FeatureList>\n");
+       printf("  <LookupList>\n");
+       printf("   <Lookup>\n");
+       TTXI(LookupType, 1);
+       TTXI(LookupFlag, 0);
+       printf("   </Lookup>\n");
+       printf("  </LookupList>\n");
+       printf(" </GPOS>\n");
+}
+
 /* Emit a charstring for a glyph. */
 static void
 doglyph(struct glyph *g)