chiark / gitweb /
Mark obsolete characters in the glyph complement
authorBen Harris <bjh21@bjh21.me.uk>
Tue, 26 Nov 2024 02:03:23 +0000 (02:03 +0000)
committerBen Harris <bjh21@bjh21.me.uk>
Tue, 26 Nov 2024 02:03:23 +0000 (02:03 +0000)
A technique only slightly spoiled by the fact that nothing flags
obsolete characters yet, so it's actually marking every alias instead.
Still, it puts a nice diagonal bar across the affected characters
telling you to use a different one, which looks nice but may
obliterate the character rather _too_ effectively.

bedstead.c

index 8b8632b30f585ae83d123f5dc4d3e2355eb99b82..38e5ef47da9955824f6e717d5367529b2693a439 100644 (file)
@@ -4448,6 +4448,10 @@ glyph_complement()
        bool newcol = false;
        struct glyph const *sorted[nglyphs], *g;
 
+       for (i = 0; i < nglyphs; i++)
+               glyphs_by_name[i] = glyphs + i;
+       qsort(glyphs_by_name, nglyphs, sizeof(glyphs_by_name[0]),
+             &compare_glyphs_by_name);
        for (i = 0; i < nglyphs; i++)
                sorted[i] = &glyphs[i];
        qsort(sorted, nglyphs, sizeof(sorted[0]), &byunicode);
@@ -4456,6 +4460,7 @@ glyph_complement()
        printf("%%%%Title: %s %s Glyph Complement\n", FAMILY_NAME, VERSION);
        printf("/xfont /%s findfont 20 scalefont def\n", FAMILY_NAME);
        printf("/nfont /%s findfont 10 scalefont def\n", FAMILY_NAME);
+       printf("/sfont /%s findfont 6 scalefont def\n", FAMILY_NAME);
        printf("/lfont /%s findfont 4 scalefont def\n", FAMILY_NAME);
        printf("/str 50 string def\n");
        printf("/centre {\n");
@@ -4475,6 +4480,11 @@ glyph_complement()
        printf(" 20 36 moveto str cvs label\n");
        printf(" 20 2 moveto label\n");
        printf("} def\n");
+       printf("/sash {\n");
+       printf(" gsave 20 20 translate 45 rotate\n");
+       printf(" 8 setlinewidth -30 0 moveto 30 0 lineto stroke\n");
+       printf(" 1 setgray sfont setfont -20 -2.1 moveto show grestore\n");
+       printf("} def\n");
        printf("/colnum {\n");
        printf(" nfont setfont 20 42 moveto centre\n");
        printf("} def\n");
@@ -4518,7 +4528,15 @@ glyph_complement()
                else
                        printf("()");
                printf("/%s ", g->name);
-               printf("exemplify grestore\n");
+               printf("exemplify ");
+               if (g->flags & IS_ALIAS) {
+                       struct glyph *target = get_glyph_by_name(g->alias_of);
+                       if (target->unicode != -1)
+                               printf("(USE U+%04lX) sash ", target->unicode);
+                       else
+                               printf("(USE %s) sash ", g->alias_of);
+               }
+               printf(" grestore\n");
        }
        printf("showpage\n");
        printf("%%%%EOF\n");