2018-03-22 20:01:38 +00:00
local Device = require ( " device " )
2020-07-01 20:17:41 +00:00
local Screen = Device.screen
2022-06-11 09:08:42 +00:00
local ffiUtil = require ( " ffi/util " )
2018-05-26 17:45:37 +00:00
local optionsutil = require ( " ui/data/optionsutil " )
2013-10-18 20:38:07 +00:00
local _ = require ( " gettext " )
2021-03-06 18:27:23 +00:00
local C_ = _.pgettext
2022-06-11 09:08:42 +00:00
local T = ffiUtil.template
2013-04-08 14:26:54 +00:00
2020-05-07 18:24:12 +00:00
-- Get font size numbers as a table of strings
local tableOfNumbersToTableOfStrings = function ( numbers )
local t = { }
for i , v in ipairs ( numbers ) do
-- We turn 17.5 into 17<sup>5</sup>
table.insert ( t , tostring ( v % 1 == 0 and v or ( v - v % 1 ) .. " ⁵ " ) )
2014-03-13 13:52:43 +00:00
end
2020-05-07 18:24:12 +00:00
return t
end
2013-10-16 09:06:28 +00:00
2021-04-29 18:16:30 +00:00
-- OS/2 weight classes map
-- c.f., https://docs.microsoft.com/en-us/typography/opentype/spec/os2#usweightclass
local usWeightClass = {
[ 100 ] = C_ ( " Font weight class " , " Thin " ) ,
[ 200 ] = C_ ( " Font weight class " , " Extra-light " ) ,
[ 300 ] = C_ ( " Font weight class " , " Light " ) ,
[ 400 ] = C_ ( " Font weight class " , " Regular " ) ,
[ 500 ] = C_ ( " Font weight class " , " Medium " ) ,
[ 600 ] = C_ ( " Font weight class " , " Semi-bold " ) ,
[ 700 ] = C_ ( " Font weight class " , " Bold " ) ,
[ 800 ] = C_ ( " Font weight class " , " Extra-bold " ) ,
[ 900 ] = C_ ( " Font weight class " , " Black " ) ,
}
local function weightClassToString ( weight )
if usWeightClass [ weight ] then
return T ( _ ( " %1 (%2) " ) , usWeightClass [ weight ] , weight )
else
return tostring ( weight )
end
end
local function prettifyCreWeights ( t )
local p = { }
for __ , v in ipairs ( t ) do
table.insert ( p , weightClassToString ( v ) )
end
return p
end
2013-10-18 20:38:07 +00:00
local CreOptions = {
ReaderZooming: Deal with some more fallout of the new zoom modes (#7728)
* Namely, ensure zoom_mode is consistent with genus & type *both ways*. (I only dealt with the "no zoom_mode" case in my original fixup).
Because documents with settings dating back from before the new zoom modes had "old" zoom_mode settings mixed with "new" genus/type defaults that didn't agree with each other.
It lead to super-confusing ConfigDialog behavior, because ConfigDialog was in fact not reflecting the reality.
(As the source of truth is actually `zoom_mode`).
* There was a snafu in manual mode, because of the extremely weird way prefixes are handled by Configurable/ReaderConfig/DocSettings/ConfigDialog.
So, make sure we only have a *single* zoom_factor, and that it's updated and saved properly under the right name everywhere.
Fixes inconsistencies between first swapping to manual mode, and what the ConfigDialog said/did (because again: possibly a lie), vs., re-opening the same document, which would magically use *different* settings, closer to what was expected (but still broken because of the prefix mismatch and a disagreement on defaults between the two variants).
Fallout from #6885
2021-05-22 01:28:52 +00:00
prefix = " copt " ,
2014-03-13 13:52:43 +00:00
{
2020-12-19 11:18:30 +00:00
icon = " appbar.rotation " ,
2014-03-13 13:52:43 +00:00
options = {
2023-09-08 05:41:44 +00:00
{ -- ReaderView
2020-07-01 20:17:41 +00:00
name = " rotation_mode " ,
2020-11-29 09:18:59 +00:00
name_text = _ ( " Rotation " ) ,
2021-03-29 03:12:22 +00:00
item_icons_func = function ( )
2022-12-21 14:50:39 +00:00
if Screen : getRotationMode ( ) == Screen.DEVICE_ROTATED_UPRIGHT then
2021-03-29 03:12:22 +00:00
-- P, 0UR
return {
" rotation.P.90CCW " ,
" rotation.P.0UR " ,
" rotation.P.90CW " ,
" rotation.P.180UD " ,
}
2022-12-21 14:50:39 +00:00
elseif Screen : getRotationMode ( ) == Screen.DEVICE_ROTATED_UPSIDE_DOWN then
2021-03-29 03:12:22 +00:00
-- P, 180UD
return {
" rotation.P.90CW " ,
" rotation.P.180UD " ,
" rotation.P.90CCW " ,
" rotation.P.0UR " ,
}
2022-12-21 14:50:39 +00:00
elseif Screen : getRotationMode ( ) == Screen.DEVICE_ROTATED_CLOCKWISE then
2021-03-29 03:12:22 +00:00
-- L, 90CW
return {
" rotation.L.90CCW " ,
" rotation.L.0UR " ,
" rotation.L.90CW " ,
" rotation.L.180UD " ,
}
else
-- L, 90CCW
return {
" rotation.L.90CW " ,
" rotation.L.180UD " ,
" rotation.L.90CCW " ,
" rotation.L.0UR " ,
}
end
end ,
2021-03-30 16:47:52 +00:00
-- For Dispatcher & onMakeDefault's sake
2021-03-06 18:27:23 +00:00
labels = { C_ ( " Rotation " , " ⤹ 90° " ) , C_ ( " Rotation " , " ↑ 0° " ) , C_ ( " Rotation " , " ⤸ 90° " ) , C_ ( " Rotation " , " ↓ 180° " ) } ,
2014-03-13 13:52:43 +00:00
alternate = false ,
2022-12-21 14:50:39 +00:00
values = { Screen.DEVICE_ROTATED_COUNTER_CLOCKWISE , Screen.DEVICE_ROTATED_UPRIGHT , Screen.DEVICE_ROTATED_CLOCKWISE , Screen.DEVICE_ROTATED_UPSIDE_DOWN } ,
2023-09-13 04:49:57 +00:00
default_value = Screen.DEVICE_ROTATED_UPRIGHT ,
2022-12-21 14:50:39 +00:00
args = { Screen.DEVICE_ROTATED_COUNTER_CLOCKWISE , Screen.DEVICE_ROTATED_UPRIGHT , Screen.DEVICE_ROTATED_CLOCKWISE , Screen.DEVICE_ROTATED_UPSIDE_DOWN } ,
2021-03-29 03:12:22 +00:00
current_func = function ( ) return Screen : getRotationMode ( ) end ,
2020-07-01 20:17:41 +00:00
event = " SetRotationMode " ,
2018-05-26 17:45:37 +00:00
name_text_hold_callback = optionsutil.showValues ,
2019-03-13 12:07:30 +00:00
} ,
2023-09-08 05:41:44 +00:00
{ -- ReaderRolling
2019-03-13 12:07:30 +00:00
name = " visible_pages " ,
2021-01-29 00:02:19 +00:00
name_text = _ ( " Two Columns " ) ,
2020-11-29 09:18:59 +00:00
toggle = { _ ( " off " ) , _ ( " on " ) } ,
2019-03-13 12:07:30 +00:00
values = { 1 , 2 } ,
default_value = 1 ,
args = { 1 , 2 } ,
event = " SetVisiblePages " ,
2021-01-13 19:26:14 +00:00
--[[ Commented out, to have it also available in portrait mode
2019-03-13 12:07:30 +00:00
current_func = function ( )
-- If not in landscape mode, shows "1" as selected
2021-03-29 03:12:22 +00:00
if Screen : getScreenMode ( ) ~= " landscape " then
2019-03-13 12:07:30 +00:00
return 1
end
-- if we return nil, ConfigDialog will pick the one from the
-- configurable as if we hadn't provided this 'current_func'
end ,
2021-01-13 19:26:14 +00:00
] ] --
2019-03-13 12:07:30 +00:00
enabled_func = function ( configurable )
2021-01-13 19:26:14 +00:00
return optionsutil.enableIfEquals ( configurable , " view_mode " , 0 ) -- "page" mode
2021-03-29 03:12:22 +00:00
-- and Screen:getScreenMode() == "landscape"
2019-03-13 12:07:30 +00:00
end ,
name_text_hold_callback = optionsutil.showValues ,
2021-01-29 00:02:19 +00:00
help_text = _ ( [ [ Render the document on half the screen width and display two pages at once with a single page number . This makes it look like two columns .
This is disabled in scroll mode . Switching from page mode with two columns to scroll mode will cause the document to be re - rendered . ] ] ) ,
2019-03-13 12:07:30 +00:00
} ,
2014-03-13 13:52:43 +00:00
}
} ,
2019-05-01 00:09:01 +00:00
{
2020-12-19 11:18:30 +00:00
icon = " appbar.crop " ,
2019-05-01 00:09:01 +00:00
options = {
2023-09-08 05:41:44 +00:00
{ -- ReaderTypeset
2019-05-01 00:09:01 +00:00
name = " h_page_margins " ,
2020-11-29 09:18:59 +00:00
name_text = _ ( " L/R Margins " ) ,
2019-03-01 11:55:55 +00:00
buttonprogress = true ,
2014-03-13 13:52:43 +00:00
values = {
2022-09-27 23:10:50 +00:00
G_defaults : readSetting ( " DCREREADER_CONFIG_H_MARGIN_SIZES_SMALL " ) ,
G_defaults : readSetting ( " DCREREADER_CONFIG_H_MARGIN_SIZES_MEDIUM " ) ,
G_defaults : readSetting ( " DCREREADER_CONFIG_H_MARGIN_SIZES_LARGE " ) ,
G_defaults : readSetting ( " DCREREADER_CONFIG_H_MARGIN_SIZES_X_LARGE " ) ,
G_defaults : readSetting ( " DCREREADER_CONFIG_H_MARGIN_SIZES_XX_LARGE " ) ,
G_defaults : readSetting ( " DCREREADER_CONFIG_H_MARGIN_SIZES_XXX_LARGE " ) ,
G_defaults : readSetting ( " DCREREADER_CONFIG_H_MARGIN_SIZES_HUGE " ) ,
G_defaults : readSetting ( " DCREREADER_CONFIG_H_MARGIN_SIZES_X_HUGE " ) ,
G_defaults : readSetting ( " DCREREADER_CONFIG_H_MARGIN_SIZES_XX_HUGE " ) ,
2014-03-13 13:52:43 +00:00
} ,
2019-03-01 11:55:55 +00:00
default_pos = 2 ,
2022-09-27 23:10:50 +00:00
default_value = G_defaults : readSetting ( " DCREREADER_CONFIG_H_MARGIN_SIZES_MEDIUM " ) ,
2019-05-01 00:09:01 +00:00
event = " SetPageHorizMargins " ,
args = {
2022-09-27 23:10:50 +00:00
G_defaults : readSetting ( " DCREREADER_CONFIG_H_MARGIN_SIZES_SMALL " ) ,
G_defaults : readSetting ( " DCREREADER_CONFIG_H_MARGIN_SIZES_MEDIUM " ) ,
G_defaults : readSetting ( " DCREREADER_CONFIG_H_MARGIN_SIZES_LARGE " ) ,
G_defaults : readSetting ( " DCREREADER_CONFIG_H_MARGIN_SIZES_X_LARGE " ) ,
G_defaults : readSetting ( " DCREREADER_CONFIG_H_MARGIN_SIZES_XX_LARGE " ) ,
G_defaults : readSetting ( " DCREREADER_CONFIG_H_MARGIN_SIZES_XXX_LARGE " ) ,
G_defaults : readSetting ( " DCREREADER_CONFIG_H_MARGIN_SIZES_HUGE " ) ,
G_defaults : readSetting ( " DCREREADER_CONFIG_H_MARGIN_SIZES_X_HUGE " ) ,
G_defaults : readSetting ( " DCREREADER_CONFIG_H_MARGIN_SIZES_XX_HUGE " ) ,
2019-05-01 00:09:01 +00:00
} ,
2021-01-11 17:14:17 +00:00
hide_on_apply = true ,
2019-05-01 00:09:01 +00:00
name_text_hold_callback = optionsutil.showValuesHMargins ,
2020-12-21 01:02:07 +00:00
more_options = true ,
more_options_param = {
2021-01-02 22:15:48 +00:00
name_text = _ ( " Left/Right Margins " ) ,
2021-10-01 18:32:16 +00:00
widget_width_factor = 0.6 ,
2020-12-21 01:02:07 +00:00
left_min = 0 ,
left_max = 140 ,
left_step = 1 ,
left_hold_step = 5 ,
right_min = 0 ,
right_max = 140 ,
right_step = 1 ,
right_hold_step = 5 ,
} ,
2019-05-01 00:09:01 +00:00
} ,
2023-09-08 05:41:44 +00:00
{ -- ReaderTypeset
2019-05-01 20:18:50 +00:00
name = " sync_t_b_page_margins " ,
2020-11-29 09:18:59 +00:00
name_text = _ ( " Sync T/B Margins " ) ,
toggle = { _ ( " off " ) , _ ( " on " ) } ,
2019-05-01 20:18:50 +00:00
values = { 0 , 1 } ,
default_value = 0 ,
2019-05-05 08:15:13 +00:00
event = " SyncPageTopBottomMargins " ,
2019-05-01 20:18:50 +00:00
args = { false , true } ,
2021-01-11 17:14:17 +00:00
hide_on_apply = true ,
2019-05-01 20:18:50 +00:00
name_text_hold_callback = optionsutil.showValues ,
help_text = _ ( [ [ Keep top and bottom margins synchronized .
- ' off ' allows different top and bottom margins .
- ' on ' keeps top and bottom margins locked , ensuring text is vertically centered in the page .
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 . ] ] ) ,
} ,
2023-09-08 05:41:44 +00:00
{ -- ReaderTypeset
2019-05-01 00:09:01 +00:00
name = " t_page_margin " ,
2020-11-29 09:18:59 +00:00
name_text = _ ( " Top Margin " ) ,
2019-05-01 00:09:01 +00:00
buttonprogress = true ,
values = {
2022-09-27 23:10:50 +00:00
G_defaults : readSetting ( " DCREREADER_CONFIG_T_MARGIN_SIZES_SMALL " ) ,
G_defaults : readSetting ( " DCREREADER_CONFIG_T_MARGIN_SIZES_MEDIUM " ) ,
G_defaults : readSetting ( " DCREREADER_CONFIG_T_MARGIN_SIZES_LARGE " ) ,
G_defaults : readSetting ( " DCREREADER_CONFIG_T_MARGIN_SIZES_X_LARGE " ) ,
G_defaults : readSetting ( " DCREREADER_CONFIG_T_MARGIN_SIZES_XX_LARGE " ) ,
G_defaults : readSetting ( " DCREREADER_CONFIG_T_MARGIN_SIZES_XXX_LARGE " ) ,
G_defaults : readSetting ( " DCREREADER_CONFIG_T_MARGIN_SIZES_HUGE " ) ,
G_defaults : readSetting ( " DCREREADER_CONFIG_T_MARGIN_SIZES_X_HUGE " ) ,
G_defaults : readSetting ( " DCREREADER_CONFIG_T_MARGIN_SIZES_XX_HUGE " ) ,
2019-05-01 00:09:01 +00:00
} ,
default_pos = 3 ,
2022-09-27 23:10:50 +00:00
default_value = G_defaults : readSetting ( " DCREREADER_CONFIG_T_MARGIN_SIZES_LARGE " ) ,
2019-05-01 00:09:01 +00:00
event = " SetPageTopMargin " ,
args = {
2022-09-27 23:10:50 +00:00
G_defaults : readSetting ( " DCREREADER_CONFIG_T_MARGIN_SIZES_SMALL " ) ,
G_defaults : readSetting ( " DCREREADER_CONFIG_T_MARGIN_SIZES_MEDIUM " ) ,
G_defaults : readSetting ( " DCREREADER_CONFIG_T_MARGIN_SIZES_LARGE " ) ,
G_defaults : readSetting ( " DCREREADER_CONFIG_T_MARGIN_SIZES_X_LARGE " ) ,
G_defaults : readSetting ( " DCREREADER_CONFIG_T_MARGIN_SIZES_XX_LARGE " ) ,
G_defaults : readSetting ( " DCREREADER_CONFIG_T_MARGIN_SIZES_XXX_LARGE " ) ,
G_defaults : readSetting ( " DCREREADER_CONFIG_T_MARGIN_SIZES_HUGE " ) ,
G_defaults : readSetting ( " DCREREADER_CONFIG_T_MARGIN_SIZES_X_HUGE " ) ,
G_defaults : readSetting ( " DCREREADER_CONFIG_T_MARGIN_SIZES_XX_HUGE " ) ,
2019-05-01 00:09:01 +00:00
} ,
2021-01-11 17:14:17 +00:00
hide_on_apply = true ,
2022-07-05 13:38:59 +00:00
name_text_hold_callback = function ( configurable , opt , prefix )
optionsutil.showValues ( configurable , opt , prefix , nil , " mm " )
end ,
2020-12-21 01:02:07 +00:00
more_options = true ,
more_options_param = {
2021-01-11 17:14:14 +00:00
-- Allow this to tune both top and bottom margins, handling
-- 2 setting names (we'll get the exact same DoubleSpinWidget
-- in the b_page_margin setting just below)
2021-01-02 22:15:48 +00:00
name_text = _ ( " Top/Bottom Margins " ) ,
names = { " t_page_margin " , " b_page_margin " } ,
2021-01-11 17:14:14 +00:00
event = " SetPageTopAndBottomMargin " ,
2021-10-01 18:32:16 +00:00
widget_width_factor = 0.6 ,
2021-01-02 22:15:48 +00:00
left_text = _ ( " Top " ) ,
left_min = 0 ,
left_max = 140 ,
left_step = 1 ,
left_hold_step = 5 ,
right_text = _ ( " Bottom " ) ,
right_min = 0 ,
right_max = 140 ,
right_step = 1 ,
right_hold_step = 5 ,
2020-12-21 01:02:07 +00:00
} ,
2019-05-01 00:09:01 +00:00
} ,
2023-09-08 05:41:44 +00:00
{ -- ReaderTypeset
2019-05-01 00:09:01 +00:00
name = " b_page_margin " ,
2020-11-29 09:18:59 +00:00
name_text = _ ( " Bottom Margin " ) ,
2019-05-01 00:09:01 +00:00
buttonprogress = true ,
values = {
2022-09-27 23:10:50 +00:00
G_defaults : readSetting ( " DCREREADER_CONFIG_B_MARGIN_SIZES_SMALL " ) ,
G_defaults : readSetting ( " DCREREADER_CONFIG_B_MARGIN_SIZES_MEDIUM " ) ,
G_defaults : readSetting ( " DCREREADER_CONFIG_B_MARGIN_SIZES_LARGE " ) ,
G_defaults : readSetting ( " DCREREADER_CONFIG_B_MARGIN_SIZES_X_LARGE " ) ,
G_defaults : readSetting ( " DCREREADER_CONFIG_B_MARGIN_SIZES_XX_LARGE " ) ,
G_defaults : readSetting ( " DCREREADER_CONFIG_B_MARGIN_SIZES_XXX_LARGE " ) ,
G_defaults : readSetting ( " DCREREADER_CONFIG_B_MARGIN_SIZES_HUGE " ) ,
G_defaults : readSetting ( " DCREREADER_CONFIG_B_MARGIN_SIZES_X_HUGE " ) ,
G_defaults : readSetting ( " DCREREADER_CONFIG_B_MARGIN_SIZES_XX_HUGE " ) ,
2019-05-01 00:09:01 +00:00
} ,
default_pos = 3 ,
2022-09-27 23:10:50 +00:00
default_value = G_defaults : readSetting ( " DCREREADER_CONFIG_B_MARGIN_SIZES_LARGE " ) ,
2019-05-01 00:09:01 +00:00
event = " SetPageBottomMargin " ,
2014-03-13 13:52:43 +00:00
args = {
2022-09-27 23:10:50 +00:00
G_defaults : readSetting ( " DCREREADER_CONFIG_B_MARGIN_SIZES_SMALL " ) ,
G_defaults : readSetting ( " DCREREADER_CONFIG_B_MARGIN_SIZES_MEDIUM " ) ,
G_defaults : readSetting ( " DCREREADER_CONFIG_B_MARGIN_SIZES_LARGE " ) ,
G_defaults : readSetting ( " DCREREADER_CONFIG_B_MARGIN_SIZES_X_LARGE " ) ,
G_defaults : readSetting ( " DCREREADER_CONFIG_B_MARGIN_SIZES_XX_LARGE " ) ,
G_defaults : readSetting ( " DCREREADER_CONFIG_B_MARGIN_SIZES_XXX_LARGE " ) ,
G_defaults : readSetting ( " DCREREADER_CONFIG_B_MARGIN_SIZES_HUGE " ) ,
G_defaults : readSetting ( " DCREREADER_CONFIG_B_MARGIN_SIZES_X_HUGE " ) ,
G_defaults : readSetting ( " DCREREADER_CONFIG_B_MARGIN_SIZES_XX_HUGE " ) ,
2014-03-13 13:52:43 +00:00
} ,
2021-01-11 17:14:17 +00:00
hide_on_apply = true ,
2022-07-05 13:38:59 +00:00
name_text_hold_callback = function ( configurable , opt , prefix )
optionsutil.showValues ( configurable , opt , prefix , nil , " mm " )
end ,
2019-05-01 20:18:50 +00:00
help_text = _ ( [[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.]] ) ,
2020-12-21 01:02:07 +00:00
more_options = true ,
more_options_param = {
2021-01-02 22:15:48 +00:00
-- Similar as for t_page_margin above
name_text = _ ( " Top/Bottom Margins " ) ,
names = { " t_page_margin " , " b_page_margin " } ,
2021-01-11 17:14:14 +00:00
event = " SetPageTopAndBottomMargin " ,
2021-10-01 18:32:16 +00:00
widget_width_factor = 0.6 ,
2021-01-02 22:15:48 +00:00
left_text = _ ( " Top " ) ,
left_min = 0 ,
left_max = 140 ,
left_step = 1 ,
left_hold_step = 5 ,
right_text = _ ( " Bottom " ) ,
right_min = 0 ,
right_max = 140 ,
right_step = 1 ,
right_hold_step = 5 ,
2020-12-21 01:02:07 +00:00
} ,
2019-05-01 20:18:50 +00:00
} ,
}
} ,
{
2020-12-19 11:18:30 +00:00
icon = " appbar.pageview " ,
2019-05-01 20:18:50 +00:00
options = {
2023-09-08 05:41:44 +00:00
{ -- ReaderView
2019-05-01 20:18:50 +00:00
name = " view_mode " ,
2020-11-29 09:18:59 +00:00
name_text = _ ( " View Mode " ) ,
toggle = { _ ( " page " ) , _ ( " continuous " ) } ,
2020-05-07 18:24:12 +00:00
values = { 0 , 1 } ,
2023-09-13 04:49:57 +00:00
default_value = G_defaults : readSetting ( " DCREREADER_VIEW_MODE " ) == " page " and 0 or 1 ,
2020-05-07 18:24:12 +00:00
args = { " page " , " scroll " } ,
2019-05-01 20:18:50 +00:00
event = " SetViewMode " ,
name_text_hold_callback = optionsutil.showValues ,
2020-05-07 18:24:12 +00:00
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 ) . ] ] ) ,
2019-07-14 20:13:05 +00:00
} ,
2023-09-08 05:41:44 +00:00
{ -- ReaderTypeset
2019-07-14 20:13:05 +00:00
name = " block_rendering_mode " ,
2020-11-29 09:18:59 +00:00
name_text = _ ( " Render Mode " ) ,
toggle = { _ ( " legacy " ) , _ ( " flat " ) , _ ( " book " ) , _ ( " web " ) } ,
2019-07-14 20:13:05 +00:00
values = { 0 , 1 , 2 , 3 } ,
default_value = 2 ,
args = { 0 , 1 , 2 , 3 } ,
event = " SetBlockRenderingMode " ,
name_text_hold_callback = optionsutil.showValues ,
2019-08-22 15:11:47 +00:00
help_text = _ ( [ [
- ' legacy ' uses original CR3 block rendering code .
2019-07-14 20:13:05 +00:00
- ' flat ' ensures flat rendering with collapsing margins and accurate page breaks .
- ' 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 . ] ] ) ,
2019-05-01 20:18:50 +00:00
} ,
2023-09-08 05:41:44 +00:00
{ -- ReaderTypeset
2019-05-01 20:18:50 +00:00
name = " render_dpi " ,
2020-11-29 09:18:59 +00:00
name_text = _ ( " Zoom (dpi) " ) ,
2019-09-27 10:58:40 +00:00
more_options = true ,
more_options_param = {
value_hold_step = 20 ,
2022-06-04 07:35:33 +00:00
unit = C_ ( " Resolution " , " dpi " ) ,
2019-09-27 10:58:40 +00:00
} ,
2020-11-29 09:18:59 +00:00
toggle = { _ ( " off " ) , " 48 " , " 96¹’ ¹ " , " 167 " , " 212 " , " 300 " } ,
2019-05-01 20:18:50 +00:00
values = { 0 , 48 , 96 , 167 , 212 , 300 } ,
default_value = 96 ,
args = { 0 , 48 , 96 , 167 , 212 , 300 } ,
event = " SetRenderDPI " ,
help_text = _ ( [ [ Sets the DPI used to scale absolute CSS units and images :
- off : ignore absolute units ( old engine behavior ) .
- 96 ¹ ’ ¹ : at 96 DPI , 1 CSS pixel = 1 screen pixel and images are rendered at their original dimensions .
- other values scale CSS absolute units and images by a factor ( 300 DPI = x3 , 48 DPI = x0 .5 )
Using your device ' s actual DPI will ensure 1 cm in CSS actually translates to 1 cm on screen.
Note that your selected font size is not affected by this setting . ] ] ) ,
2022-06-04 07:35:33 +00:00
name_text_hold_callback = optionsutil.showValues ,
name_text_true_values = true ,
show_true_value_func = function ( val ) -- add "dpi"
if val == 96 then
val = " 96¹’ ¹ "
end
return val ~= 0 and string.format ( " %s dpi " , val ) or _ ( " off " )
end ,
2019-05-01 20:18:50 +00:00
} ,
2023-09-08 05:41:44 +00:00
{ -- ReaderFont
2019-05-01 20:18:50 +00:00
name = " line_spacing " ,
2020-11-29 09:18:59 +00:00
name_text = _ ( " Line Spacing " ) ,
2019-05-01 20:18:50 +00:00
buttonprogress = true ,
values = {
2022-09-27 23:10:50 +00:00
G_defaults : readSetting ( " DCREREADER_CONFIG_LINE_SPACE_PERCENT_X_TINY " ) ,
G_defaults : readSetting ( " DCREREADER_CONFIG_LINE_SPACE_PERCENT_TINY " ) ,
G_defaults : readSetting ( " DCREREADER_CONFIG_LINE_SPACE_PERCENT_XX_SMALL " ) ,
G_defaults : readSetting ( " DCREREADER_CONFIG_LINE_SPACE_PERCENT_X_SMALL " ) ,
G_defaults : readSetting ( " DCREREADER_CONFIG_LINE_SPACE_PERCENT_SMALL " ) ,
G_defaults : readSetting ( " DCREREADER_CONFIG_LINE_SPACE_PERCENT_L_SMALL " ) ,
G_defaults : readSetting ( " DCREREADER_CONFIG_LINE_SPACE_PERCENT_MEDIUM " ) ,
G_defaults : readSetting ( " DCREREADER_CONFIG_LINE_SPACE_PERCENT_L_MEDIUM " ) ,
G_defaults : readSetting ( " DCREREADER_CONFIG_LINE_SPACE_PERCENT_XL_MEDIUM " ) ,
G_defaults : readSetting ( " DCREREADER_CONFIG_LINE_SPACE_PERCENT_XXL_MEDIUM " ) ,
G_defaults : readSetting ( " DCREREADER_CONFIG_LINE_SPACE_PERCENT_LARGE " ) ,
G_defaults : readSetting ( " DCREREADER_CONFIG_LINE_SPACE_PERCENT_X_LARGE " ) ,
G_defaults : readSetting ( " DCREREADER_CONFIG_LINE_SPACE_PERCENT_XX_LARGE " ) ,
2019-05-01 20:18:50 +00:00
} ,
default_pos = 7 ,
2022-09-27 23:10:50 +00:00
default_value = G_defaults : readSetting ( " DCREREADER_CONFIG_LINE_SPACE_PERCENT_MEDIUM " ) ,
2019-09-14 14:30:25 +00:00
more_options = true ,
more_options_param = {
2020-05-07 18:24:12 +00:00
value_min = 50 ,
2023-04-13 18:43:04 +00:00
value_max = 200 ,
2019-09-14 14:30:25 +00:00
value_step = 1 ,
value_hold_step = 5 ,
2022-06-04 07:35:33 +00:00
unit = " % " ,
2019-09-14 14:30:25 +00:00
} ,
2019-05-01 20:18:50 +00:00
event = " SetLineSpace " ,
args = {
2022-09-27 23:10:50 +00:00
G_defaults : readSetting ( " DCREREADER_CONFIG_LINE_SPACE_PERCENT_X_TINY " ) ,
G_defaults : readSetting ( " DCREREADER_CONFIG_LINE_SPACE_PERCENT_TINY " ) ,
G_defaults : readSetting ( " DCREREADER_CONFIG_LINE_SPACE_PERCENT_XX_SMALL " ) ,
G_defaults : readSetting ( " DCREREADER_CONFIG_LINE_SPACE_PERCENT_X_SMALL " ) ,
G_defaults : readSetting ( " DCREREADER_CONFIG_LINE_SPACE_PERCENT_SMALL " ) ,
G_defaults : readSetting ( " DCREREADER_CONFIG_LINE_SPACE_PERCENT_L_SMALL " ) ,
G_defaults : readSetting ( " DCREREADER_CONFIG_LINE_SPACE_PERCENT_MEDIUM " ) ,
G_defaults : readSetting ( " DCREREADER_CONFIG_LINE_SPACE_PERCENT_L_MEDIUM " ) ,
G_defaults : readSetting ( " DCREREADER_CONFIG_LINE_SPACE_PERCENT_XL_MEDIUM " ) ,
G_defaults : readSetting ( " DCREREADER_CONFIG_LINE_SPACE_PERCENT_XXL_MEDIUM " ) ,
G_defaults : readSetting ( " DCREREADER_CONFIG_LINE_SPACE_PERCENT_LARGE " ) ,
G_defaults : readSetting ( " DCREREADER_CONFIG_LINE_SPACE_PERCENT_X_LARGE " ) ,
G_defaults : readSetting ( " DCREREADER_CONFIG_LINE_SPACE_PERCENT_XX_LARGE " ) ,
2019-05-01 20:18:50 +00:00
} ,
name_text_hold_callback = optionsutil.showValues ,
2019-11-28 21:39:06 +00:00
show_true_value_func = function ( val ) -- add "%"
2023-08-01 08:09:29 +00:00
return string.format ( " %d \u{202F} %% " , val ) -- use Narrow No-Break space here
2019-11-28 21:39:06 +00:00
end ,
2014-03-13 13:52:43 +00:00
} ,
}
} ,
{
2020-12-19 11:18:30 +00:00
icon = " appbar.textsize " ,
2014-03-13 13:52:43 +00:00
options = {
2023-09-08 05:41:44 +00:00
{ -- ReaderFont
2014-03-13 13:52:43 +00:00
name = " font_size " ,
2021-07-05 10:38:24 +00:00
alt_name_text = _ ( " Font Size " ) ,
2022-09-27 23:10:50 +00:00
item_text = tableOfNumbersToTableOfStrings ( G_defaults : readSetting ( " DCREREADER_CONFIG_FONT_SIZES " ) ) ,
2014-03-13 13:52:43 +00:00
item_align_center = 1.0 ,
spacing = 15 ,
2022-09-27 23:10:50 +00:00
item_font_size = G_defaults : readSetting ( " DCREREADER_CONFIG_FONT_SIZES " ) ,
values = G_defaults : readSetting ( " DCREREADER_CONFIG_FONT_SIZES " ) ,
default_value = G_defaults : readSetting ( " DCREREADER_CONFIG_DEFAULT_FONT_SIZE " ) ,
args = G_defaults : readSetting ( " DCREREADER_CONFIG_FONT_SIZES " ) ,
2014-03-13 13:52:43 +00:00
event = " SetFontSize " ,
} ,
2023-09-08 05:41:44 +00:00
{ -- ReaderFont
2014-03-13 13:52:43 +00:00
name = " font_fine_tune " ,
2020-11-29 09:18:59 +00:00
name_text = _ ( " Font Size " ) ,
toggle = Device : isTouchDevice ( ) and { _ ( " decrease " ) , _ ( " increase " ) } or nil ,
item_text = not Device : isTouchDevice ( ) and { _ ( " decrease " ) , _ ( " increase " ) } or nil ,
2019-09-27 10:58:40 +00:00
more_options = true ,
more_options_param = {
2023-04-04 05:11:02 +00:00
value_min = 12 ,
2019-09-27 10:58:40 +00:00
value_max = 255 ,
value_step = 0.5 ,
precision = " %.1f " ,
value_hold_step = 4 ,
name = " font_size " ,
name_text = _ ( " Font Size " ) ,
event = " SetFontSize " ,
} ,
values = { } ,
2014-03-13 13:52:43 +00:00
event = " ChangeSize " ,
2021-05-20 21:14:11 +00:00
args = { - 0.5 , 0.5 } ,
2014-03-13 13:52:43 +00:00
alternate = false ,
2018-05-26 17:45:37 +00:00
name_text_hold_callback = function ( configurable , __ , prefix )
2018-05-18 22:16:02 +00:00
local opt = {
name = " font_size " ,
name_text = _ ( " Font Size " ) ,
}
2022-07-05 13:38:59 +00:00
optionsutil.showValues ( configurable , opt , prefix , nil , " pt " )
2018-05-26 17:45:37 +00:00
end ,
2020-05-03 16:06:58 +00:00
} ,
2023-09-08 05:41:44 +00:00
{ -- ReaderFont
2020-05-03 16:06:58 +00:00
name = " word_spacing " ,
2020-11-29 09:18:59 +00:00
name_text = _ ( " Word Spacing " ) ,
2020-05-09 11:16:12 +00:00
more_options = true ,
more_options_param = {
name = " word_spacing " ,
name_text = _ ( " Word spacing " ) ,
info_text = _ ( [ [ Set word spacing percentages :
- how much to scale the width of each space character from its regular width ,
- by how much some of them can then be reduced to make more words fit on a line . ] ] ) ,
2022-06-04 07:35:33 +00:00
left_text = _ ( " Scaling " ) ,
2020-05-09 11:16:12 +00:00
left_min = 10 ,
left_max = 500 ,
left_step = 1 ,
left_hold_step = 10 ,
2022-06-04 07:35:33 +00:00
right_text = _ ( " Reduction " ) ,
2020-05-09 11:16:12 +00:00
right_min = 25 ,
right_max = 100 ,
right_step = 1 ,
right_hold_step = 10 ,
2022-06-04 07:35:33 +00:00
unit = " % " ,
2020-05-09 11:16:12 +00:00
event = " SetWordSpacing " ,
} ,
2021-11-28 21:49:22 +00:00
toggle = { C_ ( " Word spacing " , " small " ) , C_ ( " Word spacing " , " medium " ) , C_ ( " Word spacing " , " large " ) } ,
2020-05-03 16:06:58 +00:00
values = {
2022-09-27 23:10:50 +00:00
G_defaults : readSetting ( " DCREREADER_CONFIG_WORD_SPACING_SMALL " ) ,
G_defaults : readSetting ( " DCREREADER_CONFIG_WORD_SPACING_MEDIUM " ) ,
G_defaults : readSetting ( " DCREREADER_CONFIG_WORD_SPACING_LARGE " ) ,
2020-05-03 16:06:58 +00:00
} ,
2022-09-27 23:10:50 +00:00
default_value = G_defaults : readSetting ( " DCREREADER_CONFIG_WORD_SPACING_MEDIUM " ) ,
2020-05-03 16:06:58 +00:00
args = {
2022-09-27 23:10:50 +00:00
G_defaults : readSetting ( " DCREREADER_CONFIG_WORD_SPACING_SMALL " ) ,
G_defaults : readSetting ( " DCREREADER_CONFIG_WORD_SPACING_MEDIUM " ) ,
G_defaults : readSetting ( " DCREREADER_CONFIG_WORD_SPACING_LARGE " ) ,
2020-05-03 16:06:58 +00:00
} ,
event = " SetWordSpacing " ,
2020-05-09 11:16:12 +00:00
help_text = _ ( [[Tells the rendering engine by how much to scale the width of each 'space' character in the text from its regular width, and by how much it can additionally reduce them to make more words fit on a line (100% means no reduction).]] ) ,
2020-05-03 16:06:58 +00:00
name_text_hold_callback = optionsutil.showValues ,
name_text_true_values = true ,
show_true_value_func = function ( val )
2023-08-01 08:09:29 +00:00
return string.format ( " %d \u{202F} %%, %d \u{202F} %% " , val [ 1 ] , val [ 2 ] ) -- use Narrow Now-Break space here
2020-05-03 16:06:58 +00:00
end ,
} ,
2023-09-08 05:41:44 +00:00
{ -- ReaderFont
2020-05-03 16:06:58 +00:00
name = " word_expansion " ,
2020-11-29 09:18:59 +00:00
name_text = _ ( " Word Expansion " ) ,
2020-05-03 16:06:58 +00:00
more_options = true ,
more_options_param = {
value_min = 0 ,
value_max = 20 ,
value_step = 1 ,
value_hold_step = 4 ,
2022-06-04 07:35:33 +00:00
unit = " % " ,
2020-05-03 16:06:58 +00:00
name = " word_expansion " ,
2020-05-09 11:16:12 +00:00
name_text = _ ( " Max word expansion " ) ,
2022-06-04 07:35:33 +00:00
info_text = _ ( [[Set max word expansion as a percentage of the font size.]] ) ,
2020-05-03 16:06:58 +00:00
event = " SetWordExpansion " ,
2022-06-05 10:36:33 +00:00
other_button = { -- allow fine tuning the hidden cjk_width_scaling option (defined below)
text = _ ( " CJK scaling " ) ,
other_option = " cjk_width_scaling " ,
}
2020-05-03 16:06:58 +00:00
} ,
2021-11-28 21:49:22 +00:00
toggle = { C_ ( " Word expansion " , " none " ) , C_ ( " Word expansion " , " some " ) , C_ ( " Word expansion " , " more " ) } ,
2020-05-03 16:06:58 +00:00
values = {
2022-09-27 23:10:50 +00:00
G_defaults : readSetting ( " DCREREADER_CONFIG_WORD_EXPANSION_NONE " ) ,
G_defaults : readSetting ( " DCREREADER_CONFIG_WORD_EXPANSION_SOME " ) ,
G_defaults : readSetting ( " DCREREADER_CONFIG_WORD_EXPANSION_MORE " ) ,
2020-05-03 16:06:58 +00:00
} ,
2022-09-27 23:10:50 +00:00
default_value = G_defaults : readSetting ( " DCREREADER_CONFIG_WORD_EXPANSION_NONE " ) ,
2020-05-03 16:06:58 +00:00
args = {
2022-09-27 23:10:50 +00:00
G_defaults : readSetting ( " DCREREADER_CONFIG_WORD_EXPANSION_NONE " ) ,
G_defaults : readSetting ( " DCREREADER_CONFIG_WORD_EXPANSION_SOME " ) ,
G_defaults : readSetting ( " DCREREADER_CONFIG_WORD_EXPANSION_MORE " ) ,
2020-05-03 16:06:58 +00:00
} ,
event = " SetWordExpansion " ,
help_text = _ ( [[On justified lines having too wide spaces, allow distributing the excessive space into words by expanding them with letter spacing. This sets the max allowed letter spacing as a % of the font size.]] ) ,
name_text_hold_callback = optionsutil.showValues ,
name_text_true_values = true ,
show_true_value_func = function ( val )
2023-08-01 08:09:29 +00:00
return string.format ( " %d \u{202F} %% " , val ) -- use Narrow No-Break space here
2020-05-03 16:06:58 +00:00
end ,
} ,
2023-09-08 05:41:44 +00:00
{ -- ReaderFont
2022-06-05 10:36:33 +00:00
-- 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.
-- We still need to define it as an option here for it to be known and
-- handled as any other one - we just make it hidden.
show = false ,
name = " cjk_width_scaling " ,
default_value = 100 ,
values = { 100 , 105 , 110 } , -- (not shown)
event = " SetCJKWidthScaling " ,
more_options = true ,
more_options_param = {
value_min = 100 ,
value_max = 150 ,
value_step = 1 ,
value_hold_step = 5 ,
unit = " % " ,
name = " cjk_width_scaling " ,
name_text = _ ( " CJK width scaling " ) ,
info_text = _ ( [[Increase the width of all CJK (Chinese, Japanese, Korean) chararacters by this percentage. This has the effect of adding space between these glyphs, and might make them easier to distinguish to some readers.]] ) ,
event = " SetCJKWidthScaling " ,
other_button = {
text = _ ( " Word expansion " ) ,
other_option = " word_expansion " ,
}
} ,
} ,
2014-03-13 13:52:43 +00:00
}
} ,
{
2020-12-19 11:18:30 +00:00
icon = " appbar.contrast " ,
2014-03-13 13:52:43 +00:00
options = {
2023-09-08 05:41:44 +00:00
{ -- ReaderFont
2014-03-13 13:52:43 +00:00
name = " font_gamma " ,
2020-11-29 09:18:59 +00:00
name_text = _ ( " Contrast " ) ,
2018-03-11 13:54:17 +00:00
buttonprogress = true ,
default_value = 15 , -- gamma = 1.0
default_pos = 2 ,
values = { 10 , 15 , 25 , 30 , 36 , 43 , 49 , 56 } ,
2014-08-17 13:45:48 +00:00
event = " SetFontGamma " ,
2018-03-11 13:54:17 +00:00
args = { 10 , 15 , 25 , 30 , 36 , 43 , 49 , 56 } ,
-- gamma values for these indexes are:
labels = { 0.8 , 1.0 , 1.45 , 1.90 , 2.50 , 4.0 , 8.0 , 15.0 } ,
2018-05-26 17:45:37 +00:00
name_text_hold_callback = optionsutil.showValues ,
2019-09-23 22:24:45 +00:00
more_options = true ,
more_options_param = {
2022-09-25 12:37:22 +00:00
-- Values table taken from crengine/crengine/Tools/GammaGen/gammagen.cpp.
-- crengine counts the index of the table starting from 0.
-- Index is stored in the settings and passed to crengine as-is.
-- ConfigDialog adds value_table_shift to the index to display the value from the table.
2019-09-23 22:24:45 +00:00
value_table = { 0.3 , 0.35 , 0.4 , 0.45 , 0.5 , 0.55 , 0.6 , 0.65 , 0.7 , 0.75 , 0.8 , 0.85 , 0.9 ,
0.95 , 0.98 , 1 , 1.02 , 1.05 , 1.1 , 1.15 , 1.2 , 1.25 , 1.3 , 1.35 , 1.4 , 1.45 ,
1.5 , 1.6 , 1.7 , 1.8 , 1.9 , 2 , 2.1 , 2.2 , 2.3 , 2.4 , 2.5 , 2.6 , 2.7 , 2.8 , 2.9 ,
2022-09-08 19:52:06 +00:00
3 , 3.5 , 4 , 4.5 , 5 , 5.5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 , 14 , 15 } ,
2022-09-25 12:37:22 +00:00
value_table_shift = 1 ,
2019-09-23 22:24:45 +00:00
} ,
2017-09-08 15:38:51 +00:00
} ,
2023-09-08 05:41:44 +00:00
{ -- ReaderFont
2021-04-28 23:37:53 +00:00
name = " font_base_weight " ,
name_text = _ ( " Font Weight " ) ,
toggle = { " -1 " , " -½ " , " 0 " , " +½ " , " +1 " , " +1½ " , " +3 " } ,
values = { - 1 , - 0.5 , 0 , 0.5 , 1 , 1.5 , 3 } ,
args = { - 1 , - 0.5 , 0 , 0.5 , 1 , 1.5 , 3 } ,
default_value = 0 ,
event = " SetFontBaseWeight " ,
more_options = true ,
more_options_param = {
value_min = - 3 ,
value_max = 5.5 ,
value_step = 0.25 ,
precision = " %+.2f " ,
value_hold_step = 1 ,
} ,
help_text = _ ( [ [ Set the font weight delta from " regular " to apply to all fonts .
2021-04-29 18:16:30 +00:00
- 0 will use the " Regular (400) " variation of a font .
- + 1 will use the " Medium (500) " variation of a font if available .
- + 3 will use the " Bold (700) " variation of a font if available .
2021-04-29 17:45:12 +00:00
If a font variation is not available , as well as for fractional adjustments , it will be synthesized from the nearest available weight . ] ] ) ,
2021-04-28 23:37:53 +00:00
help_text_func = function ( configurable , document )
2022-09-27 23:10:50 +00:00
local cre = require ( " document/credocument " ) : engineInit ( )
2021-04-28 23:37:53 +00:00
local font_face = document : getFontFace ( )
2021-04-29 18:16:30 +00:00
local available_weights = prettifyCreWeights ( cre.getFontFaceAvailableWeights ( font_face ) )
return T ( _ ( " The default font '%1' provides the following weight classes: %2. " ) , font_face , table.concat ( available_weights , C_ ( " List separator " , " , " ) ) )
2021-04-28 23:37:53 +00:00
end ,
name_text_hold_callback = optionsutil.showValues ,
name_text_true_values = true ,
show_true_value_func = function ( val )
2021-04-29 18:16:30 +00:00
return weightClassToString ( 400 + val * 100 )
2021-04-28 23:37:53 +00:00
end ,
} ,
2023-09-08 05:41:44 +00:00
{ -- ReaderFont
2017-09-08 15:38:51 +00:00
name = " font_hinting " ,
2020-11-29 09:18:59 +00:00
name_text = _ ( " Font Hinting " ) ,
2021-11-28 21:49:22 +00:00
toggle = { C_ ( " Font hinting " , " off " ) , C_ ( " Font hinting " , " native " ) , C_ ( " Font hinting " , " auto " ) } ,
2017-09-08 15:38:51 +00:00
values = { 0 , 1 , 2 } ,
default_value = 2 ,
args = { 0 , 1 , 2 } ,
event = " SetFontHinting " ,
2018-05-26 17:45:37 +00:00
name_text_hold_callback = optionsutil.showValues ,
2018-07-04 10:08:55 +00:00
help_text = _ ( [ [ Font hinting is the process by which fonts are adjusted for maximum readability on the screen ' s pixel grid.
- off : no hinting .
- native : use the font internal hinting instructions .
- auto : use FreeType ' s hinting algorithm, ignoring font instructions.]]),
2018-08-17 21:08:21 +00:00
} ,
2023-09-08 05:41:44 +00:00
{ -- ReaderFont
2018-08-17 21:08:21 +00:00
name = " font_kerning " ,
2020-11-29 09:18:59 +00:00
name_text = _ ( " Font Kerning " ) ,
toggle = { _ ( " off " ) , _ ( " fast " ) , _ ( " good " ) , _ ( " best " ) } ,
2019-01-15 19:40:35 +00:00
values = { 0 , 1 , 2 , 3 } ,
2019-11-01 22:07:41 +00:00
default_value = 3 ,
2019-01-15 19:40:35 +00:00
args = { 0 , 1 , 2 , 3 } ,
2018-08-17 21:08:21 +00:00
event = " SetFontKerning " ,
name_text_hold_callback = optionsutil.showValues ,
help_text = _ ( [ [ Font kerning is the process of adjusting the spacing between individual letter forms , to achieve a visually pleasing result .
- off : no kerning .
- fast : use FreeType ' s kerning implementation (no ligatures).
2021-08-28 07:10:20 +00:00
- good : use HarfBuzz ' s light kerning implementation (faster than best but no ligatures and limited support for non-western scripts)
2019-11-01 22:07:41 +00:00
- best : use HarfBuzz ' s full kerning implementation (slower, but may support ligatures with some fonts; also needed to properly display joined arabic glyphs and some other scripts).
2018-08-17 21:08:21 +00:00
( Font Hinting may need to be adjusted for the best result with either kerning implementation . ) ] ] ) ,
2018-06-30 14:55:43 +00:00
} ,
2014-03-13 13:52:43 +00:00
}
} ,
{
2020-12-19 11:18:30 +00:00
icon = " appbar.settings " ,
2014-03-13 13:52:43 +00:00
options = {
2023-09-08 05:41:44 +00:00
{ -- ReaderRolling
2014-03-13 13:52:43 +00:00
name = " status_line " ,
2020-11-29 09:18:59 +00:00
name_text = _ ( " Alt Status Bar " ) ,
toggle = { _ ( " off " ) , _ ( " on " ) } ,
2021-01-29 17:39:06 +00:00
values = { 1 , 0 } , -- Note that 0 means crengine header status line enabled, and 1 means disabled
default_value = 1 ,
2020-05-07 18:24:12 +00:00
args = { 1 , 0 } ,
2014-03-13 13:52:43 +00:00
event = " SetStatusLine " ,
2018-05-26 17:45:37 +00:00
name_text_hold_callback = optionsutil.showValues ,
2021-01-29 17:39:06 +00:00
help_text = _ ( [ [ Enable or disable the rendering engine alternative status bar at the top of the screen . The items displayed can be customized via the main menu .
2020-05-07 18:24:12 +00:00
2021-01-29 17:39:06 +00:00
Whether enabled or disabled , KOReader ' s own status bar at the bottom of the screen can be toggled by tapping.]]),
2014-03-13 13:52:43 +00:00
} ,
2023-09-08 05:41:44 +00:00
{ -- ReaderTypeset
2014-03-13 13:52:43 +00:00
name = " embedded_css " ,
2020-11-29 09:18:59 +00:00
name_text = _ ( " Embedded Style " ) ,
toggle = { _ ( " off " ) , _ ( " on " ) } ,
2020-05-07 18:24:12 +00:00
values = { 0 , 1 } ,
2014-03-13 13:52:43 +00:00
default_value = 1 ,
2020-05-07 18:24:12 +00:00
args = { false , true } ,
2014-03-13 13:52:43 +00:00
event = " ToggleEmbeddedStyleSheet " ,
2018-05-26 17:45:37 +00:00
name_text_hold_callback = optionsutil.showValues ,
2018-07-04 10:08:55 +00:00
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 . ) ] ] ) ,
2014-03-13 13:52:43 +00:00
} ,
2023-09-08 05:41:44 +00:00
{ -- ReaderTypeset
2017-08-30 07:04:04 +00:00
name = " embedded_fonts " ,
2020-11-29 09:18:59 +00:00
name_text = _ ( " Embedded Fonts " ) ,
toggle = { _ ( " off " ) , _ ( " on " ) } ,
2020-05-07 18:24:12 +00:00
values = { 0 , 1 } ,
2017-08-30 07:04:04 +00:00
default_value = 1 ,
2020-05-07 18:24:12 +00:00
args = { false , true } ,
2017-08-30 07:04:04 +00:00
event = " ToggleEmbeddedFonts " ,
2022-06-11 09:08:42 +00:00
enabled_func = function ( configurable , document )
2018-05-26 17:45:37 +00:00
return optionsutil.enableIfEquals ( configurable , " embedded_css " , 1 )
2022-06-11 09:08:42 +00:00
and next ( document : getEmbeddedFontList ( ) ) ~= nil
2017-08-30 07:04:04 +00:00
end ,
2018-05-26 17:45:37 +00:00
name_text_hold_callback = optionsutil.showValues ,
2018-07-04 10:08:55 +00:00
help_text = _ ( [ [ Enable or disable the use of the fonts embedded in the book .
( Disabling the fonts specified in the publisher stylesheets can also be achieved via Style Tweaks in the main menu . ) ] ] ) ,
2022-06-11 09:08:42 +00:00
help_text_func = function ( configurable , document )
local font_list = document : getEmbeddedFontList ( )
if next ( font_list ) then
local font_details = { }
table.insert ( font_details , _ ( " Embedded fonts provided by the current book: " ) )
for name in ffiUtil.orderedPairs ( font_list ) do
table.insert ( font_details , name .. ( font_list [ name ] and " " or T ( " (%1) " , _ ( " not used " ) ) ) )
end
return table.concat ( font_details , " \n " )
end
end ,
2017-08-30 07:04:04 +00:00
} ,
2023-09-08 05:41:44 +00:00
{ -- ReaderTypeset
2019-04-18 21:26:53 +00:00
name = " smooth_scaling " ,
2020-11-29 09:18:59 +00:00
name_text = _ ( " Image Scaling " ) ,
toggle = { _ ( " fast " ) , _ ( " best " ) } ,
2019-04-18 21:26:53 +00:00
values = { 0 , 1 } ,
default_value = 0 ,
args = { false , true } ,
event = " ToggleImageScaling " ,
name_text_hold_callback = optionsutil.showValues ,
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 . ] ] ) ,
} ,
2023-09-08 05:41:44 +00:00
{ -- ReaderTypeset
2019-06-25 22:23:41 +00:00
name = " nightmode_images " ,
2020-11-29 09:18:59 +00:00
name_text = _ ( " Invert Images " ) ,
toggle = { _ ( " on " ) , _ ( " off " ) } ,
2019-06-25 22:23:41 +00:00
values = { 1 , 0 } ,
default_value = 1 ,
args = { true , false } ,
event = " ToggleNightmodeImages " ,
2021-03-29 03:12:22 +00:00
show_func = function ( ) return Screen.night_mode end ,
2019-06-25 22:23:41 +00:00
name_text_hold_callback = optionsutil.showValues ,
help_text = _ ( [[Disable the automagic inversion of images when nightmode is enabled. Useful if your book contains mainly inlined mathematical content or scene break art.]] ) ,
} ,
2014-03-13 13:52:43 +00:00
} ,
} ,
2013-04-08 14:26:54 +00:00
}
2013-10-18 20:38:07 +00:00
return CreOptions