From 7532e3ad70441041395c77d12424edd31cf63a42 Mon Sep 17 00:00:00 2001 From: philg314 Date: Thu, 11 Aug 2022 11:42:22 +0000 Subject: Fix `cmap` Subtable Format 4 `entrySelector` https://docs.microsoft.com/en-us/typography/opentype/spec/cmap defines `entrySelector` as "Log2 of the maximum power of 2 less than or equal to numTables (log2(searchRange/2), which is equal to floor(log2(segCount)))" Part-of: --- write.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/write.c b/write.c index 223a431..b1397ff 100644 --- a/write.c +++ b/write.c @@ -875,7 +875,7 @@ writecmap(FILE* out, FontPtr font) /* How baroque can you get? */ writeUSHORT(out, segcount * 2); /* segCountX2 */ writeUSHORT(out, 2 * two_log2_floor(segcount)); /* searchRange */ - writeUSHORT(out, 1 + log2_floor(segcount)); /* entrySelector */ + writeUSHORT(out, log2_floor(segcount)); /* entrySelector */ writeUSHORT(out, 2 * (segcount - two_log2_floor(segcount))); /* rangeShift */ -- cgit v1.2.3