From 320de601bc5457dfad8fd8009806e0de21fdafb4 Mon Sep 17 00:00:00 2001 From: Ben Harris Date: Wed, 8 Jan 2025 21:15:53 +0000 Subject: [PATCH] Add cvXX (character variant) lookups The idea of these is that each one allows for choosing between different variants of a single character (or set of closely-related characters). This allows for deciding that you want (for instance) the angular SAA5054 "ccedilla", but not its weird conjoined "ugrave". This seems like a good way to handle chips like the SN74S262 where some samples seem to vary in a single character from others, as well as more generally for making the variant glyphs easily accessible for purposes other than precise emulation. At the moment, each feature only provides alternatives for a single character, but now that we have a mechanism for it, that might change. --- bedstead.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/bedstead.c b/bedstead.c index 31f46e6..52cb016 100644 --- a/bedstead.c +++ b/bedstead.c @@ -2760,6 +2760,31 @@ static struct gsub_feature { .xml = "\n" SUFFIXSUB("ugrave", ".roundjoined") SUFFIXSUB("ocircumflex", ".large") SUFFIXSUB("ccedilla", ".angular") "\n" }, +#define ALT1(g) "" +#define ALT2(a, b) ALT1(a) ALT1(b) +#define ALT3(a, b, c) ALT1(a) ALT2(b, c) +#define ALTSET(g, a) "" a "\n" +#define ALTSUB(x) "\n" x "\n" +#define CROSSALT2(a, b) ALTSUB(ALTSET(a, ALT2(a, b)) ALTSET(b, ALT2(a, b))) +#define CROSSALT3(a, b, c) \ + ALTSUB(ALTSET(a, ALT3(a, b, c)) \ + ALTSET(b, ALT3(a, b, c)) \ + ALTSET(c, ALT3(a, b, c))) +#define CV2(base, a) CROSSALT2(base, base a) +#define CV3(base, a, b) CROSSALT3(base, base a, base b) + { "cv12", SCRIPT_ALL, .xml = CV2("comma", ".left") }, + { "cv14", SCRIPT_ALL, .xml = CV2("period", ".large") }, + { "cv26", SCRIPT_ALL, .xml = CV2("colon", ".leftsmall") }, + { "cv27", SCRIPT_ALL, .xml = CV2("semicolon", ".left") }, + { "cv31", SCRIPT_ALL, .xml = CV2("question", ".open") }, + { "cv38", SCRIPT_ALL, .xml = CV3("D", ".serif", ".narrow") }, + { "cv42", SCRIPT_ALL, .xml = CV2("J", ".narrow") }, + { "cv44", SCRIPT_ALL, .xml = CV2("L", ".narrow") }, + { "cv61", SCRIPT_ALL, .xml = CV2("ugrave",".roundjoined") }, + { "cv74", SCRIPT_ALL, .xml = CV2("j", ".serif") }, + { "cv84", SCRIPT_ALL, .xml = CV2("t", ".small") }, + { "cv92", SCRIPT_ALL, .xml = CV2("ocircumflex", ".large") }, + { "cv94", SCRIPT_ALL, .xml = CV2("ccedilla", ".angular") }, { "ss14", SCRIPT_ALL, ".sep4", .name = "4-cell separated graphics" }, { "ss16", SCRIPT_ALL, ".sep6", .name = "6-cell separated graphics" }, }; -- 2.30.2