feat: Support for Korean line breaks and glyph spacing (#2288)

Co-authored-by: Uri Tauber <uritaube@gmail.com>
This commit is contained in:
Justin Mitchell
2026-06-17 17:27:03 +03:00
committed by GitHub
co-authored by Uri Tauber
parent d4069aeae5
commit 22f3575064
16 changed files with 443 additions and 121 deletions
+6 -4
View File
@@ -5,12 +5,16 @@
#include "CrossPointSettings.h"
namespace {
static uint8_t fontSizeEnumFromSettings() {
uint8_t e = SETTINGS.fontSize;
if (e >= CrossPointSettings::FONT_SIZE_COUNT) e = 1; // default to MEDIUM
return e;
}
} // namespace
void SdCardFontSystem::begin(GfxRenderer& renderer) {
registry_.discover();
@@ -74,10 +78,8 @@ void SdCardFontSystem::ensureLoaded(GfxRenderer& renderer) {
SETTINGS.sdFontFamilyName[0] = '\0';
return;
}
auto sizes = family->availableSizes();
uint8_t idx = sizeEnum;
if (idx >= sizes.size()) idx = sizes.size() - 1;
uint8_t wantedPt = sizes.empty() ? 0 : sizes[idx];
const auto* selected = family->findClosestReaderSize(sizeEnum);
const uint8_t wantedPt = selected ? selected->pointSize : 0;
if (!registryWasDirty && wantedPt == manager_.currentPointSize()) return;
LOG_DBG("SDFS", "Reloading %s: size %u -> %u (enum %u)%s", wantedFamily, manager_.currentPointSize(), wantedPt,
sizeEnum, registryWasDirty ? " [registry dirty]" : "");
+1
View File
@@ -1,5 +1,6 @@
#include "ActivityManager.h"
#include <FontCacheManager.h>
#include <HalPowerManager.h>
#include <algorithm>
+16 -3
View File
@@ -2,6 +2,7 @@
#include <FsHelpers.h>
#include <HalStorage.h>
#include <Memory.h>
#include "CrossPointSettings.h"
#include "Epub.h"
@@ -29,7 +30,11 @@ std::unique_ptr<Epub> ReaderActivity::loadEpub(const std::string& path) {
return nullptr;
}
auto epub = std::unique_ptr<Epub>(new Epub(path, "/.crosspoint"));
auto epub = makeUniqueNoThrow<Epub>(path, "/.crosspoint");
if (!epub) {
LOG_ERR("READER", "Failed to allocate EPUB object");
return nullptr;
}
if (epub->load(true, SETTINGS.embeddedStyle == 0)) {
return epub;
}
@@ -44,7 +49,11 @@ std::unique_ptr<Xtc> ReaderActivity::loadXtc(const std::string& path) {
return nullptr;
}
auto xtc = std::unique_ptr<Xtc>(new Xtc(path, "/.crosspoint"));
auto xtc = makeUniqueNoThrow<Xtc>(path, "/.crosspoint");
if (!xtc) {
LOG_ERR("READER", "Failed to allocate XTC object");
return nullptr;
}
if (xtc->load()) {
return xtc;
}
@@ -59,7 +68,11 @@ std::unique_ptr<Txt> ReaderActivity::loadTxt(const std::string& path) {
return nullptr;
}
auto txt = std::unique_ptr<Txt>(new Txt(path, "/.crosspoint"));
auto txt = makeUniqueNoThrow<Txt>(path, "/.crosspoint");
if (!txt) {
LOG_ERR("READER", "Failed to allocate TXT object");
return nullptr;
}
if (txt->load()) {
return txt;
}