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 notosans_18_regularBitmaps[98532] = {
static const uint8_t notosans_18_regularBitmaps[98839] = {
0x2F, 0xC3, 0xFC, 0x3F, 0xC3, 0xFC, 0x3F, 0xC2, 0xFC, 0x2F, 0x82, 0xF8, 0x2F, 0x82, 0xF8, 0x1F,
0x81, 0xF4, 0x1F, 0x41, 0xF4, 0x1F, 0x40, 0xF4, 0x0F, 0x40, 0xF0, 0x0F, 0x00, 0x50, 0x00, 0x00,
0x00, 0x05, 0x03, 0xFC, 0x7F, 0xD3, 0xFD, 0x3F, 0xC0, 0x50, 0x7F, 0x02, 0xF9, 0xFC, 0x0B, 0xF7,
@@ -6166,7 +6166,26 @@ static const uint8_t notosans_18_regularBitmaps[98532] = {
0xBC, 0x00, 0xFF, 0xFF, 0xFC, 0x00, 0x1F, 0xFF, 0xF8, 0x00, 0x00, 0x55, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x3F, 0xFF, 0xFF, 0xFD, 0x3F, 0xFF, 0xFF, 0xFD, 0x2A, 0xAA, 0xAA,
0xA8, 0x2A, 0xAA, 0xAA, 0xAA, 0xA4, 0xFF, 0xFF, 0xFF, 0xFF, 0xE3, 0xFF, 0xFF, 0xFF, 0xFF, 0x80,
0x00, 0x00, 0x00, 0x00,
0x00,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xFF, 0x00, 0x02, 0xFF, 0xFF, 0xF0,
0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0x02, 0xFF, 0xFF, 0xEA, 0xBF, 0xFF, 0xFF, 0x00, 0x00, 0x02, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x02, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00,
0x02, 0xFF, 0xF4, 0x0F, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x02, 0xFF, 0x80, 0x1F, 0xFF, 0x00, 0x00,
0x00, 0x00, 0x02, 0xFE, 0x00, 0x7F, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x02, 0xFC, 0x02, 0xFF, 0x00,
0x00, 0x00, 0x00, 0x00, 0x02, 0xF9, 0x6F, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xFF, 0xFF,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00,
};
static const EpdGlyph notosans_18_regularGlyphs[] = {
@@ -7004,6 +7023,7 @@ static const EpdGlyph notosans_18_regularGlyphs[] = {
{ 18, 35, 21, 3, 31, 158, 98247 }, // ₿
{ 16, 27, 18, 1, 21, 108, 98405 }, // ⃀
{ 19, 4, 21, 1, 15, 19, 98513 }, //
{ 35, 35, 38, 1, 29, 307, 98532 }, // <20>
};
static const EpdUnicodeInterval notosans_18_regularIntervals[] = {
@@ -7018,13 +7038,14 @@ static const EpdUnicodeInterval notosans_18_regularIntervals[] = {
{ 0x2066, 0x206F, 0x316 },
{ 0x20A0, 0x20C0, 0x320 },
{ 0x2212, 0x2212, 0x341 },
{ 0xFFFD, 0xFFFD, 0x342 },
};
static const EpdFontData notosans_18_regular = {
notosans_18_regularBitmaps,
notosans_18_regularGlyphs,
notosans_18_regularIntervals,
11,
12,
51,
41,
-11,