mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user