Avoid OOM during prewarm by loading only ligature data, not kern pairs

This is particularly important when using SD fonts with many kern pairs
This commit is contained in:
spfenwick
2026-05-02 15:54:40 +12:00
parent 376350c61d
commit 913b7e5f8b
2 changed files with 42 additions and 26 deletions
+3 -2
View File
@@ -118,7 +118,8 @@ class SdCardFont {
EpdKernClassEntry* kernLeftClasses = nullptr;
EpdKernClassEntry* kernRightClasses = nullptr;
EpdLigaturePair* ligaturePairs = nullptr;
bool kernLigLoaded = false;
bool ligLoaded = false; ///< ligaturePairs resident
bool kernClassesLoaded = false; ///< kernLeft/RightClasses resident (skipped during metadata-only prewarm)
// Stub EpdFontData returned when not prewarmed
EpdFontData stubData{};
@@ -204,7 +205,7 @@ class SdCardFont {
void freeStyleAll(PerStyle& s);
void freeStyleKernLigatureData(PerStyle& s);
void freeStyleMiniKern(PerStyle& s);
bool loadStyleKernLigatureData(PerStyle& s);
bool loadStyleKernLigatureData(PerStyle& s, bool ligatureOnly = false);
bool buildMiniKernMatrix(PerStyle& s, const uint32_t* codepoints, uint32_t cpCount);
void applyKernLigaturePointers(const PerStyle& s, EpdFontData& data) const;
void applyGlyphMissCallback(uint8_t styleIdx);