From 74e0f21a51d805f9599dee98a6fe3804e4edee06 Mon Sep 17 00:00:00 2001
From: Philipp Gesang <phg42.2a@gmail.com>
Date: Tue, 5 Nov 2013 00:38:36 +0100
Subject: [main] import changes to luaotfload.lua into dtx

---
 luaotfload.dtx | 60 +++++++++++++++++++++++++++++++++++++++++++---------------
 1 file changed, 45 insertions(+), 15 deletions(-)

(limited to 'luaotfload.dtx')

diff --git a/luaotfload.dtx b/luaotfload.dtx
index d1ed313..51c4e7e 100644
--- a/luaotfload.dtx
+++ b/luaotfload.dtx
@@ -1904,8 +1904,11 @@ loadmodule"colors.lua"     --- “font-clr”
 %
 %    \begin{macrocode}
 
+local filesuffix          = file.suffix
+local fileremovesuffix    = file.removesuffix
 local request_resolvers   = fonts.definers.resolvers
-local formats             = fonts.formats -- nice table; does lowercasing ...
+local formats             = fonts.formats
+local names               = fonts.names
 formats.ofm               = "type1"
 
 %    \end{macrocode}
@@ -1922,24 +1925,28 @@ formats.ofm               = "type1"
 % With the release version 2.2 the file names are indexed in the database
 % as well and we are ready to resolve \verb|file:| lookups this way.
 % Thus we no longer need to call the \identifier{kpathsea} library in
-% most cases when looking up font files, only when generating the database.
+% most cases when looking up font files, only when generating the database,
+% and when verifying the existence of a file in the \fileent{texmf} tree.
 %
 %    \begin{macrocode}
 
-local resolvefile = fonts.names.crude_file_lookup
---local resolvefile = fonts.names.crude_file_lookup_verbose
+local resolve_file        = names.crude_file_lookup
+--local resolve_file        = names.crude_file_lookup_verbose
+local resolve_name        = names.resolve_name
 
-request_resolvers.file = function (specification)
-    local name    = resolvefile(specification.name)
-    local suffix  = file.suffix(name)
+local file_resolver = function (specification)
+    local name    = resolve_file (specification.name)
+    local suffix  = filesuffix(name)
     if formats[suffix] then
-        specification.forced  = suffix
-        specification.name    = file.removesuffix(name)
+        specification.forced      = suffix
+        specification.forcedname  = file.removesuffix(name)
     else
         specification.name = name
     end
 end
 
+request_resolvers.file = file_resolver
+
 %    \end{macrocode}
 % We classify as \verb|anon:| those requests that have neither a
 % prefix nor brackets. According to Khaled\footnote{%
@@ -1974,7 +1981,8 @@ request_resolvers.anon = function (specification)
     for i=1, #type1_formats do
         local format = type1_formats[i]
         if resolvers.findfile(name, format) then
-            specification.name = file.addsuffix(name, format)
+            specification.forcedname = file.addsuffix(name, format)
+            specification.forced     = format
             return
         end
     end
@@ -2011,9 +2019,9 @@ request_resolvers.path = function (specification)
         logs.names_report("log", 1, "load",
           "path lookup of %q unsuccessful, falling back to file:",
           name)
-        request_resolvers.file(specification)
+        file_resolver (specification)
     else
-      local suffix = file.suffix(name)
+      local suffix = filesuffix (name)
       if formats[suffix] then
         specification.forced  = suffix
         specification.name    = file.removesuffix(name)
@@ -2032,12 +2040,12 @@ end
 
 request_resolvers.kpse = function (specification)
     local name       = specification.name
-    local suffix     = file.suffix(name)
+    local suffix     = filesuffix(name)
     if suffix and formats[suffix] then
         name = file.removesuffix(name)
         if resolvers.findfile(name, suffix) then
-            specification.forced = suffix
-            specification.name   = name
+            specification.forced       = suffix
+            specification.forcedname   = name
             return
         end
     end
@@ -2050,6 +2058,28 @@ request_resolvers.kpse = function (specification)
     end
 end
 
+%    \end{macrocode}
+% The \verb|name:| resolver wraps the database function
+% \luafunction{resolve_name}.
+%
+%    \begin{macrocode}
+
+--- fonts.names.resolvers.name -- Customized version of the
+--- generic name resolver.
+
+request_resolvers.name = function (specification)
+    local resolved, subfont = resolve_name (specification)
+    if resolved then
+        specification.resolved   = resolved
+        specification.sub        = subfont
+        specification.forced     = filesuffix (resolved)
+        specification.forcedname = resolved
+        specification.name       = fileremovesuffix (resolved)
+    else
+        file_resolver (specification)
+    end
+end
+
 %    \end{macrocode}
 % Also {\bfseries EXPERIMENTAL}:
 % custom file resolvers via callback.
-- 
cgit v1.2.3


From 653e9f10b170aff798cc9348d41bae472d7414f0 Mon Sep 17 00:00:00 2001
From: Philipp Gesang <phg42.2a@gmail.com>
Date: Tue, 5 Nov 2013 16:36:53 +0100
Subject: [main] fix afm lookup

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

(limited to 'luaotfload.dtx')

diff --git a/luaotfload.dtx b/luaotfload.dtx
index 51c4e7e..e19cdc3 100644
--- a/luaotfload.dtx
+++ b/luaotfload.dtx
@@ -1911,6 +1911,8 @@ local formats             = fonts.formats
 local names               = fonts.names
 formats.ofm               = "type1"
 
+fonts.encodings.known     = fonts.encodings.known or { }
+
 %    \end{macrocode}
 % \identifier{luaotfload} promises easy access to system fonts.
 % Without additional precautions, this cannot be achieved by
-- 
cgit v1.2.3


From c05e323e497d7d8e3befb371d6b78e1f91be83d9 Mon Sep 17 00:00:00 2001
From: Philipp Gesang <phg42.2a@gmail.com>
Date: Tue, 5 Nov 2013 20:21:44 +0100
Subject: [main] add setting for db stripping to luaotfload.lua

---
 luaotfload.dtx | 3 +++
 1 file changed, 3 insertions(+)

(limited to 'luaotfload.dtx')

diff --git a/luaotfload.dtx b/luaotfload.dtx
index e19cdc3..5d80318 100644
--- a/luaotfload.dtx
+++ b/luaotfload.dtx
@@ -1550,6 +1550,9 @@ config.luaotfload.names_dir       = config.luaotfload.names_dir        or "names
 config.luaotfload.cache_dir       = config.luaotfload.cache_dir        or "fonts"
 config.luaotfload.index_file      = config.luaotfload.index_file       or "luaotfload-names.lua"
 config.luaotfload.formats         = config.luaotfload.formats          or "otf,ttf,ttc,dfont"
+if not config.luaotfload.strip then
+    config.luaotfload.strip = true
+end
 
 luaotfload.module = {
     name          = "luaotfload",
-- 
cgit v1.2.3

