mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
save and restore gamma_index for crengine
This commit is contained in:
@@ -277,6 +277,10 @@ function CreDocument:toggleFontBolder()
|
||||
self._document:toggleFontBolder()
|
||||
end
|
||||
|
||||
function CreDocument:setGammaIndex(index)
|
||||
cre.setGammaIndex(index)
|
||||
end
|
||||
|
||||
DocumentRegistry:addProvider("txt", "application/txt", CreDocument)
|
||||
DocumentRegistry:addProvider("epub", "application/epub", CreDocument)
|
||||
DocumentRegistry:addProvider("html", "application/html", CreDocument)
|
||||
|
||||
@@ -5,7 +5,7 @@ ReaderFont = InputContainer:new{
|
||||
font_menu_title = "Font Menu",
|
||||
face_table = nil,
|
||||
-- default gamma from crengine's lvfntman.cpp
|
||||
gamma_index = 15,
|
||||
gamma_index = nil,
|
||||
}
|
||||
|
||||
function ReaderFont:init()
|
||||
@@ -77,6 +77,12 @@ function ReaderFont:onReadSettings(config)
|
||||
self.ui.document:setInterlineSpacePercent(self.line_space_percent)
|
||||
end
|
||||
|
||||
self.gamma_index = config:readSetting("gamma_index")
|
||||
if not self.gamma_index then
|
||||
self.gamma_index = 15
|
||||
end
|
||||
self.ui.document:setGammaIndex(self.gamma_index)
|
||||
|
||||
-- Dirty hack: we have to add folloing call in order to set
|
||||
-- m_is_rendered(member of LVDocView) to true. Otherwise position inside
|
||||
-- document will be reset to 0 on first view render.
|
||||
@@ -187,11 +193,11 @@ function ReaderFont:onChangeFontGamma(direction)
|
||||
end
|
||||
|
||||
function ReaderFont:onCloseDocument()
|
||||
--@TODO save gamma index (houqp)
|
||||
self.ui.doc_settings:saveSetting("font_face", self.font_face)
|
||||
self.ui.doc_settings:saveSetting("header_font_face", self.header_font_face)
|
||||
self.ui.doc_settings:saveSetting("font_size", self.font_size)
|
||||
self.ui.doc_settings:saveSetting("line_space_percent", self.line_space_percent)
|
||||
self.ui.doc_settings:saveSetting("gamma_index", self.gamma_index)
|
||||
end
|
||||
|
||||
function ReaderFont:setFont(face)
|
||||
|
||||
Reference in New Issue
Block a user