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,
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
function ReaderCoptListener:onSetFontSize(font_size)
self.document.configurable.font_size = font_size
end
return ReaderCoptListener

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

Loading…
Cancel
Save