summaryrefslogtreecommitdiff
path: root/luaotfload-fonts.lua
diff options
context:
space:
mode:
authorElie Roux <eroux@dedibox.ebzao.info>2010-01-19 17:00:47 +0100
committerElie Roux <eroux@dedibox.ebzao.info>2010-01-19 17:00:47 +0100
commitd9ac83dfab6d7f301fe0a1b11a804d7aec6cb79e (patch)
treea9c4849916261ca2e3109080ce39e3edd496afbf /luaotfload-fonts.lua
parentd16bfeee22f0d73190e16735c375b346f7a71677 (diff)
downloadluaotfload-d9ac83dfab6d7f301fe0a1b11a804d7aec6cb79e.tar.gz
Differenciation between texmf and non-texmf dirs
The paths are now absolute for files that are not in the texmf tree.
Diffstat (limited to 'luaotfload-fonts.lua')
-rw-r--r--luaotfload-fonts.lua19
1 files changed, 15 insertions, 4 deletions
diff --git a/luaotfload-fonts.lua b/luaotfload-fonts.lua
index 83175bd..7ed2a2d 100644
--- a/luaotfload-fonts.lua
+++ b/luaotfload-fonts.lua
@@ -205,15 +205,26 @@ local function scan_os_fonts(names)
end
--]]
-local function scan_txmf_tree(names)
- local fontdirs = expandpath("$OPENTYPEFONTS")
+local texmfdist = kpse.expand_var("$TEXMFDIST")
+local texmfmain = kpse.expand_var("$TEXMFMAIN")
+local texmflocal = kpse.expand_var("$TEXMFLOCAL")
+
+local function is_texmf(dir)
+ if dir:find(texmfdist) or dir:find(texmfmain) or dir:find(texmflocal) then
+ return true
+ end
+ return false
+end
+
+local function scan_all(names)
+ local fontdirs = string.gsub(expandpath("$OPENTYPEFONTS"), "^\.[;:]", "")
fontdirs = fontdirs .. string.gsub(expandpath("$TTFONTS"), "^\.", "")
if not fontdirs:is_empty() then
local explored_dirs = {}
fontdirs = splitpath(fontdirs)
for _,d in ipairs(fontdirs) do
if not explored_dirs[d] then
- scan_dir(d, names, false, true)
+ scan_dir(d, names, false, is_texmf(d))
explored_dirs[d] = true
end
end
@@ -229,7 +240,7 @@ local function generate()
version = luaotfload.fonts.version
}
local savepath
- scan_txmf_tree(fnames)
+ scan_all(fnames)
info("%s fonts saved in the database", #table.keys(fnames.mappings.psnames))
savepath = kpse.expand_var("$TEXMFVAR") .. "/tex/"
if not file.isreadable(savepath) then