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
/* 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++)
TTXI(LookupType, 1);
TTXI(LookupFlag, 0);
printf(" <SingleSubst>\n");
+ dosinglesubs(gsub_features[i].suffix);
printf(" </SingleSubst>\n");
}
printf(" </Lookup>\n");
}
}
+/* 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(" <Substitution in='%.*s' out='%s'/>\n",
+ (int)(dot - glyphs[i].name),
+ glyphs[i].name, glyphs[i].name);
+}
+
/* Emit a charstring for a glyph. */
static void
doglyph(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;