bump base: crengine, freetype, libjpeg-turbo (#3928)

Includes:
- [build] FreeType: bump to 2.9.1
- [build] bump libjpeg-turbo to 1.5.3
- bump crengine:
 - Fix CSS selector specificity computation
 - [fix] crengine/src/lvfntman.cpp: improve letter_spacing limit
 - [fix] crengine/src/lvxml.cpp: add all empty HTML elements
 - html head styles: fix styles not being applied
 - Hyphenation: increase MAX_PATTERN_SIZE from 16 to 35
 - html documents: proper handling of <BR> tags
 - Allows requesting old (broken) XML/DOM building code
- cre.cpp: setStyleSheet(): accept filepath and/or css text,
  and added getIntProperty() and getStringProperty()

credocument/readerrolling: request older XML/DOM building code
for books previously opened, to not lose bookmarks and highlights

(unit tests update because of new handling of consecutive BR via css
pushed links down in the book)
pull/3930/head
poire-z 6 years ago committed by GitHub
parent 4bf4578d17
commit 8b2253b3e9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1 +1 @@
Subproject commit c657f0df43fb0e448da743027310280c4261cf1f
Subproject commit 86d8495a39a697da9d014521108e28805b5f84fb

@ -108,6 +108,28 @@ function ReaderRolling:init()
end
function ReaderRolling:onReadSettings(config)
-- 20180503: some fix in crengine has changed the way the DOM is built
-- for HTML documents and may make XPATHs obtained from previous version
-- invalid.
-- We may request the previous (buggy) behaviour though, which we do
-- if we use a DocSetting previously made that may contain bookmarks
-- and highlights with old XPATHs.
-- (EPUB will use the same correct DOM code no matter what DOM version
-- we request here.)
if not config:readSetting("cre_dom_version") then
-- Not previously set, guess which DOM version to use
if config:readSetting("last_xpointer") then
-- We have a last_xpointer: this book was previously opened
-- with possibly a very old version: request the oldest
config:saveSetting("cre_dom_version", self.ui.document:getOldestDomVersion())
else
-- No previous xpointer: book never opened (or sidecar file
-- purged): we can use the latest DOM version
config:saveSetting("cre_dom_version", self.ui.document:getLatestDomVersion())
end
end
self.ui.document:requestDomVersion(config:readSetting("cre_dom_version"))
local last_xp = config:readSetting("last_xpointer")
local last_per = config:readSetting("last_percent")
if last_xp then

@ -20,6 +20,7 @@ local CreDocument = Document:new{
_document = false,
_loaded = false,
_cre_dom_version = nil,
line_space_percent = 100,
default_font = G_reader_settings:readSetting("cre_font") or "Noto Serif",
@ -120,6 +121,9 @@ function CreDocument:init()
error(self._document) -- will contain error message
end
-- get DOM engine latest version
self._cre_dom_version = self._document:getIntProperty("crengine.dom.version")
-- adjust font sizes according to screen dpi
self._document:adjustFontSizes(Screen:getDPI())
@ -137,6 +141,18 @@ function CreDocument:init()
self.info.configurable = true
end
function CreDocument:getLatestDomVersion()
return self._cre_dom_version
end
function CreDocument:getOldestDomVersion()
return 20171225 -- arbitrary day in the past
end
function CreDocument:requestDomVersion(version)
self._document:setIntProperty("crengine.dom.version", version)
end
function CreDocument:loadDocument(full_document)
if not self._loaded then
local only_metadata = full_document == false

@ -16,9 +16,9 @@ describe("ReaderLink module", function()
local readerui = ReaderUI:new{
document = DocumentRegistry:openDocument(sample_epub),
}
readerui.rolling:onGotoPage(4)
readerui.link:onTap(nil, {pos = {x = 336, y = 668}})
assert.is.same(36, readerui.rolling.current_page)
readerui.rolling:onGotoPage(6)
readerui.link:onTap(nil, {pos = {x = 336, y = 166}})
assert.is.same(40, readerui.rolling.current_page)
end)
it("should jump to links in pdf page mode", function()
@ -53,11 +53,11 @@ describe("ReaderLink module", function()
local readerui = ReaderUI:new{
document = DocumentRegistry:openDocument(sample_epub),
}
readerui.rolling:onGotoPage(4)
readerui.link:onTap(nil, {pos = {x = 336, y = 668}})
assert.is.same(36, readerui.rolling.current_page)
readerui.rolling:onGotoPage(6)
readerui.link:onTap(nil, {pos = {x = 336, y = 166}})
assert.is.same(40, readerui.rolling.current_page)
readerui.link:onGoBackLink()
assert.is.same(4, readerui.rolling.current_page)
assert.is.same(6, readerui.rolling.current_page)
end)
it("should be able to go back after link jump in pdf page mode", function()

Loading…
Cancel
Save