2
0
mirror of https://github.com/koreader/koreader synced 2024-11-04 12:00:25 +00:00

Reader: do not apply font size out of range (#10295)

This commit is contained in:
hius07 2023-04-04 08:11:02 +03:00 committed by GitHub
parent 14de514ae8
commit b01e1c5918
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 3 deletions

View File

@ -69,6 +69,9 @@ function ReaderCoptListener:onReadSettings(config)
end
function ReaderCoptListener:onConfigChange(option_name, option_value)
-- font_size is historically and sadly shared by both mupdf and cre reader modules,
-- but fortunately they can be distinguished by their different ranges
if option_name == "font_size" and option_value < 5 then return end
self.document.configurable[option_name] = option_value
self.ui:handleEvent(Event:new("StartActivityIndicator"))
return true

View File

@ -72,6 +72,9 @@ function ReaderKoptListener:onDocLangUpdate(lang)
end
function ReaderKoptListener:onConfigChange(option_name, option_value)
-- font_size is historically and sadly shared by both mupdf and cre reader modules,
-- but fortunately they can be distinguished by their different ranges
if option_name == "font_size" and option_value > 5 then return end
self.document.configurable[option_name] = option_value
self.ui:handleEvent(Event:new("StartActivityIndicator"))
UIManager:setDirty("all", "partial")

View File

@ -1023,8 +1023,10 @@ function ReaderView:onSWDitheringUpdate(toggle)
end
function ReaderView:onFontSizeUpdate(font_size)
self.ui:handleEvent(Event:new("ReZoom", font_size))
Notification:notify(T(_("Font zoom set to: %1."), font_size))
if self.ui.paging then
self.ui:handleEvent(Event:new("ReZoom", font_size))
Notification:notify(T(_("Font zoom set to: %1."), font_size))
end
end
function ReaderView:onDefectSizeUpdate()

View File

@ -437,7 +437,7 @@ Note that your selected font size is not affected by this setting.]]),
item_text = not Device:isTouchDevice() and {_("decrease"), _("increase")} or nil,
more_options = true,
more_options_param = {
value_min = 7,
value_min = 12,
value_max = 255,
value_step = 0.5,
precision = "%.1f",