copt deduplicate: render_dpi, margins, rotation_mode (#10880)

reviewable/pr10890/r1
hius07 9 months ago committed by GitHub
parent 73378cd9d7
commit 7d626456a3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -13,14 +13,11 @@ local ReaderCoptListener = EventListener:extend{}
local CRE_HEADER_DEFAULT_SIZE = 20 local CRE_HEADER_DEFAULT_SIZE = 20
function ReaderCoptListener:onReadSettings(config) function ReaderCoptListener:onReadSettings(config)
local view_mode = config:readSetting("copt_view_mode") local view_mode_name = self.document.configurable.view_mode == 0 and "page" or "scroll"
or G_reader_settings:readSetting("copt_view_mode")
or 0 -- default to "page" mode
local view_mode_name = view_mode == 0 and "page" or "scroll"
-- Let crengine know of the view mode before rendering, as it can -- Let crengine know of the view mode before rendering, as it can
-- cause a rendering change (2-pages would become 1-page in -- cause a rendering change (2-pages would become 1-page in
-- scroll mode). -- scroll mode).
self.ui.document:setViewMode(view_mode_name) self.document:setViewMode(view_mode_name)
-- ReaderView is the holder of the view_mode state -- ReaderView is the holder of the view_mode state
self.view.view_mode = view_mode_name self.view.view_mode = view_mode_name
@ -35,20 +32,19 @@ function ReaderCoptListener:onReadSettings(config)
self.battery_percent = G_reader_settings:readSetting("cre_header_battery_percent", 0) self.battery_percent = G_reader_settings:readSetting("cre_header_battery_percent", 0)
self.chapter_marks = G_reader_settings:readSetting("cre_header_chapter_marks", 1) self.chapter_marks = G_reader_settings:readSetting("cre_header_chapter_marks", 1)
self.ui.document._document:setIntProperty("window.status.title", self.title) self.document._document:setIntProperty("window.status.title", self.title)
self.ui.document._document:setIntProperty("window.status.clock", self.clock) self.document._document:setIntProperty("window.status.clock", self.clock)
self.ui.document._document:setIntProperty("window.status.pos.page.number", self.page_number) self.document._document:setIntProperty("window.status.pos.page.number", self.page_number)
self.ui.document._document:setIntProperty("window.status.pos.page.count", self.page_count) self.document._document:setIntProperty("window.status.pos.page.count", self.page_count)
self.ui.document._document:setIntProperty("crengine.page.header.chapter.marks", self.chapter_marks) self.document._document:setIntProperty("crengine.page.header.chapter.marks", self.chapter_marks)
self.ui.document._document:setIntProperty("window.status.battery", self.battery) self.document._document:setIntProperty("window.status.battery", self.battery)
self.ui.document._document:setIntProperty("window.status.battery.percent", self.battery_percent) self.document._document:setIntProperty("window.status.battery.percent", self.battery_percent)
self.ui.document._document:setIntProperty("window.status.pos.percent", self.reading_percent) self.document._document:setIntProperty("window.status.pos.percent", self.reading_percent)
self:onTimeFormatChanged() self:onTimeFormatChanged()
-- Enable or disable crengine header status line (note that for crengine, 0=header enabled, 1=header disabled) -- Enable or disable crengine header status line (note that for crengine, 0=header enabled, 1=header disabled)
local status_line = config:readSetting("copt_status_line") or G_reader_settings:readSetting("copt_status_line", 1) self.ui:handleEvent(Event:new("SetStatusLine", self.document.configurable.status_line))
self.ui:handleEvent(Event:new("SetStatusLine", status_line))
self.old_battery_level = self.ui.rolling:updateBatteryState() self.old_battery_level = self.ui.rolling:updateBatteryState()
@ -87,7 +83,7 @@ end
ReaderCoptListener.onNotCharging = ReaderCoptListener.onCharging ReaderCoptListener.onNotCharging = ReaderCoptListener.onCharging
function ReaderCoptListener:onTimeFormatChanged() function ReaderCoptListener:onTimeFormatChanged()
self.ui.document._document:setIntProperty("window.status.clock.12hours", G_reader_settings:isTrue("twelve_hour_clock") and 1 or 0) self.document._document:setIntProperty("window.status.clock.12hours", G_reader_settings:isTrue("twelve_hour_clock") and 1 or 0)
end end
function ReaderCoptListener:shouldHeaderBeRepainted() function ReaderCoptListener:shouldHeaderBeRepainted()
@ -107,14 +103,14 @@ end
function ReaderCoptListener:updateHeader() function ReaderCoptListener:updateHeader()
-- Have crengine display accurate time and battery on its next drawing -- Have crengine display accurate time and battery on its next drawing
self.ui.document:resetBufferCache() -- be sure next repaint is a redrawing self.document:resetBufferCache() -- be sure next repaint is a redrawing
-- Force a refresh if we're not hidden behind another widget -- Force a refresh if we're not hidden behind another widget
if self:shouldHeaderBeRepainted() then if self:shouldHeaderBeRepainted() then
UIManager:setDirty(self.view.dialog, "ui", UIManager:setDirty(self.view.dialog, "ui",
Geom:new{ Geom:new{
x = 0, y = 0, x = 0, y = 0,
w = Device.screen:getWidth(), w = Device.screen:getWidth(),
h = self.ui.document:getHeaderHeight(), h = self.document:getHeaderHeight(),
} }
) )
end end
@ -176,7 +172,7 @@ ReaderCoptListener.onCloseDocument = ReaderCoptListener.unscheduleHeaderRefresh
ReaderCoptListener.onSuspend = ReaderCoptListener.unscheduleHeaderRefresh ReaderCoptListener.onSuspend = ReaderCoptListener.unscheduleHeaderRefresh
function ReaderCoptListener:setAndSave(setting, property, value) function ReaderCoptListener:setAndSave(setting, property, value)
self.ui.document._document:setIntProperty(property, value) self.document._document:setIntProperty(property, value)
G_reader_settings:saveSetting(setting, value) G_reader_settings:saveSetting(setting, value)
-- Have crengine redraw it (even if hidden by the menu at this time) -- Have crengine redraw it (even if hidden by the menu at this time)
self.ui.rolling:updateBatteryState() self.ui.rolling:updateBatteryState()

@ -52,41 +52,27 @@ function ReaderTypeset:onReadSettings(config)
or 3 -- default to 'web' mode or 3 -- default to 'web' mode
end end
-- Let ConfigDialog know so it can update it on screen and have it saved on quit -- Let ConfigDialog know so it can update it on screen and have it saved on quit
self.ui.document.configurable.block_rendering_mode = self.block_rendering_mode self.configurable.block_rendering_mode = self.block_rendering_mode
end end
self:setBlockRenderingMode(self.block_rendering_mode) self:setBlockRenderingMode(self.block_rendering_mode)
-- set render DPI -- default to 96 dpi
self.render_dpi = config:readSetting("render_dpi") self.ui.document:setRenderDPI(self.configurable.render_dpi)
or G_reader_settings:readSetting("copt_render_dpi")
or 96
self:setRenderDPI(self.render_dpi)
-- uncomment if we want font size to follow DPI changes -- uncomment if we want font size to follow DPI changes
-- self.ui.document:setRenderScaleFontWithDPI(1) -- self.ui.document:setRenderScaleFontWithDPI(1)
-- set page margins -- set page margins
local h_margins = config:readSetting("copt_h_page_margins") self.unscaled_margins = { self.configurable.h_page_margins[1], self.configurable.t_page_margin,
or G_reader_settings:readSetting("copt_h_page_margins") self.configurable.h_page_margins[2], self.configurable.b_page_margin }
or G_defaults:readSetting("DCREREADER_CONFIG_H_MARGIN_SIZES_MEDIUM")
local t_margin = config:readSetting("copt_t_page_margin")
or G_reader_settings:readSetting("copt_t_page_margin")
or G_defaults:readSetting("DCREREADER_CONFIG_T_MARGIN_SIZES_LARGE")
local b_margin = config:readSetting("copt_b_page_margin")
or G_reader_settings:readSetting("copt_b_page_margin")
or G_defaults:readSetting("DCREREADER_CONFIG_B_MARGIN_SIZES_LARGE")
self.unscaled_margins = { h_margins[1], t_margin, h_margins[2], b_margin }
self:onSetPageMargins(self.unscaled_margins) self:onSetPageMargins(self.unscaled_margins)
self.sync_t_b_page_margins = config:readSetting("copt_sync_t_b_page_margins") self.sync_t_b_page_margins = self.configurable.sync_t_b_page_margins == 1 and true or false
or G_reader_settings:readSetting("copt_sync_t_b_page_margins")
or 0
self.sync_t_b_page_margins = self.sync_t_b_page_margins == 1 and true or false
-- default to disable TXT formatting as it does more harm than good -- default to disable TXT formatting as it does more harm than good (the setting is not in UI)
self.txt_preformatted = config:readSetting("txt_preformatted") self.txt_preformatted = config:readSetting("txt_preformatted")
or G_reader_settings:readSetting("txt_preformatted") or G_reader_settings:readSetting("txt_preformatted")
or 1 or 1
self:toggleTxtPreFormatted(self.txt_preformatted) self.ui.document:setTxtPreFormatted(self.txt_preformatted)
-- default to disable smooth scaling -- default to disable smooth scaling
self.ui.document:setImageScaling(self.configurable.smooth_scaling == 1) self.ui.document:setImageScaling(self.configurable.smooth_scaling == 1)
@ -97,7 +83,6 @@ end
function ReaderTypeset:onSaveSettings() function ReaderTypeset:onSaveSettings()
self.ui.doc_settings:saveSetting("css", self.css) self.ui.doc_settings:saveSetting("css", self.css)
self.ui.doc_settings:saveSetting("render_dpi", self.render_dpi)
end end
function ReaderTypeset:onToggleEmbeddedStyleSheet(toggle) function ReaderTypeset:onToggleEmbeddedStyleSheet(toggle)
@ -149,7 +134,17 @@ end
function ReaderTypeset:onSetBlockRenderingMode(mode) function ReaderTypeset:onSetBlockRenderingMode(mode)
self:setBlockRenderingMode(mode) self:setBlockRenderingMode(mode)
Notification:notify(T( _("Render mode set to: %1"), optionsutil:getOptionText("SetBlockRenderingMode", mode))) local text = T(_("Render mode set to: %1"), optionsutil:getOptionText("SetBlockRenderingMode", mode))
Notification:notify(text)
return true
end
function ReaderTypeset:onSetRenderDPI(dpi)
self.configurable.render_dpi = dpi
self.ui.document:setRenderDPI(dpi)
self.ui:handleEvent(Event:new("UpdatePos"))
local text = T(_("Zoom set to: %1"), optionsutil:getOptionText("SetRenderDPI", dpi))
Notification:notify(text)
return true return true
end end
@ -169,12 +164,6 @@ local OBSOLETED_CSS = {
"txt.css", "txt.css",
} }
function ReaderTypeset:onSetRenderDPI(dpi)
self:setRenderDPI(dpi)
Notification:notify(T( _("Zoom set to: %1"), optionsutil:getOptionText("SetRenderDPI", dpi)))
return true
end
function ReaderTypeset:genStyleSheetMenu() function ReaderTypeset:genStyleSheetMenu()
local getStyleMenuItem = function(text, css_file, separator) local getStyleMenuItem = function(text, css_file, separator)
return { return {
@ -358,17 +347,6 @@ function ReaderTypeset:ensureSanerBlockRenderingFlags(mode)
self:setBlockRenderingMode(self.block_rendering_mode) self:setBlockRenderingMode(self.block_rendering_mode)
end end
function ReaderTypeset:toggleTxtPreFormatted(toggle)
self.ui.document:setTxtPreFormatted(toggle)
self.ui:handleEvent(Event:new("UpdatePos"))
end
function ReaderTypeset:setRenderDPI(dpi)
self.render_dpi = dpi
self.ui.document:setRenderDPI(dpi)
self.ui:handleEvent(Event:new("UpdatePos"))
end
function ReaderTypeset:addToMainMenu(menu_items) function ReaderTypeset:addToMainMenu(menu_items)
-- insert table to main reader menu -- insert table to main reader menu
menu_items.set_render_style = { menu_items.set_render_style = {
@ -379,7 +357,7 @@ end
function ReaderTypeset:makeDefaultStyleSheet(css, text, touchmenu_instance) function ReaderTypeset:makeDefaultStyleSheet(css, text, touchmenu_instance)
UIManager:show(ConfirmBox:new{ UIManager:show(ConfirmBox:new{
text = T( _("Set default style to %1?"), BD.filename(text)), text = T(_("Set default style to %1?"), BD.filename(text)),
ok_callback = function() ok_callback = function()
G_reader_settings:saveSetting("copt_css", css) G_reader_settings:saveSetting("copt_css", css)
if touchmenu_instance then touchmenu_instance:updateItems() end if touchmenu_instance then touchmenu_instance:updateItems() end
@ -397,7 +375,7 @@ function ReaderTypeset:onSetPageTopMargin(t_margin, when_applied_callback)
if self.sync_t_b_page_margins then if self.sync_t_b_page_margins then
self.unscaled_margins[4] = t_margin self.unscaled_margins[4] = t_margin
-- Let ConfigDialog know so it can update it on screen and have it saved on quit -- Let ConfigDialog know so it can update it on screen and have it saved on quit
self.ui.document.configurable.b_page_margin = t_margin self.configurable.b_page_margin = t_margin
end end
self.ui:handleEvent(Event:new("SetPageMargins", self.unscaled_margins, when_applied_callback)) self.ui:handleEvent(Event:new("SetPageMargins", self.unscaled_margins, when_applied_callback))
end end
@ -407,7 +385,7 @@ function ReaderTypeset:onSetPageBottomMargin(b_margin, when_applied_callback)
if self.sync_t_b_page_margins then if self.sync_t_b_page_margins then
self.unscaled_margins[2] = b_margin self.unscaled_margins[2] = b_margin
-- Let ConfigDialog know so it can update it on screen and have it saved on quit -- Let ConfigDialog know so it can update it on screen and have it saved on quit
self.ui.document.configurable.t_page_margin = b_margin self.configurable.t_page_margin = b_margin
end end
self.ui:handleEvent(Event:new("SetPageMargins", self.unscaled_margins, when_applied_callback)) self.ui:handleEvent(Event:new("SetPageMargins", self.unscaled_margins, when_applied_callback))
end end
@ -418,7 +396,7 @@ function ReaderTypeset:onSetPageTopAndBottomMargin(t_b_margins, when_applied_cal
if t_margin ~= b_margin then if t_margin ~= b_margin then
-- Set Sync T/B Margins toggle to off, as user explicitly made them differ -- Set Sync T/B Margins toggle to off, as user explicitly made them differ
self.sync_t_b_page_margins = false self.sync_t_b_page_margins = false
self.ui.document.configurable.sync_t_b_page_margins = 0 self.configurable.sync_t_b_page_margins = 0
end end
self.ui:handleEvent(Event:new("SetPageMargins", self.unscaled_margins, when_applied_callback)) self.ui:handleEvent(Event:new("SetPageMargins", self.unscaled_margins, when_applied_callback))
end end
@ -435,8 +413,8 @@ function ReaderTypeset:onSyncPageTopBottomMargins(toggle, when_applied_callback)
-- and later scaled, the end result could still be different. -- and later scaled, the end result could still be different.
-- So just take the mean and make them equal. -- So just take the mean and make them equal.
local mean_margin = Math.round((self.unscaled_margins[2] + self.unscaled_margins[4]) / 2) local mean_margin = Math.round((self.unscaled_margins[2] + self.unscaled_margins[4]) / 2)
self.ui.document.configurable.t_page_margin = mean_margin self.configurable.t_page_margin = mean_margin
self.ui.document.configurable.b_page_margin = mean_margin self.configurable.b_page_margin = mean_margin
self.unscaled_margins = { self.unscaled_margins[1], mean_margin, self.unscaled_margins[3], mean_margin } self.unscaled_margins = { self.unscaled_margins[1], mean_margin, self.unscaled_margins[3], mean_margin }
self.ui:handleEvent(Event:new("SetPageMargins", self.unscaled_margins, when_applied_callback)) self.ui:handleEvent(Event:new("SetPageMargins", self.unscaled_margins, when_applied_callback))
when_applied_callback = nil when_applied_callback = nil

@ -867,20 +867,12 @@ function ReaderView:onReadSettings(config)
config:delSetting("gamma") config:delSetting("gamma")
end end
end end
local rotation_mode = nil if G_reader_settings:nilOrFalse("lock_rotation") then
local locked = G_reader_settings:isTrue("lock_rotation") local setting_name = self.ui.paging and "kopt_rotation_mode" or "copt_rotation_mode"
-- Keep current rotation by doing nothing when sticky rota is enabled. -- document.configurable.rotation_mode is not ready yet
if not locked then local rotation_mode = config:readSetting(setting_name)
-- Honor docsettings's rotation or G_reader_settings:readSetting(setting_name)
if config:has("rotation_mode") then or Screen.DEVICE_ROTATED_UPRIGHT
rotation_mode = config:readSetting("rotation_mode") -- Doc's
else
-- No doc specific rotation, pickup global defaults for the doc type
local setting_name = self.ui.paging and "kopt_rotation_mode" or "copt_rotation_mode"
rotation_mode = G_reader_settings:readSetting(setting_name) or Screen.DEVICE_ROTATED_UPRIGHT
end
end
if rotation_mode then
self:onSetRotationMode(rotation_mode) self:onSetRotationMode(rotation_mode)
end end
local full_screen = config:readSetting("kopt_full_screen") or self.document.configurable.full_screen local full_screen = config:readSetting("kopt_full_screen") or self.document.configurable.full_screen
@ -1078,9 +1070,8 @@ function ReaderView:onSaveSettings()
self.ui.doc_settings:saveSetting("render_mode", self.render_mode) self.ui.doc_settings:saveSetting("render_mode", self.render_mode)
end end
-- Don't etch the current rotation in stone when sticky rotation is enabled -- Don't etch the current rotation in stone when sticky rotation is enabled
local locked = G_reader_settings:isTrue("lock_rotation") if G_reader_settings:nilOrFalse("lock_rotation") then
if not locked then self.document.configurable.rotation_mode = Screen:getRotationMode() -- will be saved by ReaderConfig
self.ui.doc_settings:saveSetting("rotation_mode", Screen:getRotationMode())
end end
self.ui.doc_settings:saveSetting("highlight", self.highlight.saved) self.ui.doc_settings:saveSetting("highlight", self.highlight.saved)
self.ui.doc_settings:saveSetting("inverse_reading_order", self.inverse_reading_order) self.ui.doc_settings:saveSetting("inverse_reading_order", self.inverse_reading_order)

@ -51,7 +51,7 @@ local CreOptions = {
{ {
icon = "appbar.rotation", icon = "appbar.rotation",
options = { options = {
{ { -- ReaderView
name = "rotation_mode", name = "rotation_mode",
name_text = _("Rotation"), name_text = _("Rotation"),
item_icons_func = function() item_icons_func = function()
@ -99,7 +99,7 @@ local CreOptions = {
event = "SetRotationMode", event = "SetRotationMode",
name_text_hold_callback = optionsutil.showValues, name_text_hold_callback = optionsutil.showValues,
}, },
{ { -- ReaderRolling
name = "visible_pages", name = "visible_pages",
name_text = _("Two Columns"), name_text = _("Two Columns"),
toggle = {_("off"), _("on")}, toggle = {_("off"), _("on")},
@ -131,7 +131,7 @@ This is disabled in scroll mode. Switching from page mode with two columns to sc
{ {
icon = "appbar.crop", icon = "appbar.crop",
options = { options = {
{ { -- ReaderTypeset
name = "h_page_margins", name = "h_page_margins",
name_text = _("L/R Margins"), name_text = _("L/R Margins"),
buttonprogress = true, buttonprogress = true,
@ -176,7 +176,7 @@ This is disabled in scroll mode. Switching from page mode with two columns to sc
right_hold_step = 5, right_hold_step = 5,
}, },
}, },
{ { -- ReaderTypeset
name = "sync_t_b_page_margins", name = "sync_t_b_page_margins",
name_text = _("Sync T/B Margins"), name_text = _("Sync T/B Margins"),
toggle = {_("off"), _("on")}, toggle = {_("off"), _("on")},
@ -193,7 +193,7 @@ This is disabled in scroll mode. Switching from page mode with two columns to sc
In the top menu Settings Status bar, you can choose whether the bottom margin applies from the bottom of the screen, or from above the status bar.]]), In the top menu Settings Status bar, you can choose whether the bottom margin applies from the bottom of the screen, or from above the status bar.]]),
}, },
{ { -- ReaderTypeset
name = "t_page_margin", name = "t_page_margin",
name_text = _("Top Margin"), name_text = _("Top Margin"),
buttonprogress = true, buttonprogress = true,
@ -247,7 +247,7 @@ In the top menu → Settings → Status bar, you can choose whether the bottom m
right_hold_step = 5, right_hold_step = 5,
}, },
}, },
{ { -- ReaderTypeset
name = "b_page_margin", name = "b_page_margin",
name_text = _("Bottom Margin"), name_text = _("Bottom Margin"),
buttonprogress = true, buttonprogress = true,
@ -305,7 +305,7 @@ In the top menu → Settings → Status bar, you can choose whether the bottom m
{ {
icon = "appbar.pageview", icon = "appbar.pageview",
options = { options = {
{ { -- ReaderView
name = "view_mode", name = "view_mode",
name_text = _("View Mode"), name_text = _("View Mode"),
toggle = {_("page"), _("continuous")}, toggle = {_("page"), _("continuous")},
@ -318,7 +318,7 @@ In the top menu → Settings → Status bar, you can choose whether the bottom m
help_text = _([[- 'page' mode splits the text into pages, at the most acceptable places (page numbers and the number of pages may change when you change fonts, margins, styles, etc.). help_text = _([[- 'page' mode splits the text into pages, at the most acceptable places (page numbers and the number of pages may change when you change fonts, margins, styles, etc.).
- 'continuous' mode allows you to scroll the text like you would in a web browser (the 'Page Overlap' setting is only available in this mode).]]), - 'continuous' mode allows you to scroll the text like you would in a web browser (the 'Page Overlap' setting is only available in this mode).]]),
}, },
{ { -- ReaderTypeset
name = "block_rendering_mode", name = "block_rendering_mode",
name_text = _("Render Mode"), name_text = _("Render Mode"),
toggle = {_("legacy"), _("flat"), _("book"), _("web")}, toggle = {_("legacy"), _("flat"), _("book"), _("web")},
@ -334,7 +334,7 @@ In the top menu → Settings → Status bar, you can choose whether the bottom m
- 'book' additionally allows floats, but limits style support to avoid blank spaces and overflows. - 'book' additionally allows floats, but limits style support to avoid blank spaces and overflows.
- 'web' renders as web browsers do, allowing negative margins and possible page overflow.]]), - 'web' renders as web browsers do, allowing negative margins and possible page overflow.]]),
}, },
{ { -- ReaderTypeset
name = "render_dpi", name = "render_dpi",
name_text = _("Zoom (dpi)"), name_text = _("Zoom (dpi)"),
more_options = true, more_options = true,
@ -363,7 +363,7 @@ Note that your selected font size is not affected by this setting.]]),
end, end,
}, },
{ { -- ReaderFont
name = "line_spacing", name = "line_spacing",
name_text = _("Line Spacing"), name_text = _("Line Spacing"),
buttonprogress = true, buttonprogress = true,
@ -418,7 +418,7 @@ Note that your selected font size is not affected by this setting.]]),
{ {
icon = "appbar.textsize", icon = "appbar.textsize",
options = { options = {
{ { -- ReaderFont
name = "font_size", name = "font_size",
alt_name_text = _("Font Size"), alt_name_text = _("Font Size"),
item_text = tableOfNumbersToTableOfStrings(G_defaults:readSetting("DCREREADER_CONFIG_FONT_SIZES")), item_text = tableOfNumbersToTableOfStrings(G_defaults:readSetting("DCREREADER_CONFIG_FONT_SIZES")),
@ -430,7 +430,7 @@ Note that your selected font size is not affected by this setting.]]),
args = G_defaults:readSetting("DCREREADER_CONFIG_FONT_SIZES"), args = G_defaults:readSetting("DCREREADER_CONFIG_FONT_SIZES"),
event = "SetFontSize", event = "SetFontSize",
}, },
{ { -- ReaderFont
name = "font_fine_tune", name = "font_fine_tune",
name_text = _("Font Size"), name_text = _("Font Size"),
toggle = Device:isTouchDevice() and {_("decrease"), _("increase")} or nil, toggle = Device:isTouchDevice() and {_("decrease"), _("increase")} or nil,
@ -458,7 +458,7 @@ Note that your selected font size is not affected by this setting.]]),
optionsutil.showValues(configurable, opt, prefix, nil, "pt") optionsutil.showValues(configurable, opt, prefix, nil, "pt")
end, end,
}, },
{ { -- ReaderFont
name = "word_spacing", name = "word_spacing",
name_text = _("Word Spacing"), name_text = _("Word Spacing"),
more_options = true, more_options = true,
@ -501,7 +501,7 @@ Note that your selected font size is not affected by this setting.]]),
return string.format("%d\u{202F}%%, %d\u{202F}%%", val[1], val[2]) -- use Narrow Now-Break space here return string.format("%d\u{202F}%%, %d\u{202F}%%", val[1], val[2]) -- use Narrow Now-Break space here
end, end,
}, },
{ { -- ReaderFont
name = "word_expansion", name = "word_expansion",
name_text = _("Word Expansion"), name_text = _("Word Expansion"),
more_options = true, more_options = true,
@ -540,7 +540,7 @@ Note that your selected font size is not affected by this setting.]]),
return string.format("%d\u{202F}%%", val) -- use Narrow No-Break space here return string.format("%d\u{202F}%%", val) -- use Narrow No-Break space here
end, end,
}, },
{ { -- ReaderFont
-- This option is not shown in the bottom menu, but its fine tuning is made -- This option is not shown in the bottom menu, but its fine tuning is made
-- available via the other_button in Word Expansion's fine tuning widget. -- available via the other_button in Word Expansion's fine tuning widget.
-- We still need to define it as an option here for it to be known and -- We still need to define it as an option here for it to be known and
@ -572,7 +572,7 @@ Note that your selected font size is not affected by this setting.]]),
{ {
icon = "appbar.contrast", icon = "appbar.contrast",
options = { options = {
{ { -- ReaderFont
name = "font_gamma", name = "font_gamma",
name_text = _("Contrast"), name_text = _("Contrast"),
buttonprogress = true, buttonprogress = true,
@ -597,7 +597,7 @@ Note that your selected font size is not affected by this setting.]]),
value_table_shift = 1, value_table_shift = 1,
}, },
}, },
{ { -- ReaderFont
name = "font_base_weight", name = "font_base_weight",
name_text = _("Font Weight"), name_text = _("Font Weight"),
toggle = { "-1", "", "0", "", "+1", "+1½", "+3" }, toggle = { "-1", "", "0", "", "+1", "+1½", "+3" },
@ -631,7 +631,7 @@ If a font variation is not available, as well as for fractional adjustments, it
return weightClassToString(400+val*100) return weightClassToString(400+val*100)
end, end,
}, },
{ { -- ReaderFont
name = "font_hinting", name = "font_hinting",
name_text = _("Font Hinting"), name_text = _("Font Hinting"),
toggle = {C_("Font hinting", "off"), C_("Font hinting", "native"), C_("Font hinting", "auto")}, toggle = {C_("Font hinting", "off"), C_("Font hinting", "native"), C_("Font hinting", "auto")},
@ -646,7 +646,7 @@ If a font variation is not available, as well as for fractional adjustments, it
- native: use the font internal hinting instructions. - native: use the font internal hinting instructions.
- auto: use FreeType's hinting algorithm, ignoring font instructions.]]), - auto: use FreeType's hinting algorithm, ignoring font instructions.]]),
}, },
{ { -- ReaderFont
name = "font_kerning", name = "font_kerning",
name_text = _("Font Kerning"), name_text = _("Font Kerning"),
toggle = {_("off"), _("fast"), _("good"), _("best")}, toggle = {_("off"), _("fast"), _("good"), _("best")},
@ -669,7 +669,7 @@ If a font variation is not available, as well as for fractional adjustments, it
{ {
icon = "appbar.settings", icon = "appbar.settings",
options = { options = {
{ { -- ReaderRolling
name = "status_line", name = "status_line",
name_text = _("Alt Status Bar"), name_text = _("Alt Status Bar"),
toggle = {_("off"), _("on")}, toggle = {_("off"), _("on")},
@ -683,7 +683,7 @@ If a font variation is not available, as well as for fractional adjustments, it
Whether enabled or disabled, KOReader's own status bar at the bottom of the screen can be toggled by tapping.]]), Whether enabled or disabled, KOReader's own status bar at the bottom of the screen can be toggled by tapping.]]),
}, },
{ { -- ReaderTypeset
name = "embedded_css", name = "embedded_css",
name_text = _("Embedded Style"), name_text = _("Embedded Style"),
toggle = {_("off"), _("on")}, toggle = {_("off"), _("on")},
@ -696,7 +696,7 @@ Whether enabled or disabled, KOReader's own status bar at the bottom of the scre
help_text = _([[Enable or disable publisher stylesheets embedded in the book. help_text = _([[Enable or disable publisher stylesheets embedded in the book.
(Note that less radical changes can be achieved via Style Tweaks in the main menu.)]]), (Note that less radical changes can be achieved via Style Tweaks in the main menu.)]]),
}, },
{ { -- ReaderTypeset
name = "embedded_fonts", name = "embedded_fonts",
name_text = _("Embedded Fonts"), name_text = _("Embedded Fonts"),
toggle = {_("off"), _("on")}, toggle = {_("off"), _("on")},
@ -724,7 +724,7 @@ Whether enabled or disabled, KOReader's own status bar at the bottom of the scre
end end
end, end,
}, },
{ { -- ReaderTypeset
name = "smooth_scaling", name = "smooth_scaling",
name_text = _("Image Scaling"), name_text = _("Image Scaling"),
toggle = {_("fast"), _("best")}, toggle = {_("fast"), _("best")},
@ -737,7 +737,7 @@ Whether enabled or disabled, KOReader's own status bar at the bottom of the scre
help_text = _([[- 'fast' uses a fast but inaccurate scaling algorithm when scaling images. help_text = _([[- 'fast' uses a fast but inaccurate scaling algorithm when scaling images.
- 'best' switches to a more costly but vastly more pleasing and accurate algorithm.]]), - 'best' switches to a more costly but vastly more pleasing and accurate algorithm.]]),
}, },
{ { -- ReaderTypeset
name = "nightmode_images", name = "nightmode_images",
name_text = _("Invert Images"), name_text = _("Invert Images"),
toggle = {_("on"), _("off")}, toggle = {_("on"), _("off")},

@ -317,6 +317,7 @@ function Profiles:getProfileFromCurrentDocument(new_name)
"embedded_fonts", "embedded_fonts",
"smooth_scaling", "smooth_scaling",
"nightmode_images", "nightmode_images",
"status_line",
} }
else else
document_settings = { document_settings = {

Loading…
Cancel
Save