From: Ben Harris Date: Tue, 26 Nov 2024 02:03:23 +0000 (+0000) Subject: Mark obsolete characters in the glyph complement X-Git-Tag: bedstead-3.251~90 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~bjharris/git?a=commitdiff_plain;h=a2a863c12bbc2c0fcfc1c094afb2dbd279671e6f;p=bedstead.git Mark obsolete characters in the glyph complement 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. --- diff --git a/bedstead.c b/bedstead.c index 8b8632b..38e5ef4 100644 --- a/bedstead.c +++ b/bedstead.c @@ -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");