Add character-offset bookmarks for FreeInkBook

Implements layout-independent bookmarks using character offsets within chapters instead of percentage-based positions. This allows bookmarks to restore to the exact position regardless of font size or orientation changes. Adds TOC navigation helpers, book progress calculation based on spine item sizes, and a NONE BidiBaseDir option for pre-reordered text. Legacy bookmarks without character offsets fall back to percentage-based positioning.
This commit is contained in:
Justin Mitchell
2026-07-08 00:56:53 -04:00
parent 0848649ce2
commit 3421171670
24 changed files with 1090 additions and 1624 deletions
+2 -7
View File
@@ -4,25 +4,20 @@
#include "activities/Activity.h"
#include "activities/home/FileBrowserActivity.h"
class Epub;
class Xtc;
class Txt;
class ReaderActivity final : public Activity {
std::string initialBookPath;
std::string currentBookPath; // Track current book path for navigation
// Non-static (unlike the other loaders): draws the first-open indexing popup, which needs the renderer.
std::unique_ptr<Epub> loadEpub(const std::string& path);
static std::unique_ptr<Xtc> loadXtc(const std::string& path);
static std::unique_ptr<Txt> loadTxt(const std::string& path);
static bool isXtcFile(const std::string& path);
static bool isTxtFile(const std::string& path);
static bool isBmpFile(const std::string& path);
void goToLibrary(const std::string& fromBookPath = "");
void onGoToEpubReader(std::unique_ptr<Epub> epub);
void onGoToEpubReader(const std::string& path);
void onGoToXtcReader(std::unique_ptr<Xtc> xtc);
void onGoToTxtReader(std::unique_ptr<Txt> txt);
void onGoToTxtReader(const std::string& path);
void onGoToBmpViewer(const std::string& path);
void onGoBack();