summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKhaled Hosny <khaledhosny@eglug.org>2010-05-16 19:23:21 +0300
committerKhaled Hosny <khaledhosny@eglug.org>2010-05-16 19:23:21 +0300
commit92fd666d7e6e8f22498612118dc4556dc989ad79 (patch)
tree7c7a4fa63d5c84608edb77cd8ec6b4852ac5541b
parent10c292a735ebafc7870dd342fd0d7739f6bf5af2 (diff)
downloadluaotfload-92fd666d7e6e8f22498612118dc4556dc989ad79.tar.gz
Tolerate not being able to run |fc-list|
This will avoid the error message, but also no system fonts will be scanned.
-rw-r--r--otfl-font-nms.lua22
1 files changed, 12 insertions, 10 deletions
diff --git a/otfl-font-nms.lua b/otfl-font-nms.lua
index 935500c..d7a5847 100644
--- a/otfl-font-nms.lua
+++ b/otfl-font-nms.lua
@@ -510,16 +510,18 @@ local function scan_os_fonts(fontnames, newfontnames)
logs.report("executing 'fc-list : file' and parsing its result...")
end
local data = io.popen("fc-list : file", 'r')
- local list = read_fcdata(data)
- data:close()
- if trace_search then
- logs.report("%d fonts found", #list)
- end
- count = 0
- for _,fnt in ipairs(list) do
- count = count + 1
- progress(count, #list)
- load_font(fnt, fontnames, newfontnames, false)
+ if data then
+ local list = read_fcdata(data)
+ data:close()
+ if trace_search then
+ logs.report("%d fonts found", #list)
+ end
+ count = 0
+ for _,fnt in ipairs(list) do
+ count = count + 1
+ progress(count, #list)
+ load_font(fnt, fontnames, newfontnames, false)
+ end
end
end
end