|
|
@ -1,6 +1,7 @@
|
|
|
|
local lfs = require("libs/libkoreader-lfs")
|
|
|
|
local lfs = require("libs/libkoreader-lfs")
|
|
|
|
local Freetype = require("ffi/freetype")
|
|
|
|
local Freetype = require("ffi/freetype")
|
|
|
|
local Screen = require("device").screen
|
|
|
|
local Screen = require("device").screen
|
|
|
|
|
|
|
|
local Device = require("device")
|
|
|
|
local DEBUG = require("dbg")
|
|
|
|
local DEBUG = require("dbg")
|
|
|
|
|
|
|
|
|
|
|
|
local Font = {
|
|
|
|
local Font = {
|
|
|
@ -94,11 +95,19 @@ function Font:_readList(target, dir)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function Font:_getExternalFontDir()
|
|
|
|
|
|
|
|
if Device:isAndroid() then
|
|
|
|
|
|
|
|
return ANDROID_FONT_DIR
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
return os.getenv("EXT_FONT_DIR")
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function Font:getFontList()
|
|
|
|
function Font:getFontList()
|
|
|
|
local fontlist = {}
|
|
|
|
local fontlist = {}
|
|
|
|
self:_readList(fontlist, self.fontdir)
|
|
|
|
self:_readList(fontlist, self.fontdir)
|
|
|
|
-- multiple path should be joined with semicolon in FONTDIR env variable
|
|
|
|
-- multiple paths should be joined with semicolon
|
|
|
|
for dir in string.gmatch(os.getenv("EXT_FONT_DIR") or "", "([^;]+)") do
|
|
|
|
for dir in string.gmatch(self:_getExternalFontDir() or "", "([^;]+)") do
|
|
|
|
self:_readList(fontlist, dir)
|
|
|
|
self:_readList(fontlist, dir)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
table.sort(fontlist)
|
|
|
|
table.sort(fontlist)
|
|
|
|