add font size fine tuning for crereader

pull/459/head
chrox 11 years ago
parent 637904a711
commit 83eb90cd47

@ -76,6 +76,15 @@ local CreOptions = {
args = DCREREADER_CONFIG_FONT_SIZES, args = DCREREADER_CONFIG_FONT_SIZES,
event = "SetFontSize", event = "SetFontSize",
}, },
{
name = "font_fine_tune",
name_text = S.FONTSIZE_FINE_TUNING,
toggle = {S.DECREASE, S.INCREASE},
event = "ChangeSize",
args = {"decrease", "increase"},
alternate = false,
height = 60,
}
} }
}, },
{ {

@ -22,4 +22,8 @@ function ReaderCoptListener:onReadSettings(config)
end end
end end
function ReaderCoptListener:onSetFontSize(font_size)
self.document.configurable.font_size = font_size
end
return ReaderCoptListener return ReaderCoptListener

@ -129,32 +129,15 @@ end
UpdatePos event is used to tell ReaderRolling to update pos. UpdatePos event is used to tell ReaderRolling to update pos.
--]] --]]
function ReaderFont:onChangeSize(direction) function ReaderFont:onChangeSize(direction)
local delta = 1 local delta = direction == "decrease" and -1 or 1
local msg = ""
if direction == "decrease" then
delta = -1
msg = _("Decrease font size to ")
else
msg = _("Increase font size to ")
end
self.font_size = self.font_size + delta self.font_size = self.font_size + delta
self.ui:handleEvent(Event:new("SetFontSize", self.font_size))
UIManager:show(Notification:new{
text = msg..self.font_size,
timeout = 1,
})
self.ui.document:zoomFont(delta)
self.ui:handleEvent(Event:new("UpdatePos"))
UIManager:close(msg)
return true return true
end end
function ReaderFont:onSetFontSize(new_size) function ReaderFont:onSetFontSize(new_size)
if new_size > 44 then new_size = 44 end if new_size > 72 then new_size = 72 end
if new_size < 16 then new_size = 16 end if new_size < 12 then new_size = 12 end
self.font_size = new_size self.font_size = new_size
UIManager:show(Notification:new{ UIManager:show(Notification:new{

Loading…
Cancel
Save