static void dochar_plotter(char const data[YSIZE], unsigned flags);
static void domosaic(unsigned code, bool sep);
static void domosaic4(unsigned code);
+static void doalias(char const *alias_of);
static void dopanose(void);
static void glyph_complement(void);
/* U(N) sets the code point and name of a glyph not in AGLFN */
#define U(N) 0x ## N, "uni" #N
+#define ALIAS(alias, canonical) {{},-1,alias,0,canonical}
static struct glyph {
char data[YSIZE];
#define SC 0x01 /* Character has a small-caps variant. */
#define MOS 0x02 /* Mosaic graphics character */
#define MOS4 0x04 /* 4-cell mosaic graphics character */
+ char const *alias_of;
} const glyphs[] = {
/*
* The first batch of glyphs comes from the code tables at the end of
{{004,012,021,021,025,033,021,000,000}, U(1FBCA) }, /* white chevron up */
/* Latin small caps */
- {{000,000,016,021,037,021,021,000,000}, -1, "a.sc" },
- {{000,000,036,021,036,021,036,000,000}, -1, "b.sc" },
- {{000,000,016,021,020,021,016,000,000}, -1, "c.sc" },
- {{000,000,036,021,021,021,036,000,000}, -1, "d.sc" },
- {{000,000,037,020,036,020,037,000,000}, -1, "e.sc" },
- {{000,000,037,020,036,020,020,000,000}, -1, "f.sc" },
- {{000,000,017,020,023,021,017,000,000}, -1, "g.sc" },
- {{000,000,021,021,037,021,021,000,000}, -1, "h.sc" },
- {{000,000,016,004,004,004,016,000,000}, -1, "i.sc" },
- {{000,000,001,001,001,021,016,000,000}, -1, "j.sc" },
- {{000,000,021,022,034,022,021,000,000}, -1, "k.sc" },
- {{000,000,020,020,020,020,037,000,000}, -1, "l.sc" },
- {{000,000,021,033,025,021,021,000,000}, -1, "m.sc" },
- {{000,000,021,031,025,023,021,000,000}, -1, "n.sc" },
- {{000,000,016,021,021,021,016,000,000}, -1, "o.sc" },
- {{000,000,036,021,036,020,020,000,000}, -1, "p.sc" },
- {{000,000,016,021,025,022,015,000,000}, -1, "q.sc" },
- {{000,000,036,021,036,022,021,000,000}, -1, "r.sc" },
- {{000,000,017,020,016,001,036,000,000}, -1, "s.sc" },
- {{000,000,037,004,004,004,004,000,000}, -1, "t.sc" },
- {{000,000,021,021,021,021,016,000,000}, -1, "u.sc" },
- {{000,000,021,021,012,012,004,000,000}, -1, "v.sc" },
- {{000,000,021,021,025,025,012,000,000}, -1, "w.sc" },
- {{000,000,021,012,004,012,021,000,000}, -1, "x.sc" },
- {{000,000,021,012,004,004,004,000,000}, -1, "y.sc" },
- {{000,000,037,001,016,020,037,000,000}, -1, "z.sc" },
+ {{000,000,016,021,037,021,021,000,000}, -1, "a.sc" }, ALIAS("A.c2sc", "a.sc"),
+ {{000,000,036,021,036,021,036,000,000}, -1, "b.sc" }, ALIAS("B.c2sc", "b.sc"),
+ {{000,000,016,021,020,021,016,000,000}, -1, "c.sc" }, ALIAS("C.c2sc", "c.sc"),
+ {{000,000,036,021,021,021,036,000,000}, -1, "d.sc" }, ALIAS("D.c2sc", "d.sc"),
+ {{000,000,037,020,036,020,037,000,000}, -1, "e.sc" }, ALIAS("E.c2sc", "e.sc"),
+ {{000,000,037,020,036,020,020,000,000}, -1, "f.sc" }, ALIAS("F.c2sc", "f.sc"),
+ {{000,000,017,020,023,021,017,000,000}, -1, "g.sc" }, ALIAS("G.c2sc", "g.sc"),
+ {{000,000,021,021,037,021,021,000,000}, -1, "h.sc" }, ALIAS("H.c2sc", "h.sc"),
+ {{000,000,016,004,004,004,016,000,000}, -1, "i.sc" }, ALIAS("I.c2sc", "i.sc"),
+ {{000,000,001,001,001,021,016,000,000}, -1, "j.sc" }, ALIAS("J.c2sc", "j.sc"),
+ {{000,000,021,022,034,022,021,000,000}, -1, "k.sc" }, ALIAS("K.c2sc", "k.sc"),
+ {{000,000,020,020,020,020,037,000,000}, -1, "l.sc" }, ALIAS("L.c2sc", "l.sc"),
+ {{000,000,021,033,025,021,021,000,000}, -1, "m.sc" }, ALIAS("M.c2sc", "m.sc"),
+ {{000,000,021,031,025,023,021,000,000}, -1, "n.sc" }, ALIAS("N.c2sc", "n.sc"),
+ {{000,000,016,021,021,021,016,000,000}, -1, "o.sc" }, ALIAS("O.c2sc", "o.sc"),
+ {{000,000,036,021,036,020,020,000,000}, -1, "p.sc" }, ALIAS("P.c2sc", "p.sc"),
+ {{000,000,016,021,025,022,015,000,000}, -1, "q.sc" }, ALIAS("Q.c2sc", "q.sc"),
+ {{000,000,036,021,036,022,021,000,000}, -1, "r.sc" }, ALIAS("R.c2sc", "r.sc"),
+ {{000,000,017,020,016,001,036,000,000}, -1, "s.sc" }, ALIAS("S.c2sc", "s.sc"),
+ {{000,000,037,004,004,004,004,000,000}, -1, "t.sc" }, ALIAS("T.c2sc", "t.sc"),
+ {{000,000,021,021,021,021,016,000,000}, -1, "u.sc" }, ALIAS("U.c2sc", "u.sc"),
+ {{000,000,021,021,012,012,004,000,000}, -1, "v.sc" }, ALIAS("V.c2sc", "v.sc"),
+ {{000,000,021,021,025,025,012,000,000}, -1, "w.sc" }, ALIAS("W.c2sc", "w.sc"),
+ {{000,000,021,012,004,012,021,000,000}, -1, "x.sc" }, ALIAS("X.c2sc", "x.sc"),
+ {{000,000,021,012,004,004,004,000,000}, -1, "y.sc" }, ALIAS("Y.c2sc", "y.sc"),
+ {{000,000,037,001,016,020,037,000,000}, -1, "z.sc" }, ALIAS("Z.c2sc", "z.sc"),
{{000,000,016,021,022,021,026,000,000}, -1, "germandbls.sc" },
+ ALIAS("uni1E9E.c2sc", "germandbls.sc"),
/* and finally */
{{037,021,021,021,021,021,037,000,000}, -1, ".notdef" },
return strcmp(a->name, b->name);
}
+static int compare_glyph_to_name(const void *vn, const void *vg)
+{
+ struct glyph const * const *gp = vg;
+ struct glyph const *g = *gp;
+ char const *name = vn;
+
+ return strcmp(name, g->name);
+}
+
+static struct glyph const *get_glyph_by_name(char const *name)
+{
+ struct glyph const * const *gp;
+
+ gp = bsearch(name, glyphs_by_name, nglyphs,
+ sizeof(glyphs_by_name[0]), &compare_glyph_to_name);
+ assert(gp != NULL);
+ return *gp;
+}
+
int
main(int argc, char **argv)
{
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\"} "
+ printf("Lookup: 1 0 0 \"c2sc: upper-case to small caps\" "
+ "{\"c2sc\" (\"c2sc\")} "
"['c2sc' ('latn' <'dflt'>)]\n");
printf("BeginChars: %d %d\n", 0x110000 + extraglyphs, nglyphs);
extraglyphs = 0;
printf("Flags: HW\n");
printf("LayerCount: 2\n");
dolookups(&glyphs[i]);
- if (glyphs[i].flags & MOS)
+ if (glyphs[i].alias_of != NULL)
+ doalias(glyphs[i].alias_of);
+ else if (glyphs[i].flags & MOS)
domosaic(glyphs[i].data[0],
(glyphs[i].data[0] & 0x20) != 0);
else if (glyphs[i].flags & MOS4)
unsigned char cols = 0;
int dx = 0, dh = 0;
+ while (g->alias_of != NULL)
+ g = get_glyph_by_name(g->alias_of);
if (g->flags & MOS) return;
/*
* For proportional layout, we'd like a left side-bearing of
emit_path();
}
+static void
+doalias(char const *alias_of)
+{
+ struct glyph const *g;
+
+ g = get_glyph_by_name(alias_of);
+ printf("Refer: %td %d N 1 0 0 1 0 0 1\n", g - glyphs, g->unicode);
+}
+
static int
byunicode(const void *va, const void *vb)
{