From e87d7e1fcb91332b5f571fece1bca2f2756e4930 Mon Sep 17 00:00:00 2001 From: Will Robertson Date: Wed, 19 May 2010 14:36:00 +0930 Subject: don't duplicate code when looping through exts --- otfl-font-nms.lua | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/otfl-font-nms.lua b/otfl-font-nms.lua index f7f130b..88c28ac 100644 --- a/otfl-font-nms.lua +++ b/otfl-font-nms.lua @@ -471,6 +471,10 @@ end fonts.path_normalize = path_normalize +font_extensions = { + "otf", "ttf", "ttc", "dfont", "OTF", "TTF", "TTC", "DFONT" +} + local function scan_dir(dirname, fontnames, newfontnames, texmf) --[[ this function scans a directory and populates the list of fonts @@ -481,7 +485,7 @@ local function scan_dir(dirname, fontnames, newfontnames, texmf) --]] local list, found = { }, { } local nbfound = 0 - for _,ext in ipairs { "otf", "ttf", "ttc", "dfont" } do + for _,ext in ipairs(font_extensions) do if trace_search then logs.report("scanning '%s' for '%s' fonts", dirname, ext) end @@ -493,12 +497,6 @@ local function scan_dir(dirname, fontnames, newfontnames, texmf) end nbfound = nbfound + #found table.append(list, found) - if trace_search then - logs.report("scanning '%s' for '%s' fonts", dirname, upper(ext)) - end - found = glob(dirname .. "/**." .. upper(ext)) - table.append(list, found) - nbfound = nbfound + #found end if trace_search then logs.report("%d fonts found in '%s'", nbfound, dirname) -- cgit v1.2.3