summaryrefslogtreecommitdiff
path: root/otfl-font-nms.lua
diff options
context:
space:
mode:
authorPhilipp Gesang <phg42.2a@gmail.com>2013-04-17 03:44:47 +0200
committerPhilipp Gesang <phg42.2a@gmail.com>2013-04-17 03:44:47 +0200
commite9e2d85586078a00e28b8df1c8ccd858c7dc0bf6 (patch)
tree03d35f7b3a804683e932c2e792083b4d31599fb7 /otfl-font-nms.lua
parent2c1dd881a3b1144666515060db4298d0fe396c08 (diff)
downloadluaotfload-e9e2d85586078a00e28b8df1c8ccd858c7dc0bf6.tar.gz
use locals for table.*
Diffstat (limited to 'otfl-font-nms.lua')
-rw-r--r--otfl-font-nms.lua19
1 files changed, 11 insertions, 8 deletions
diff --git a/otfl-font-nms.lua b/otfl-font-nms.lua
index 79e7217..254519d 100644
--- a/otfl-font-nms.lua
+++ b/otfl-font-nms.lua
@@ -24,10 +24,13 @@ local stringgsub = string.gsub
local stringlower = string.lower
local stringsub = string.sub
local stringupper = string.upper
-local tableinsert = table.insert
local texiowrite_nl = texio.write_nl
local utf8gsub = unicode.utf8.gsub
local utf8lower = unicode.utf8.lower
+local tablecontains = table.contains -- TODO get rid of
+local tableappend = table.append -- TODO get rid of
+local tabletofile = table.tofile
+local tablecopy = table.copy
--- these come from Lualibs/Context
local dirglob = dir.glob
@@ -261,7 +264,7 @@ resolve = function (_,_,specification) -- the 1st two parameters are used by Con
break
end
elseif synonyms[style] and
- table.contains(synonyms[style], subfamily) then
+ tablecontains(synonyms[style], subfamily) then
if optsize then
if dsnsize == size
or (size > minsize and size <= maxsize) then
@@ -275,7 +278,7 @@ resolve = function (_,_,specification) -- the 1st two parameters are used by Con
break
end
elseif subfamily == "regular" or
- table.contains(synonyms.regular, subfamily) then
+ tablecontains(synonyms.regular, subfamily) then
found.fallback = face
end
else
@@ -609,7 +612,7 @@ local function scan_dir(dirname, fontnames, newfontnames, texmf)
-- sometimes in TeX Live.
report("log", 2, "fonts found", "%s '%s' fonts found", #found, ext)
nbfound = nbfound + #found
- table.append(list, found)
+ tableappend(list, found)
end
end
report("log", 2, "fonts found", "%d fonts found in '%s'", nbfound, dirname)
@@ -661,7 +664,7 @@ read_fonts_conf = function (path, results, passed_paths)
generate.
]]
local fh = ioopen(path)
- tableinsert(passed_paths, path)
+ passed_paths[#passed_paths+1] = path
if not fh then
report("log", 2, "cannot open file", "%s", path)
return results
@@ -715,7 +718,7 @@ read_fonts_conf = function (path, results, passed_paths)
end
if lfs.isfile(include)
and kpse.readable_file(include)
- and not table.contains(passed_paths, include)
+ and not tablecontains(passed_paths, include)
then
-- maybe we should prevent loops here?
-- we exclude path with texmf in them, as they should
@@ -810,7 +813,7 @@ save_names = function (fontnames)
path = filejoin(path, names.path.basename)
if file.iswritable(path) then
local luaname, lucname = make_name(path)
- table.tofile(luaname, fontnames, true)
+ tabletofile(luaname, fontnames, true)
caches.compile(fontnames,luaname,lucname)
report("info", 0, "Font names database saved")
return path
@@ -828,7 +831,7 @@ scan_external_dir = function (dir)
old_names = load_names()
loaded = true
end
- new_names = table.copy(old_names)
+ new_names = tablecopy(old_names)
scan_dir(dir, old_names, new_names)
names.data = new_names
end