From 996ba6a5014fc546c8e8c769a259b9adaf2090dc Mon Sep 17 00:00:00 2001
From: Philipp Gesang <phg42.2a@gmail.com>
Date: Sun, 28 Apr 2013 13:34:58 +0200
Subject: add prelimiary anon: and path: resolvers

---
 luaotfload.dtx | 30 ++++++++++++++++++++++++++++--
 1 file changed, 28 insertions(+), 2 deletions(-)

(limited to 'luaotfload.dtx')

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.
-- 
cgit v1.2.3

