summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--otfl-font-nms.lua11
1 files changed, 6 insertions, 5 deletions
diff --git a/otfl-font-nms.lua b/otfl-font-nms.lua
index e6faeab..0f44eb4 100644
--- a/otfl-font-nms.lua
+++ b/otfl-font-nms.lua
@@ -518,12 +518,13 @@ end
in OSFONTDIR.
]]
-local function read_fonts_conf(path, results)
+local function read_fonts_conf(path, results, passed_paths)
--[[
This function parses /etc/fonts/fonts.conf and returns all the dir it finds.
The code is minimal, please report any error it may generate.
]]
local f = io.open(path)
+ table.insert(passed_paths, path)
if not f then
logs.info("Warning: unable to read "..path.. ", skipping...")
return results
@@ -575,14 +576,14 @@ local function read_fonts_conf(path, results)
elseif not lfs.isfile(include) and not lfs.isdir(include) then
include = file.join(file.dirname(path), include)
end
- if lfs.isfile(include) and kpse.readable_file(include) then
+ if lfs.isfile(include) and kpse.readable_file(include) and not table.contains(passed_paths, include) then
-- maybe we should prevent loops here?
-- we exclude path with texmf in them, as they should
-- be found otherwise
- read_fonts_conf(include, results)
+ read_fonts_conf(include, results, passed_paths)
elseif lfs.isdir(include) then
for _,f in next, glob(file.join(include, "*.conf")) do
- read_fonts_conf(f, results)
+ read_fonts_conf(f, results, passed_paths)
end
end
end
@@ -608,7 +609,7 @@ local function get_os_dirs()
local windir = os.getenv("WINDIR")
return { file.join(windir, 'Fonts') }
else
- return read_fonts_conf("/etc/fonts/fonts.conf", {})
+ return read_fonts_conf("/etc/fonts/fonts.conf", {}, {})
end
end