bump crengine and others, adds HTML extended debug view (#5219)

Bump crengine: background image and other fixes:
- View HTML: option to show text unicode codepoints
- Fix attribute parsing: decode &-encoded chars
- Text: allow wrap after more unicode spaces and hyphen
- Fix: no left hanging when hanging punctuation disabled
- lvtextfm.cpp: more comments, some formatting cleanup
- Optimize background image drawing
- CSS: fix background-image file path resolution

Bump luasec to 0.8.1
Bump harfbuzz to 2.6.0

cre.cpp:
Adds setBackgroundImage() proxy function to crengine
facility to set background textures (this is unrelated
to the background-image CSS fixes).
No frontend code (yet) to select such an image.

View HTML: adds a 3rd view (extended debug view), showing the
unicode codepoint of each char and crengine rendereing methods.
pull/5223/head
poire-z 5 years ago committed by GitHub
parent 5da3312869
commit d25d449a26
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1 +1 @@
Subproject commit 6085f3711bd5a42c2f75f65716bcd88ecc6079ef
Subproject commit 680e67ff5c3f7fc08e4d4c09f6e1580018d46e86

@ -632,17 +632,22 @@ function ReaderHighlight:viewSelectionHTML(debug_view)
if self.selected_text and self.selected_text.pos0 and self.selected_text.pos1 then
-- For available flags, see the "#define WRITENODEEX_*" in crengine/src/lvtinydom.cpp
local html_flags = 0x3030 -- valid and classic displayed HTML, with only block nodes indented
if debug_view then
if not debug_view then
debug_view = 0
end
if debug_view == 1 then
-- Each node on a line, with markers and numbers of skipped chars and siblings shown,
-- with possibly invalid HTML (text nodes not escaped)
html_flags = 0x3353
-- html_flags = 0x3753 -- use this to additionally see rendering methods
elseif debug_view == 2 then
-- Additionally see rendering methods and unicode codepoint of each char
html_flags = 0x3757
end
local html, css_files = self.ui.document:getHTMLFromXPointers(self.selected_text.pos0,
self.selected_text.pos1, html_flags, true)
if html then
-- Make some invisible chars visible
if debug_view then
if debug_view >= 1 then
html = html:gsub("\xC2\xA0", "") -- no break space: open box
html = html:gsub("\xC2\xAD", "") -- soft hyphen: dot operator (smaller than middle dot ·)
-- Prettify inlined CSS (from <HEAD>, put in an internal
@ -700,11 +705,21 @@ function ReaderHighlight:viewSelectionHTML(debug_view)
table.insert(buttons_table, {button})
end
end
local next_debug_text
local next_debug_view = debug_view + 1
if next_debug_view == 1 then
next_debug_text = _("Switch to debug view")
elseif next_debug_view == 2 then
next_debug_text = _("Switch to extended debug view")
else
next_debug_view = 0
next_debug_text = _("Switch to standard view")
end
table.insert(buttons_table, {{
text = debug_view and _("Switch to standard view") or _("Switch to debug view"),
text = next_debug_text,
callback = function()
UIManager:close(textviewer)
self:viewSelectionHTML(not debug_view)
self:viewSelectionHTML(next_debug_view)
end,
}})
table.insert(buttons_table, {{

@ -782,6 +782,11 @@ function CreDocument:setStatusLineProp(prop)
self._document:setStringProperty("window.status.line", prop)
end
function CreDocument:setBackgroundImage(img_path) -- use nil to unset
logger.dbg("CreDocument: set background image", img_path)
self._document:setBackgroundImage(img_path)
end
function CreDocument:findText(pattern, origin, reverse, caseInsensitive)
logger.dbg("CreDocument: find text", pattern, origin, reverse, caseInsensitive)
return self._document:findText(

Loading…
Cancel
Save