mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
bug fix in readerfont
After set font in ReaderFont:onReadSettings, we have to send UpdatePos event 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, this makes the first page of document is always displayed on document open. So far, I don't know why this call will alter the value of m_is_rendered. It just works...
This commit is contained in:
@@ -102,7 +102,7 @@ function CreDocument:getFontFace()
|
||||
end
|
||||
|
||||
function CreDocument:setFontFace(new_font_face)
|
||||
if new_font_face then
|
||||
if new_font_face then
|
||||
self._document:setFontFace(new_font_face)
|
||||
end
|
||||
end
|
||||
@@ -112,7 +112,7 @@ function CreDocument:getFontSize()
|
||||
end
|
||||
|
||||
function CreDocument:setFontSize(new_font_size)
|
||||
if new_font_size then
|
||||
if new_font_size then
|
||||
self._document:setFontSize(new_font_size)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -60,6 +60,11 @@ function ReaderFont:onReadSettings(config)
|
||||
self.font_size = self.ui.document:getFontSize()
|
||||
end
|
||||
self.ui.document:setFontSize(self.font_size)
|
||||
-- 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.
|
||||
-- So far, I don't know why this call will alter the value of m_is_rendered.
|
||||
self.ui:handleEvent(Event:new("UpdatePos"))
|
||||
end
|
||||
|
||||
function ReaderFont:onShowFontMenu()
|
||||
|
||||
Reference in New Issue
Block a user