From 15d1191aebb917dbc9c18b901e7e26a799bb1437 Mon Sep 17 00:00:00 2001 From: Ben Harris Date: Thu, 20 Nov 2025 21:51:28 +0000 Subject: [PATCH] Emit a format-14 'cmap' subtable for variation sequences Now I can put in an HTML file and Firefox will pick the correct glyphs. --- bedstead.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/bedstead.c b/bedstead.c index 32623ca..f6e134e 100644 --- a/bedstead.c +++ b/bedstead.c @@ -231,9 +231,9 @@ static struct glyph { #define U_HASVS 0x00200000 /* Is there a variation selector? */ #define U_VSMASK 0x0F000000 /* Bottom 4 bits of VS code point. */ #define U_VSSHIFT 24 -#define VS(uvs) ((((long)uvs << U_VSSHIFT) & U_VSMASK) | U_HASVS) +#define VS(uvs) ((((unsigned long)uvs << U_VSSHIFT) & U_VSMASK) | U_HASVS) #define GET_UV(u) (u & U_UVMASK) -#define GET_UVS(u) ((u & U_VSMASK) >> U_VSSHIFT) +#define GET_UVS(u) ((u & U_VSMASK) >> U_VSSHIFT | 0xfe00) #define NU 0xFFFFFFFF /* No Unicode code point. Must be > all valid values. */ char const *name; uint_least16_t flags; @@ -3845,6 +3845,15 @@ main(int argc, char **argv) docmap(0, 4, 12); /* Unicode 2.0+, full repertoire */ docmap(3, 1, 4); /* Windows Unicode, BMP only */ docmap(3, 10, 12); /* Windows Unicode, full repertoire */ + /* Variation sequences. */ + printf("\n"); + for (i = 0; i < lenof(glyphs); i++) { + unsigned long u = glyphs[i].unicode; + if (u != NU && (u & U_HASVS)) + printf("\n", + GET_UV(u), GET_UVS(u), glyphs[i].name); + } + printf("\n"); printf("\n"); dogpos(); /* Must be before 'CFF ' because it uses glyph bitmaps. */ -- 2.30.2