Style menu cleanup (#3996)

Use epub.css as the main default style, with all file formats
except FB2 (which needs fb2.css).
(epub.css has been cleaned recently to be more conforming to HTML
specs and to not include class name based styles - with conditional
compatiblity styles for previously opened documents. It should be
usable on all HTML based documents, except FB2 which has some
incompatible specs.)

Consider all shipped css files other than "epub.css" and "fb2.css"
obsolete, and put them in a sub-menu (these other css files have
not been updated in the same way, and are kept as-is for when a
previously opened document requests one of them).

Add an icon indicating which style is set as default (like it's
been done for the Font and Style tweaks menus).

Also set the font size of the full status bar (available with
cre documents) when the setting "cre_header_status_font_size"
is present in settings.reader.lua (to add manually).
This commit is contained in:
poire-z
2018-06-06 13:18:29 +02:00
committed by GitHub
parent 14e77306b7
commit 9a0728e421
3 changed files with 113 additions and 52 deletions

View File

@@ -101,15 +101,18 @@ function CreDocument:init()
-- and return extention of the 1st file
file_type = self:zipContentExt(self.file) or "unknown"
end
-- these two format use the same css file
if file_type == "html" then
file_type = "htm"
-- June 2018: epub.css has been cleaned to be more conforming to HTML specs
-- and to not include class name based styles (with conditional compatiblity
-- styles for previously opened documents). It should be usable on all
-- HTML based documents, except FB2 which has some incompatible specs.
-- The other css files (htm.css, rtf.css...) have not been updated in the
-- same way, and are kept as-is for when a previously opened document
-- requests one of them.
self.default_css = "./data/epub.css"
if file_type == "fb2" then
self.default_css = "./data/fb2.css"
end
-- if native css-file doesn't exist, one needs to use default cr3.css
if not io.open("./data/"..file_type..".css") then
file_type = "cr3"
end
self.default_css = "./data/"..file_type..".css"
-- @TODO check the default view_mode to a global user configurable
-- variable 22.12 2012 (houqp)
@@ -124,6 +127,11 @@ function CreDocument:init()
-- adjust font sizes according to screen dpi
self._document:adjustFontSizes(Screen:getDPI())
if G_reader_settings:readSetting("cre_header_status_font_size") then
self._document:setIntProperty("crengine.page.header.font.size",
G_reader_settings:readSetting("cre_header_status_font_size"))
end
-- set fallback font face
self._document:setStringProperty("crengine.font.fallback.face",
G_reader_settings:readSetting("fallback_font") or self.fallback_font)