Skip to content

Commit b1abee2

Browse files
committed
fix: add guidance for bionic/guide dots during memory pressure
1 parent 0adaa0b commit b1abee2

3 files changed

Lines changed: 18 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
- EPUB layout now honors publisher page-break CSS, avoids stretching justified spaces before closing punctuation, and keeps large CSS rule sets in a smaller disk-backed lookup cache.
2020
- EPUB first-open conversion now uses more compact OPF manifest lookups and streams cover-wrapper parsing to avoid large temporary heap buffers on books with huge manifests.
2121
- EPUB chapters that run out of memory during full CrossInk layout now retry with `Balanced` and then `Light` rendering before showing a low-memory error, and save the first successful fallback for that book.
22+
- EPUB low-memory layout errors now suggest turning off Bionic Reading or Guide Dots when either reading aid is adding memory pressure.
2223
- EPUB next-chapter pre-indexing now uses the same render-mode fallbacks as visible chapter loading when layout runs low on memory.
2324
- EPUB reader font-size changes now restore the current chapter position by content instead of jumping far backward after re-indexing.
2425
- Reading Stats now use the reader's last live book time-left estimate instead of showing a separate fallback estimate.

lib/I18n/translations/english.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -587,6 +587,9 @@ STR_LOW_MEMORY_IMAGES_TITLE: "Chapter loaded without some or all images"
587587
STR_LOW_MEMORY_IMAGES_BODY: "Available memory was too low to extract every image for this chapter."
588588
STR_EPUB_LAYOUT_MEMORY_TITLE: "Chapter needs too much memory"
589589
STR_EPUB_LAYOUT_MEMORY_BODY: "This chapter needs more memory to lay out than this device can safely spare."
590+
STR_EPUB_LAYOUT_MEMORY_READING_AIDS_HINT_BOTH: "Try again with Bionic Reading and Guide Dots off."
591+
STR_EPUB_LAYOUT_MEMORY_READING_AIDS_HINT_BIONIC: "Try again with Bionic Reading off."
592+
STR_EPUB_LAYOUT_MEMORY_READING_AIDS_HINT_GUIDE: "Try again with Guide Dots off."
590593
STR_EPUB_FALLBACK_FONT_TITLE: "Chapter using built-in font"
591594
STR_EPUB_FALLBACK_FONT_BODY: "Available memory was too low to lay out this chapter with the SD-card font, so it was loaded with the built-in font."
592595
STR_SD_FIRMWARE_UPDATE: "SD Card Firmware Update"

src/activities/reader/EpubReaderActivity.cpp

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3333,7 +3333,20 @@ void EpubReaderActivity::render(RenderLock&& lock) {
33333333

33343334
const auto showLowMemoryLayoutError = [this]() {
33353335
snprintf(APP_STATE.pendingAlertTitle, sizeof(APP_STATE.pendingAlertTitle), "%s", tr(STR_EPUB_LAYOUT_MEMORY_TITLE));
3336-
snprintf(APP_STATE.pendingAlertBody, sizeof(APP_STATE.pendingAlertBody), "%s", tr(STR_EPUB_LAYOUT_MEMORY_BODY));
3336+
const char* readingAidHint = nullptr;
3337+
if (SETTINGS.bionicReadingEnabled && SETTINGS.guideReadingEnabled) {
3338+
readingAidHint = tr(STR_EPUB_LAYOUT_MEMORY_READING_AIDS_HINT_BOTH);
3339+
} else if (SETTINGS.bionicReadingEnabled) {
3340+
readingAidHint = tr(STR_EPUB_LAYOUT_MEMORY_READING_AIDS_HINT_BIONIC);
3341+
} else if (SETTINGS.guideReadingEnabled) {
3342+
readingAidHint = tr(STR_EPUB_LAYOUT_MEMORY_READING_AIDS_HINT_GUIDE);
3343+
}
3344+
if (readingAidHint) {
3345+
snprintf(APP_STATE.pendingAlertBody, sizeof(APP_STATE.pendingAlertBody), "%s %s", tr(STR_EPUB_LAYOUT_MEMORY_BODY),
3346+
readingAidHint);
3347+
} else {
3348+
snprintf(APP_STATE.pendingAlertBody, sizeof(APP_STATE.pendingAlertBody), "%s", tr(STR_EPUB_LAYOUT_MEMORY_BODY));
3349+
}
33373350
APP_STATE.pendingAlertGoHomeOnBack.store(true, std::memory_order_relaxed);
33383351
APP_STATE.hasPendingAlert.store(true, std::memory_order_release);
33393352
GUI.drawPopup(renderer, tr(STR_EPUB_LAYOUT_MEMORY_TITLE));

0 commit comments

Comments
 (0)