2
0
mirror of https://github.com/koreader/koreader synced 2024-11-16 06:12:56 +00:00

fix mupdf rendering caused by FONTDIR env var

It turns out that one of our mupdf patch reads the FONTDIR env var
and uses it in a totally different way so we will use another env var
EXT_FONT_DIR to define external font directory for different platforms.
This commit is contained in:
chrox 2015-01-28 02:17:54 +08:00
parent a05001943d
commit a40c172c47
4 changed files with 11 additions and 8 deletions

View File

@ -78,7 +78,10 @@ function Font:getFace(font, size)
end
function Font:_readList(target, dir)
for f in lfs.dir(dir) do
-- lfs.dir non-exsitent directory will give error, weird!
local ok, iter, dir_obj = pcall(lfs.dir, dir)
if not ok then return end
for f in iter, dir_obj do
if lfs.attributes(dir.."/"..f, "mode") == "directory" and f ~= "." and f ~= ".." then
self:_readList(target, dir.."/"..f)
else
@ -95,7 +98,7 @@ 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("FONTDIR") or "", "([^;]+)") do
for dir in string.gmatch(os.getenv("EXT_FONT_DIR") or "", "([^;]+)") do
self:_readList(fontlist, dir)
end
table.sort(fontlist)

View File

@ -115,8 +115,8 @@ export TESSDATA_PREFIX="data"
# export dict directory
export STARDICT_DATA_DIR="data/dict"
# export font directory
export FONTDIR="/mnt/us/fonts"
# export external font directory
export EXT_FONT_DIR="/mnt/us/fonts"
logmsg "Setting up IPTables rules . . ."
# accept input ports for zsync plugin

View File

@ -21,8 +21,8 @@ export TESSDATA_PREFIX="data"
# export dict directory
export STARDICT_DATA_DIR="data/dict"
# export font directory
export FONTDIR="/mnt/onboard/fonts"
# export external font directory
export EXT_FONT_DIR="/mnt/onboard/fonts"
# fast and dirty way of check if we are called from nickel
# through fmon, or from another launcher (KSM or advboot)

View File

@ -21,8 +21,8 @@ export TESSDATA_PREFIX="data"
# export dict directory
export STARDICT_DATA_DIR="data/dict"
# export font directory
export FONTDIR="/mnt/ext1/fonts"
# export external font directory
export EXT_FONT_DIR="/mnt/ext1/fonts"
if [ `echo $@ | wc -c` -eq 1 ]; then
args="/mnt/ext1/"