Recover parts of the regression fiasco

Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
jpirnay
2026-05-02 18:19:23 +02:00
co-authored by Copilot
parent a5469c0bb9
commit 06dfc6c50b
21 changed files with 354 additions and 303 deletions
+6 -30
View File
@@ -18,14 +18,12 @@ static_assert(BOOKERLY_12_FONT_ID != 0, "Font ID collision with sentinel");
static_assert(BOOKERLY_14_FONT_ID != 0, "Font ID collision with sentinel");
static_assert(BOOKERLY_16_FONT_ID != 0, "Font ID collision with sentinel");
static_assert(BOOKERLY_18_FONT_ID != 0, "Font ID collision with sentinel");
static_assert(BOOKERLY_10_FONT_ID != 0, "Font ID collision with sentinel");
static_assert(NOTOSANS_12_FONT_ID != 0, "Font ID collision with sentinel");
static_assert(NOTOSANS_14_FONT_ID != 0, "Font ID collision with sentinel");
static_assert(NOTOSANS_16_FONT_ID != 0, "Font ID collision with sentinel");
static_assert(NOTOSANS_18_FONT_ID != 0, "Font ID collision with sentinel");
static_assert(OPENDYSLEXIC_8_FONT_ID != 0, "Font ID collision with sentinel");
static_assert(OPENDYSLEXIC_10_FONT_ID != 0, "Font ID collision with sentinel");
static_assert(OPENDYSLEXIC_12_FONT_ID != 0, "Font ID collision with sentinel");
static_assert(OPENDYSLEXIC_14_FONT_ID != 0, "Font ID collision with sentinel");
static_assert(NOTOSANS_10_FONT_ID != 0, "Font ID collision with sentinel");
static_assert(UI_10_FONT_ID != 0, "Font ID collision with sentinel");
static_assert(UI_12_FONT_ID != 0, "Font ID collision with sentinel");
static_assert(SMALL_FONT_ID != 0, "Font ID collision with sentinel");
@@ -265,9 +263,7 @@ bool CrossPointSettings::loadFromBinaryFile() {
float CrossPointSettings::getReaderLineCompression() const {
const int effectiveFontId = getReaderFontId();
const int bookerlyId = getBuiltinReaderFontId(BOOKERLY, fontSize);
const int notosansId = getBuiltinReaderFontId(NOTOSANS, fontSize);
const int opendyslexicId = getBuiltinReaderFontId(OPENDYSLEXIC, fontSize);
if (effectiveFontId == notosansId) {
switch (lineSpacing) {
@@ -281,18 +277,6 @@ float CrossPointSettings::getReaderLineCompression() const {
}
}
if (effectiveFontId == opendyslexicId) {
switch (lineSpacing) {
case TIGHT:
return 0.90f;
case NORMAL:
default:
return 0.95f;
case WIDE:
return 1.0f;
}
}
// Bookerly or any SD card font: use the Bookerly-style neutral values.
switch (lineSpacing) {
case TIGHT:
@@ -342,6 +326,8 @@ int CrossPointSettings::getBuiltinReaderFontId(uint8_t family, uint8_t size) {
case BOOKERLY:
default:
switch (size) {
case TINY:
return BOOKERLY_10_FONT_ID;
case SMALL:
return BOOKERLY_12_FONT_ID;
case MEDIUM:
@@ -354,6 +340,8 @@ int CrossPointSettings::getBuiltinReaderFontId(uint8_t family, uint8_t size) {
}
case NOTOSANS:
switch (size) {
case TINY:
return NOTOSANS_10_FONT_ID;
case SMALL:
return NOTOSANS_12_FONT_ID;
case MEDIUM:
@@ -364,18 +352,6 @@ int CrossPointSettings::getBuiltinReaderFontId(uint8_t family, uint8_t size) {
case EXTRA_LARGE:
return NOTOSANS_18_FONT_ID;
}
case OPENDYSLEXIC:
switch (size) {
case SMALL:
return OPENDYSLEXIC_8_FONT_ID;
case MEDIUM:
default:
return OPENDYSLEXIC_10_FONT_ID;
case LARGE:
return OPENDYSLEXIC_12_FONT_ID;
case EXTRA_LARGE:
return OPENDYSLEXIC_14_FONT_ID;
}
}
}