From 92fd666d7e6e8f22498612118dc4556dc989ad79 Mon Sep 17 00:00:00 2001 From: Khaled Hosny Date: Sun, 16 May 2010 19:23:21 +0300 Subject: Tolerate not being able to run |fc-list| This will avoid the error message, but also no system fonts will be scanned. --- otfl-font-nms.lua | 22 ++++++++++++---------- 1 file 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 -- cgit v1.2.3