summaryrefslogtreecommitdiff
path: root/luaotfload.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'luaotfload.dtx')
-rw-r--r--luaotfload.dtx30
1 files changed, 28 insertions, 2 deletions
diff --git a/luaotfload.dtx b/luaotfload.dtx
index 8b3616a..ead0773 100644
--- a/luaotfload.dtx
+++ b/luaotfload.dtx
@@ -1371,8 +1371,10 @@ loadmodule"colors.lua" --- “font-clr”
-- specification.name = fonts.names.resolve('', '', specification)
--end
-fonts.definers.resolvers.file = function (specification)
- --inspect(specification)
+local resolvers = fonts.definers.resolvers
+local formats = fonts.formats
+
+resolvers.file = function (specification)
if specification.lookup == "file" then
local found = fonts.names.crude_file_lookup(specification.name)
--local found = fonts.names.crude_file_lookup_verbose(specification.name)
@@ -1380,6 +1382,30 @@ fonts.definers.resolvers.file = function (specification)
end
end
+--- TODO rewrite this according to the syntax spec
+resolvers.anon = function (specification)
+ local resolved, subfontno = fonts.names.resolve(nil, nil, specification)
+ if resolved then --- we follow fonts-def to some extent
+ specification.resolved = resolved
+ specification.sub = subfontno
+ local suffix = file.suffix(resolved)
+ if formats[suffix] then
+ specification.forced = suffix
+ specification.name = file.removesuffix(resolved)
+ else
+ specification.name = resolved
+ end
+ else
+ resolvers.file(specification)
+ end
+end
+
+--- TODO rewrite this according to the syntax spec
+resolvers.path = function (specification)
+ local found = fonts.names.crude_file_lookup(specification.name)
+ specification.name = found[1]
+end
+
% \end{macrocode}
% We create a callback for patching fonts on the fly, to be used by other
% packages.