add FONTDIR env variable

to support custom font directory for EPUB documents

Now Koreader could find fonts in the "fonts" directory in the USB root
directory of kindle, Kobo and PocketBook devices, thus no need to copy
fonts to "koreader/fonts" directory.
This commit is contained in:
chrox
2015-01-25 16:52:01 +08:00
parent dfa30f5524
commit 077517be0b
5 changed files with 21 additions and 8 deletions

View File

@@ -58,8 +58,8 @@ function CreDocument:engineInit()
-- we need to initialize the CRE font list
local fonts = Font:getFontList()
for _k, _v in ipairs(fonts) do
if _v:sub(1, 4) ~= "urw/" then
local ok, err = pcall(cre.registerFont, Font.fontdir..'/'.._v)
if not _v:find("/urw/") then
local ok, err = pcall(cre.registerFont, _v)
if not ok then
DEBUG(err)
end