|
|
@ -1,10 +1,11 @@
|
|
|
|
require "cache"
|
|
|
|
|
|
|
|
require "ui/geometry"
|
|
|
|
require "ui/geometry"
|
|
|
|
|
|
|
|
|
|
|
|
CreDocument = Document:new{
|
|
|
|
CreDocument = Document:new{
|
|
|
|
_document = false,
|
|
|
|
_document = false,
|
|
|
|
|
|
|
|
engine_initilized = false,
|
|
|
|
|
|
|
|
|
|
|
|
line_space_percent = 100,
|
|
|
|
line_space_percent = 100,
|
|
|
|
--dc_null = DrawContext.new()
|
|
|
|
default_font = "Droid Sans Fallback",
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
-- NuPogodi, 20.05.12: inspect the zipfile content
|
|
|
|
-- NuPogodi, 20.05.12: inspect the zipfile content
|
|
|
@ -22,20 +23,28 @@ function CreDocument:zipContentExt(fname)
|
|
|
|
return string.lower(string.match(s, ".+%.([^.]+)"))
|
|
|
|
return string.lower(string.match(s, ".+%.([^.]+)"))
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function CreDocument:init()
|
|
|
|
function CreDocument:engineInit()
|
|
|
|
-- we need to initialize the CRE font list
|
|
|
|
if not engine_initilized then
|
|
|
|
local fonts = Font:getFontList()
|
|
|
|
-- we need to initialize the CRE font list
|
|
|
|
for _k, _v in ipairs(fonts) do
|
|
|
|
local fonts = Font:getFontList()
|
|
|
|
local ok, err = pcall(cre.registerFont, Font.fontdir..'/'.._v)
|
|
|
|
for _k, _v in ipairs(fonts) do
|
|
|
|
if not ok then
|
|
|
|
local ok, err = pcall(cre.registerFont, Font.fontdir..'/'.._v)
|
|
|
|
DEBUG(err)
|
|
|
|
if not ok then
|
|
|
|
|
|
|
|
DEBUG(err)
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
local default_font = G_reader_settings:readSetting("cre_font")
|
|
|
|
|
|
|
|
if default_font then
|
|
|
|
|
|
|
|
self.default_font = default_font
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
engine_initilized = true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
--local default_font = G_reader_settings:readSetting("cre_font")
|
|
|
|
function CreDocument:init()
|
|
|
|
--if default_font then
|
|
|
|
self:engineInit()
|
|
|
|
--self.default_font = default_font
|
|
|
|
|
|
|
|
--end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
local ok
|
|
|
|
local ok
|
|
|
|
local file_type = string.lower(string.match(self.file, ".+%.([^.]+)"))
|
|
|
|
local file_type = string.lower(string.match(self.file, ".+%.([^.]+)"))
|
|
|
|