/* Top row (and left column) don't appear in ROM. */
char data[YSIZE - 1];
char const *alias_of;
+ int subr_idx;
};
int_least32_t unicode;
char const *name;
#define SEP6 (SEP | MOS6)
#define SEP4 (SEP | MOS4)
#define IS_ALIAS 0x08
+#define IS_SUBR 0x10
} glyphs[] = {
/*
* The first batch of glyphs comes from the code tables at the end of
return strcmp(name, g->name);
}
-static struct glyph const *
+static struct glyph *
get_glyph_by_name(char const *name)
{
- struct glyph const * const *gp;
+ struct glyph * const *gp;
gp = bsearch(name, glyphs_by_name, nglyphs,
sizeof(glyphs_by_name[0]), &compare_glyph_to_name);
return strcmp(a->name, b->name);
}
+static int nsubrs;
+
int
main(int argc, char **argv)
{
glyphs_by_name[i] = glyphs + i;
qsort(glyphs_by_name, nglyphs, sizeof(glyphs_by_name[0]),
&compare_glyphs_by_name);
+ /* Scan for aliased glyphs to turn into subroutines. */
+ printf(" <Subrs>\n");
+ nsubrs = 0;
+ for (i = 0; i < nglyphs; i++) {
+ struct glyph *g = &glyphs[i];
+ if (g->flags & IS_ALIAS) {
+ while (g->flags & IS_ALIAS)
+ g = get_glyph_by_name(g->alias_of);
+ if (g->flags & IS_SUBR) continue;
+ printf(" <CharString> <!-- %s -->\n", g->name);
+ doglyph(g);
+ g->flags = IS_SUBR;
+ g->subr_idx = nsubrs++;
+ printf(" </CharString>\n");
+ }
+ }
+ printf(" </Subrs>\n");
printf(" </Private>\n");
printf(" <CharStrings>\n");
for (i = 0; i < nglyphs; i++) {
while (g->flags & IS_ALIAS)
g = get_glyph_by_name(g->alias_of);
- if (g->flags & MOS6)
+ if (g->flags & IS_SUBR)
+ printf(" %d callsubr\n", g->subr_idx -
+ (nsubrs < 1240 ? 107 : 1131));
+ else if (g->flags & MOS6)
domosaic(g->data[0], (g->flags & SEP) != 0);
else if (g->flags & MOS4)
domosaic4(g->data[0], (g->flags & SEP) != 0);