diff options
author | Will Robertson <wspr81@gmail.com> | 2010-05-19 14:36:00 +0930 |
---|---|---|
committer | Will Robertson <wspr81@gmail.com> | 2010-05-19 18:13:32 +0930 |
commit | e87d7e1fcb91332b5f571fece1bca2f2756e4930 (patch) | |
tree | b19d7d0626f267268352c90cf36d05f9667caf0a | |
parent | 2596ce79ba615cef17a01a4488027707f3f55952 (diff) | |
download | luaotfload-e87d7e1fcb91332b5f571fece1bca2f2756e4930.tar.gz |
don't duplicate code when looping through exts
-rw-r--r-- | otfl-font-nms.lua | 12 |
1 files 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) |