summaryrefslogtreecommitdiff
path: root/luaotfload.lua
diff options
context:
space:
mode:
Diffstat (limited to 'luaotfload.lua')
-rw-r--r--luaotfload.lua9
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)