diff options
author | Philipp Gesang <phg42.2a@gmail.com> | 2013-04-15 13:13:18 +0200 |
---|---|---|
committer | Philipp Gesang <phg42.2a@gmail.com> | 2013-04-15 13:13:18 +0200 |
commit | 690cd37becccf9e1f63c7c09054f82e54a50a13d (patch) | |
tree | 9f04512b49814b3147a89bc24240a438bea84d2e /luaotfload.lua | |
parent | ba7ad3c0cbede3e91fac9101b6f57f1849726725 (diff) | |
download | luaotfload-690cd37becccf9e1f63c7c09054f82e54a50a13d.tar.gz |
avoid two calls to the file library
Diffstat (limited to 'luaotfload.lua')
-rw-r--r-- | luaotfload.lua | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/luaotfload.lua b/luaotfload.lua index 1ca1fdc..290bba7 100644 --- a/luaotfload.lua +++ b/luaotfload.lua @@ -80,10 +80,17 @@ Virtual fonts are resolved via a callback. filename. (NB: \CONTEXT\ handles this likewise in \textsf{font-vf.lua}.) --doc]]-- +local Cs, P, lpegmatch = lpeg.Cs, lpeg.P, lpeg.match + +local p_dot, p_slash = P".", P"/" +local p_suffix = (p_dot * (1 - p_dot - p_slash)^1 * P(-1)) / "" +local p_removesuffix = Cs((p_suffix + 1)^1) + local find_vf_file = function (name) local fullname = find_file(name, "ovf") if not fullname then - fullname = find_file(file.removesuffix(file.basename(name)), "ovf") + --fullname = find_file(file.removesuffix(name), "ovf") + fullname = find_file(lpegmatch(p_removesuffix, name), "ovf") end if fullname then log("loading virtual font file %s.", fullname) |