summaryrefslogtreecommitdiff
path: root/otfl-font-nms.lua
diff options
context:
space:
mode:
authorKhaled Hosny <khaledhosny@eglug.org>2010-03-24 14:19:29 +0200
committerKhaled Hosny <khaledhosny@eglug.org>2010-03-24 14:21:01 +0200
commit8d5d4c328c83c892e5350c06f37568dde3912a85 (patch)
tree7765f352fd65ff8dc5a3509f2547af32648fc394 /otfl-font-nms.lua
parentb0f6c7a5e580aeb4ccc52e593e8e2a2f87bf66dd (diff)
downloadluaotfload-8d5d4c328c83c892e5350c06f37568dde3912a85.tar.gz
Make some frequently used functions local
Diffstat (limited to 'otfl-font-nms.lua')
-rw-r--r--otfl-font-nms.lua15
1 files changed, 8 insertions, 7 deletions
diff --git a/otfl-font-nms.lua b/otfl-font-nms.lua
index f60664c..2a7c586 100644
--- a/otfl-font-nms.lua
+++ b/otfl-font-nms.lua
@@ -20,14 +20,15 @@ names.path = {
local splitpath, expandpath, glob, basename = file.split_path, kpse.expand_path, dir.glob, file.basename
-local upper, format = string.upper, string.format
+local upper, lower, format, gsub, match = string.upper, string.lower, string.format, string.gsub, string.match
+local rpadd = string.rpadd
local trace_progress = true --trackers.register("names.progress", function(v) trace_progress = v end)
local trace_search = false --trackers.register("names.search", function(v) trace_search = v end)
local trace_loading = false --trackers.register("names.loading", function(v) trace_loading = v end)
local function sanitize(str)
- return string.gsub(string.lower(str), "[^%a%d]", "")
+ return gsub(lower(str), "[^%a%d]", "")
end
function names.load()
@@ -134,10 +135,10 @@ local function progress(current, total)
-- local width = os.getenv("COLUMNS") -2 --doesn't work
local width = 78
local percent = current/total
- local gauge = format("[%s]", string.rpadd(" ", width, " "))
+ local gauge = format("[%s]", rpadd(" ", width, " "))
if percent > 0 then
- local done = string.rpadd("=", (width * percent) - 1, "=") .. ">"
- gauge = format("[%s]", string.rpadd(done, width, " ") )
+ local done = rpadd("=", (width * percent) - 1, "=") .. ">"
+ gauge = format("[%s]", rpadd(done, width, " ") )
end
if lastislog == 1 then
texio.write_nl("")
@@ -353,7 +354,7 @@ local function scan_texmf_tree(fontnames, status, newfontnames, newstatus)
end
end
local fontdirs = expandpath("$OPENTYPEFONTS")
- fontdirs = fontdirs .. string.gsub(expandpath("$TTFONTS"), "^\.", "")
+ fontdirs = fontdirs .. gsub(expandpath("$TTFONTS"), "^\.", "")
if not fontdirs:is_empty() then
local explored_dirs = {}
fontdirs = splitpath(fontdirs)
@@ -377,7 +378,7 @@ local function read_fcdata(data)
local list = { }
for line in data:lines() do
line = line:gsub(": ", "")
- local ext = string.lower(string.match(line,"^.+%.([^/\\]-)$"))
+ local ext = lower(match(line,"^.+%.([^/\\]-)$"))
if ext == "otf" or ext == "ttf" or ext == "ttc" or ext == "dfont" then
list[#list+1] = path_normalize(line:gsub(": ", ""))
end