fix: render U+FFFD replacement character instead of ? (#366)

The current behavior of rendering `?` for an unknown Unicode character
can be hard to distinguish from a typo. Use the standard Unicode
"replacement character" instead, that's what it's designed for:

https://en.wikipedia.org/wiki/Specials_(Unicode_block)

I'm making this PR as a draft because I'm not sure I did everything that
was needed to change the character set covered by the fonts. Running
that script is in its own commit. If this is proper, I'll rebase/squash
into one commit and un-draft.

Co-authored-by: Maeve Andrews <maeve@git.mail.maeveandrews.com>
This commit is contained in:
Maeve Andrews
2026-01-19 05:58:43 -06:00
committed by GitHub
parent 7a792a5384
commit 5fef99c641
37 changed files with 620 additions and 100 deletions

View File

@@ -7,7 +7,7 @@
#pragma once
#include "EpdFontData.h"
static const uint8_t bookerly_16_italicBitmaps[82412] = {
static const uint8_t bookerly_16_italicBitmaps[82660] = {
0x00, 0x01, 0x40, 0x00, 0xFC, 0x00, 0x3F, 0x80, 0x03, 0xF0, 0x00, 0x7F, 0x00, 0x0B, 0xE0, 0x00,
0xFC, 0x00, 0x0F, 0xC0, 0x00, 0xF8, 0x00, 0x1F, 0x40, 0x02, 0xF0, 0x00, 0x2F, 0x00, 0x03, 0xE0,
0x00, 0x3D, 0x00, 0x03, 0xC0, 0x00, 0x7C, 0x00, 0x07, 0x80, 0x00, 0x74, 0x00, 0x0A, 0x00, 0x00,
@@ -5158,7 +5158,23 @@ static const uint8_t bookerly_16_italicBitmaps[82412] = {
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xC0, 0x00, 0x01, 0xFC, 0x3F, 0xE3, 0xFE,
0x2F, 0xC0, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xBD, 0x00, 0x03, 0xF0, 0x00, 0x0B,
0xDB, 0xFC, 0x00, 0x2F, 0xF0, 0x00, 0xBF, 0xFF, 0xF0, 0x00, 0xFF, 0xC0, 0x03, 0xFF, 0x7F, 0x40,
0x01, 0xFD, 0x00, 0x07, 0xF4, 0x10, 0x00, 0x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0x00, 0x00, 0x7F, 0xFE, 0x7F, 0xFF, 0xF4, 0x00, 0x00, 0x00,
0x7F, 0xFF, 0xFF, 0xFF, 0x40, 0x00, 0x00, 0x00, 0x7F, 0xF4, 0x7F, 0xF4, 0x00, 0x00, 0x00, 0x00,
0x7F, 0x80, 0xFF, 0x40, 0x00, 0x00, 0x00, 0x00, 0x7E, 0x03, 0xF4, 0x00, 0x00, 0x00, 0x00, 0x00,
0x7D, 0x2F, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7F, 0xF4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x7F, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x74, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
};
static const EpdGlyph bookerly_16_italicGlyphs[] = {
@@ -5890,6 +5906,7 @@ static const EpdGlyph bookerly_16_italicGlyphs[] = {
{ 19, 23, 33, 7, 23, 110, 82252 }, // ⊥
{ 6, 6, 21, 7, 12, 9, 82362 }, // ⋅
{ 27, 6, 33, 3, 12, 41, 82371 }, // ⋯
{ 31, 32, 33, 1, 28, 248, 82412 }, // <20>
};
static const EpdUnicodeInterval bookerly_16_italicIntervals[] = {
@@ -5953,13 +5970,14 @@ static const EpdUnicodeInterval bookerly_16_italicIntervals[] = {
{ 0x22A5, 0x22A5, 0x2D5 },
{ 0x22C5, 0x22C5, 0x2D6 },
{ 0x22EF, 0x22EF, 0x2D7 },
{ 0xFFFD, 0xFFFD, 0x2D8 },
};
static const EpdFontData bookerly_16_italic = {
bookerly_16_italicBitmaps,
bookerly_16_italicGlyphs,
bookerly_16_italicIntervals,
60,
61,
44,
36,
-9,