mirror of
https://github.com/koreader/koreader
synced 2024-11-10 01:10:34 +00:00
Merge pull request #1544 from chrox/android-external-fonts
add external font dir option for Android
This commit is contained in:
commit
63fb8af937
2
base
2
base
@ -1 +1 @@
|
||||
Subproject commit cd68f482e00f26402ea8116ef813df08162a39cb
|
||||
Subproject commit 12ed264734bfad1b34620877cd2753e63436356c
|
@ -186,6 +186,9 @@ NETWORK_PROXY = nil
|
||||
-- Use turbo library to handle async HTTP request
|
||||
DUSE_TURBO_LIB = false
|
||||
|
||||
-- Custom font dir for Android
|
||||
ANDROID_FONT_DIR = "/system/fonts;/sdcard/koreader/fonts"
|
||||
|
||||
-- ####################################################################
|
||||
-- following features are not supported right now
|
||||
-- ####################################################################
|
||||
|
@ -1,6 +1,7 @@
|
||||
local lfs = require("libs/libkoreader-lfs")
|
||||
local Freetype = require("ffi/freetype")
|
||||
local Screen = require("device").screen
|
||||
local Device = require("device")
|
||||
local DEBUG = require("dbg")
|
||||
|
||||
local Font = {
|
||||
@ -94,11 +95,19 @@ function Font:_readList(target, dir)
|
||||
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()
|
||||
local fontlist = {}
|
||||
self:_readList(fontlist, self.fontdir)
|
||||
-- multiple path should be joined with semicolon in FONTDIR env variable
|
||||
for dir in string.gmatch(os.getenv("EXT_FONT_DIR") or "", "([^;]+)") do
|
||||
-- multiple paths should be joined with semicolon
|
||||
for dir in string.gmatch(self:_getExternalFontDir() or "", "([^;]+)") do
|
||||
self:_readList(fontlist, dir)
|
||||
end
|
||||
table.sort(fontlist)
|
||||
|
Loading…
Reference in New Issue
Block a user