[RTL UI] use auto or LTR text direction in some specific cases

Allow TextBoxWidget new text direction/lang parameters to be
set on upper widgets, and propagate them all the way to it
(ScrollTextWidget, InputText, InputDialog, TextViewer).

Use specific non-default ones in some specific cases:
- Force LTR text direction when showing HTML and CSS, and
  configuration files (in some plugins).
- Use Wikipedia server language and text direction when
  showing an article.
- Use auto with Dictionary results, as we don't know the
  dictionary language, and they may contain mixed content.
- Force LTR when showing some paths (still needs more of them)

TextEditor plugin: add 2 new options "Auto paragraph direction"
and "Force paragraph direction LTR".

Footnotes popup: grab HTML direction, and forward it
to MuPDF for proper display.
This commit is contained in:
poire-z
2019-12-06 22:55:35 +01:00
parent 866c9571df
commit d6d49a64a7
17 changed files with 142 additions and 8 deletions

View File

@@ -1062,12 +1062,13 @@ function ReaderLink:showAsFootnotePopup(link, neglect_current_location)
-- then just ignore the whole stylesheet, including our own declarations
-- we add at start)
--
-- flags = 0x0000 to get the simplest/purest HTML without CSS
-- flags = 0x0001 to get the simplest/purest HTML without CSS, and dir=
-- and lang= attributes grabbed from parent nodes
local html
if extStartXP and extEndXP then
html = self.ui.document:getHTMLFromXPointers(extStartXP, extEndXP, 0x0000)
html = self.ui.document:getHTMLFromXPointers(extStartXP, extEndXP, 0x0001)
else
html = self.ui.document:getHTMLFromXPointer(target_xpointer, 0x0000, true)
html = self.ui.document:getHTMLFromXPointer(target_xpointer, 0x0001, true)
-- from_final_parent = true to get a possibly more complete footnote
end
if not html then