Reference pages: add synthetic pagemap (#14405)

Discussed in and closes #9020.
This commit is contained in:
hius07 authored and GitHub committed 2025-10-14 21:35:58 +02:00
1 parent 6d49c261fa
commit d5a54f6c16
5 files changed
+310 -116

No files matched your search

+23 -1
View File
@@ -1491,13 +1491,34 @@ function CreDocument:buildAlternativeToc()
end
function CreDocument:buildSyntheticPageMapIfNoneDocumentProvided(chars_per_synthetic_page)
self._document:buildSyntheticPageMapIfNoneDocumentProvided(chars_per_synthetic_page or 1024)
-- for backward compatibility with legacy user patches
-- https://github.com/koreader/koreader/issues/9020#issuecomment-2033259217
if not self._document:hasPageMapDocumentProvided() then
self._document:buildSyntheticPageMap(chars_per_synthetic_page or 1024)
end
end
function CreDocument:buildSyntheticPageMap(chars_per_synthetic_page)
self._document:buildSyntheticPageMap(chars_per_synthetic_page or 1024)
end
function CreDocument:getSyntheticPageMapCharsPerPage()
-- returns 0 if no synthetic pagemap
return self._document:getSyntheticPageMapCharsPerPage()
end
function CreDocument:isPageMapSynthetic()
return self._document:isPageMapSynthetic()
end
function CreDocument:hasPageMapDocumentProvided()
return self._document:hasPageMapDocumentProvided()
end
function CreDocument:isPageMapDocumentProvided()
return self._document:isPageMapDocumentProvided()
end
function CreDocument:hasPageMap()
return self._document:hasPageMap()
end
@@ -1811,6 +1832,7 @@ function CreDocument:setupCallCache()
elseif name == "zoomFont" then add_reset = true -- not used by koreader
elseif name == "resetCallCache" then add_reset = true
elseif name == "cacheFlows" then add_reset = true
elseif name == "buildSyntheticPageMap" then add_reset = true
-- These may have crengine do native highlight or unhighlight
-- (we could keep the original buffer and use a scratch buffer while