summaryrefslogtreecommitdiff
path: root/otfl-font-nms.lua
diff options
context:
space:
mode:
authorElie Roux <elie.roux@telecom-bretagne.eu>2010-05-15 18:35:08 +0300
committerElie Roux <elie.roux@telecom-bretagne.eu>2010-05-15 18:35:08 +0300
commitf5fcb4e933f142a7b803b42f7870b5de0ce1117c (patch)
tree822151c1b811ed4a426e49fbdc3e10420bbcf33f /otfl-font-nms.lua
parente089d4bfe982517075edb3517ee4cd4e6e6768d4 (diff)
downloadluaotfload-f5fcb4e933f142a7b803b42f7870b5de0ce1117c.tar.gz
Fixing a bug if OSFONTDIR is not empty
if OSFONTDIR was not empty, the texmf variable ended true and the filenames in the database were not complete.
Diffstat (limited to 'otfl-font-nms.lua')
-rw-r--r--otfl-font-nms.lua22
1 files changed, 19 insertions, 3 deletions
diff --git a/otfl-font-nms.lua b/otfl-font-nms.lua
index e910af8..91ce0c2 100644
--- a/otfl-font-nms.lua
+++ b/otfl-font-nms.lua
@@ -366,8 +366,7 @@ local function scan_dir(dirname, fontnames, status, newfontnames, newstatus, rec
with all the fonts it finds.
- dirname is the name of the directory to scan
- names is the font database to fill
- - recursive is whether we scan all directories recursively (always false
- in this script)
+ - recursive is whether we scan all directories recursively
- texmf is a boolean saying if we are scanning a texmf directory
--]]
local list, found = { }, { }
@@ -413,14 +412,30 @@ local function scan_texmf_tree(fontnames, status, newfontnames, newstatus)
logs.report("scanning TEXMF and OS fonts:")
end
end
+ local explored_dirs = {}
+ local osdirs = expandpath("$OSFONTDIR")
+ -- OPENTYPEFONTS and TTFONTS contain OSFONTDIR
local fontdirs = expandpath("$OPENTYPEFONTS")
fontdirs = fontdirs .. gsub(expandpath("$TTFONTS"), "^\.", "")
if not fontdirs:is_empty() then
- local explored_dirs = {}
fontdirs = splitpath(fontdirs)
-- hack, don't scan current dir
table.remove(fontdirs, 1)
count = 0
+ if osdirs and osdirs ~= '' then
+ osdirs = splitpath(osdirs)
+ -- we first scan the os dirs and have texmf=0 for scan_dir, and then
+ -- we scan the true texmf dirs, with texmf=1. With explored_dirs, we
+ -- won't explore a directory two times.
+ for _,d in ipairs(osdirs) do
+ if not explored_dirs[d] then
+ count = count + 1
+ progress(count, #fontdirs)
+ scan_dir(d, fontnames, status, newfontnames, newstatus, false, false)
+ explored_dirs[d] = true
+ end
+ end
+ end
for _,d in ipairs(fontdirs) do
if not explored_dirs[d] then
count = count + 1
@@ -544,3 +559,4 @@ end
names.scan = scan_dir
names.update = update
+