#define SEP6 (SEP | MOS6)
#define SEP4 (SEP | MOS4)
char const *alias_of;
-} const glyphs[] = {
+} glyphs[] = {
/*
* The first batch of glyphs comes from the code tables at the end of
* the Mullard SAA5050 series datasheet, dated July 1982.
return *gp;
}
+/*
+ * Compare glyphs in a way that will put them in an order that
+ * FontForge won't change. This should mean that our glyph IDs match
+ * FontForge's, so that we can use them in tables that FontForge
+ * doesn't understand.
+ */
+static int
+compare_glyphs_by_ffid(const void *va, const void *vb)
+{
+ struct glyph const *a = va, *b = vb;
+
+ /* .notdef comes first. */
+ if (strcmp(a->name, ".notdef") == 0) return -1;
+ if (strcmp(b->name, ".notdef") == 0) return +1;
+ /* Then characters with Unicode code-points in order. */
+ if ((unsigned)a->unicode < (unsigned)b->unicode) return -1;
+ if ((unsigned)a->unicode > (unsigned)b->unicode) return +1;
+ /* Finally sort by glyph name for an arbitrary stable order. */
+ return strcmp(a->name, b->name);
+}
+
int
main(int argc, char **argv)
{
return 0;
}
+ /* Put glyphs into FontForge-compatible order. */
+ qsort(glyphs, nglyphs, sizeof(glyphs[0]), &compare_glyphs_by_ffid);
for (i = 0; i < nglyphs; i++)
if (glyphs[i].unicode == -1)
extraglyphs++;