|
|
@ -11,8 +11,9 @@ CreDocument = Document:new{
|
|
|
|
engine_initilized = false,
|
|
|
|
engine_initilized = false,
|
|
|
|
|
|
|
|
|
|
|
|
line_space_percent = 100,
|
|
|
|
line_space_percent = 100,
|
|
|
|
default_font = "Droid Sans Fallback",
|
|
|
|
default_font = "FreeSerif",
|
|
|
|
header_font = "Droid Sans Fallback",
|
|
|
|
header_font = "FreeSans",
|
|
|
|
|
|
|
|
fallback_font = "Droid Sans Fallback",
|
|
|
|
default_css = "./data/cr3.css",
|
|
|
|
default_css = "./data/cr3.css",
|
|
|
|
options = CreOptions,
|
|
|
|
options = CreOptions,
|
|
|
|
configurable = Configurable,
|
|
|
|
configurable = Configurable,
|
|
|
@ -89,14 +90,17 @@ function CreDocument:init()
|
|
|
|
ok, self._document = pcall(cre.newDocView,
|
|
|
|
ok, self._document = pcall(cre.newDocView,
|
|
|
|
Screen:getWidth(), Screen:getHeight(), self.PAGE_VIEW_MODE
|
|
|
|
Screen:getWidth(), Screen:getHeight(), self.PAGE_VIEW_MODE
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
-- adjust font sizes according to screen dpi
|
|
|
|
|
|
|
|
self._document:adjustFontSizes(Screen:getDPI())
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if not ok then
|
|
|
|
if not ok then
|
|
|
|
self.error_message = self.doc -- will contain error message
|
|
|
|
self.error_message = self.doc -- will contain error message
|
|
|
|
return
|
|
|
|
return
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- adjust font sizes according to screen dpi
|
|
|
|
|
|
|
|
self._document:adjustFontSizes(Screen:getDPI())
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- set fallback font face
|
|
|
|
|
|
|
|
self._document:setStringProperty("crengine.font.fallback.face", self.fallback_font)
|
|
|
|
|
|
|
|
|
|
|
|
self.is_open = true
|
|
|
|
self.is_open = true
|
|
|
|
self.info.has_pages = false
|
|
|
|
self.info.has_pages = false
|
|
|
|
self:_readMetadata()
|
|
|
|
self:_readMetadata()
|
|
|
@ -110,6 +114,11 @@ function CreDocument:loadDocument()
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function CreDocument:close()
|
|
|
|
|
|
|
|
self._document:saveDefaults()
|
|
|
|
|
|
|
|
Document.close(self)
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function CreDocument:drawCurrentView(target, x, y, rect, pos)
|
|
|
|
function CreDocument:drawCurrentView(target, x, y, rect, pos)
|
|
|
|
tile_bb = Blitbuffer.new(rect.w, rect.h)
|
|
|
|
tile_bb = Blitbuffer.new(rect.w, rect.h)
|
|
|
|
self._document:drawCurrentPage(tile_bb)
|
|
|
|
self._document:drawCurrentPage(tile_bb)
|
|
|
@ -229,6 +238,10 @@ end
|
|
|
|
|
|
|
|
|
|
|
|
function CreDocument:setPageMargins(left, top, right, bottom)
|
|
|
|
function CreDocument:setPageMargins(left, top, right, bottom)
|
|
|
|
self._document:setPageMargins(left, top, right, bottom)
|
|
|
|
self._document:setPageMargins(left, top, right, bottom)
|
|
|
|
|
|
|
|
self._document:setIntProperty("crengine.page.margin.left", left)
|
|
|
|
|
|
|
|
self._document:setIntProperty("crengine.page.margin.top", top)
|
|
|
|
|
|
|
|
self._document:setIntProperty("crengine.page.margin.right", right)
|
|
|
|
|
|
|
|
self._document:setIntProperty("crengine.page.margin.bottom", bottom)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function CreDocument:setVisiblePageCount(new_count)
|
|
|
|
function CreDocument:setVisiblePageCount(new_count)
|
|
|
|