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:
@@ -471,6 +471,7 @@ void GfxRenderer::drawText(const int fontId, const int x, const int y, const cha
|
||||
namespace {
|
||||
const char* resolveVisualText(const char* text, std::string& visualBuffer, const BidiUtils::BidiBaseDir baseDir) {
|
||||
if (!text || *text == '\0') return text;
|
||||
if (baseDir == BidiUtils::BidiBaseDir::NONE) return text; // caller supplies visual order
|
||||
|
||||
if (baseDir != BidiUtils::BidiBaseDir::RTL) {
|
||||
// Byte-level scan: skip BiDi when no RTL script lead bytes are present.
|
||||
|
||||
@@ -8,7 +8,10 @@ namespace BidiUtils {
|
||||
// AUTO: scan text for first strong directional character (P2/P3 rules)
|
||||
// LTR: force left-to-right paragraph embedding level
|
||||
// RTL: force right-to-left paragraph embedding level
|
||||
enum class BidiBaseDir : signed char { AUTO = -1, LTR = 0, RTL = 1 };
|
||||
// NONE: text is already in visual order (e.g. FreeInkBook page runs, which
|
||||
// bake UAX#9 reordering and Arabic shaping in at layout time) — draw
|
||||
// byte-for-byte, never reorder
|
||||
enum class BidiBaseDir : signed char { NONE = -2, AUTO = -1, LTR = 0, RTL = 1 };
|
||||
} // namespace BidiUtils
|
||||
|
||||
class FontCacheManager;
|
||||
|
||||
Reference in New Issue
Block a user