add font size menu entry

It changes screen DPI and may needs to reboot the reader to take effect.
This should fix #746.
This commit is contained in:
chrox
2014-07-27 21:41:38 +08:00
parent 49ee4f4e4a
commit 87e667748a
9 changed files with 178 additions and 51 deletions

View File

@@ -137,6 +137,7 @@ function Screen:getHeightPhoenix()
end
function Screen:getDPI()
self.dpi = G_reader_settings:readSetting("screen_dpi")
if self.dpi ~= nil then return self.dpi end
local model = self.device:getModel()
if model == "KindlePaperWhite" or model == "KindlePaperWhite2"
@@ -153,11 +154,16 @@ function Screen:getDPI()
local ffi = require("ffi")
self.dpi = ffi.C.AConfiguration_getDensity(android.app.config)
else
self.dpi = 167
self.dpi = 160
end
return self.dpi
end
function Screen:setDPI(dpi)
G_reader_settings:saveSetting("screen_dpi", dpi)
self.dpi = dpi
end
function Screen:scaleByDPI(px)
return math.floor(px * self:getDPI()/167)
end