Make the 'c2sc' feature work like others

Now that we can have aliases, we can arrange that 'smcp' applied to
"a", and 'c2sc' applied to "A" give differently-named glyphs that have
the same appearance.  This means that something attempting to generate
Unicode from PostScript will be able to properly distinguish them.  It
also means that the SC flag can be removed and we can stop making
assumptions about case-mapping of glyph names.
This commit is contained in:
Ben Harris 2020-03-28 17:00:14 +00:00
parent 1dc4e2da16
commit 0264e16018

View File

@ -230,7 +230,6 @@ static struct glyph {
int unicode;
char const *name;
unsigned int flags;
#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;
@ -273,32 +272,32 @@ static struct glyph {
{{010,004,002,001,002,004,010,000,000}, 0x003e, "greater" },
{{016,021,002,004,004,000,004,000,000}, 0x003f, "question" },
{{016,021,027,025,027,020,016,000,000}, 0x0040, "at" },
{{004,012,021,021,037,021,021,000,000}, 0x0041, "A", SC },
{{036,021,021,036,021,021,036,000,000}, 0x0042, "B", SC },
{{016,021,020,020,020,021,016,000,000}, 0x0043, "C", SC },
{{036,021,021,021,021,021,036,000,000}, 0x0044, "D", SC },
{{037,020,020,036,020,020,037,000,000}, 0x0045, "E", SC },
{{037,020,020,036,020,020,020,000,000}, 0x0046, "F", SC },
{{016,021,020,020,023,021,017,000,000}, 0x0047, "G", SC },
{{021,021,021,037,021,021,021,000,000}, 0x0048, "H", SC },
{{016,004,004,004,004,004,016,000,000}, 0x0049, "I", SC },
{{001,001,001,001,001,021,016,000,000}, 0x004a, "J", SC },
{{021,022,024,030,024,022,021,000,000}, 0x004b, "K", SC },
{{020,020,020,020,020,020,037,000,000}, 0x004c, "L", SC },
{{021,033,025,025,021,021,021,000,000}, 0x004d, "M", SC },
{{021,021,031,025,023,021,021,000,000}, 0x004e, "N", SC },
{{016,021,021,021,021,021,016,000,000}, 0x004f, "O", SC },
{{036,021,021,036,020,020,020,000,000}, 0x0050, "P", SC },
{{016,021,021,021,025,022,015,000,000}, 0x0051, "Q", SC },
{{036,021,021,036,024,022,021,000,000}, 0x0052, "R", SC },
{{016,021,020,016,001,021,016,000,000}, 0x0053, "S", SC },
{{037,004,004,004,004,004,004,000,000}, 0x0054, "T", SC },
{{021,021,021,021,021,021,016,000,000}, 0x0055, "U", SC },
{{021,021,021,012,012,004,004,000,000}, 0x0056, "V", SC },
{{021,021,021,025,025,025,012,000,000}, 0x0057, "W", SC },
{{021,021,012,004,012,021,021,000,000}, 0x0058, "X", SC },
{{021,021,012,004,004,004,004,000,000}, 0x0059, "Y", SC },
{{037,001,002,004,010,020,037,000,000}, 0x005a, "Z", SC },
{{004,012,021,021,037,021,021,000,000}, 0x0041, "A" },
{{036,021,021,036,021,021,036,000,000}, 0x0042, "B" },
{{016,021,020,020,020,021,016,000,000}, 0x0043, "C" },
{{036,021,021,021,021,021,036,000,000}, 0x0044, "D" },
{{037,020,020,036,020,020,037,000,000}, 0x0045, "E" },
{{037,020,020,036,020,020,020,000,000}, 0x0046, "F" },
{{016,021,020,020,023,021,017,000,000}, 0x0047, "G" },
{{021,021,021,037,021,021,021,000,000}, 0x0048, "H" },
{{016,004,004,004,004,004,016,000,000}, 0x0049, "I" },
{{001,001,001,001,001,021,016,000,000}, 0x004a, "J" },
{{021,022,024,030,024,022,021,000,000}, 0x004b, "K" },
{{020,020,020,020,020,020,037,000,000}, 0x004c, "L" },
{{021,033,025,025,021,021,021,000,000}, 0x004d, "M" },
{{021,021,031,025,023,021,021,000,000}, 0x004e, "N" },
{{016,021,021,021,021,021,016,000,000}, 0x004f, "O" },
{{036,021,021,036,020,020,020,000,000}, 0x0050, "P" },
{{016,021,021,021,025,022,015,000,000}, 0x0051, "Q" },
{{036,021,021,036,024,022,021,000,000}, 0x0052, "R" },
{{016,021,020,016,001,021,016,000,000}, 0x0053, "S" },
{{037,004,004,004,004,004,004,000,000}, 0x0054, "T" },
{{021,021,021,021,021,021,016,000,000}, 0x0055, "U" },
{{021,021,021,012,012,004,004,000,000}, 0x0056, "V" },
{{021,021,021,025,025,025,012,000,000}, 0x0057, "W" },
{{021,021,012,004,012,021,021,000,000}, 0x0058, "X" },
{{021,021,012,004,004,004,004,000,000}, 0x0059, "Y" },
{{037,001,002,004,010,020,037,000,000}, 0x005a, "Z" },
{{017,010,010,010,010,010,017,000,000}, 0x005b, "bracketleft" },
{{000,020,010,004,002,001,000,000,000}, 0x005c, "backslash" },
{{036,002,002,002,002,002,036,000,000}, 0x005d, "bracketright" },
@ -2119,13 +2118,13 @@ dolookups(struct glyph const *g)
if (strcmp((*found)->name + plen, "sc") == 0)
printf("Substitution2: \"smcp\" %s\n",
(*found)->name);
if (strcmp((*found)->name + plen, "c2sc") == 0)
printf("Substitution2: \"c2sc\" %s\n",
(*found)->name);
printf("AlternateSubs2: \"aalt\" %s\n",
(*found)->name);
} else break;
}
if ((g->flags & SC))
printf("Substitution2: \"%s\" %c%ssc\n", "c2sc",
tolower((unsigned char)prefix[0]), prefix + 1);
dopalt(g);
}