mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
configurable default font for CREngine
when in CREngine mode, the current font can be made the default document font by pressing Shift-F in order to store this setting, the reader_settings variable was promoted to the declared global G_reader_settings close #184
This commit is contained in:
@@ -9,6 +9,7 @@ CREReader = UniReader:new{
|
||||
|
||||
gamma_index = 15,
|
||||
font_face = nil,
|
||||
default_font = "Droid Sans",
|
||||
font_zoom = 0,
|
||||
|
||||
line_space_percent = 100,
|
||||
@@ -31,6 +32,11 @@ function CREReader:init()
|
||||
debug(err)
|
||||
end
|
||||
end
|
||||
|
||||
local default_font = G_reader_settings:readSetting("cre_font")
|
||||
if default_font then
|
||||
self.default_font = default_font
|
||||
end
|
||||
end
|
||||
-- NuPogodi, 20.05.12: inspect the zipfile content
|
||||
function CREReader:ZipContentExt(fname)
|
||||
@@ -79,7 +85,10 @@ end
|
||||
----------------------------------------------------
|
||||
function CREReader:loadSpecialSettings()
|
||||
local font_face = self.settings:readSetting("font_face")
|
||||
self.font_face = font_face or "Droid Sans"
|
||||
if not font_face then
|
||||
font_face = self.default_font
|
||||
end
|
||||
self.font_face = font_face
|
||||
self.doc:setFontFace(self.font_face)
|
||||
|
||||
local gamma_index = self.settings:readSetting("gamma_index")
|
||||
@@ -456,6 +465,13 @@ function CREReader:adjustCreReaderCommands()
|
||||
self:fillToc()
|
||||
end
|
||||
)
|
||||
self.commands:add(KEY_F, MOD_SHIFT, "F",
|
||||
"use document font as default font",
|
||||
function(self)
|
||||
G_reader_settings:saveSetting("cre_font", self.font_face)
|
||||
showInfoMsgWithDelay("Default document font set", 2000, 1)
|
||||
end
|
||||
)
|
||||
self.commands:add(KEY_F, MOD_ALT, "F",
|
||||
"Toggle font bolder attribute",
|
||||
function(self)
|
||||
|
||||
Reference in New Issue
Block a user