[latex3-commits] [git/LaTeX3-latex3-luaotfload] dev: Fix scan-local (56fdb61)

Marcel Fabian Krüger tex at 2krueger.de
Wed Aug 28 15:25:54 CEST 2019


Repository : https://github.com/latex3/luaotfload
On branch  : dev
Link       : https://github.com/latex3/luaotfload/commit/56fdb61280e43f3dbd766a42d00d7d3fb76319d4

>---------------------------------------------------------------

commit 56fdb61280e43f3dbd766a42d00d7d3fb76319d4
Author: Marcel Fabian Krüger <tex at 2krueger.de>
Date:   Wed Aug 28 15:18:19 2019 +0200

    Fix scan-local


>---------------------------------------------------------------

56fdb61280e43f3dbd766a42d00d7d3fb76319d4
 src/fontloader/runtime/fontloader-basics-gen.lua     |  2 +-
 src/luaotfload-database.lua                          | 20 ++++++++++++++------
 .../latex-dev/luaotfload/fontloader-basics-gen.lua   |  2 +-
 .../tex/latex-dev/luaotfload/luaotfload-database.lua | 20 ++++++++++++++------
 4 files changed, 30 insertions(+), 14 deletions(-)

diff --git a/src/fontloader/runtime/fontloader-basics-gen.lua b/src/fontloader/runtime/fontloader-basics-gen.lua
index 3959ca0..f52fec6 100644
--- a/src/fontloader/runtime/fontloader-basics-gen.lua
+++ b/src/fontloader/runtime/fontloader-basics-gen.lua
@@ -189,7 +189,7 @@ local readables = { }
 local usingjit  = jit
 
 if not caches.namespace or caches.namespace == "" or caches.namespace == "context" then
-    caches.namespace = 'generic'
+    caches.namespace = 'generic-dev'
 end
 
 do
diff --git a/src/luaotfload-database.lua b/src/luaotfload-database.lua
index 705ad0d..4392f85 100644
--- a/src/luaotfload-database.lua
+++ b/src/luaotfload-database.lua
@@ -2552,14 +2552,13 @@ local collect_font_filenames_local = function ()
     local files  = collect_font_filenames_dir (pwd, "local")
     local nfiles = #files
     if nfiles > 0 then
-        targetnames.meta["local"] = true --- prevent saving to disk
         logreport ("term", 1, "db", "Found %d files.", pwd)
     else
         logreport ("term", 1, "db",
                    "Couldn’t find a thing here. What a waste.", pwd)
     end
     logreport ("term", 3, "db", "Collected %d files.", #files)
-    return files
+    return files, nfiles > 0
 end
 
 --- fontentry list -> filemap
@@ -3115,8 +3114,14 @@ local collect_font_filenames = function ()
 
     tableappend (filenames, collect_font_filenames_texmf  ())
     tableappend (filenames, collect_font_filenames_system ())
-    if config.luaotfload.db.scan_local == true then
-        tableappend (filenames, collect_font_filenames_local  ())
+    local scan_local = config.luaotfload.db.scan_local == true
+    if scan_local then
+        local localfonts, found = collect_font_filenames_local()
+        if found then
+            tableappend (filenames, localfonts)
+        else
+            scan_local = false
+        end
     end
     --- Now drop everything above max_fonts.
     if max_fonts < #filenames then
@@ -3126,7 +3131,7 @@ local collect_font_filenames = function ()
     if bisect then
         return { unpack (filenames, bisect[1], bisect[2]) }
     end
-    return filenames
+    return filenames, scan_local
 end
 
 --[[doc--
@@ -3397,7 +3402,10 @@ update_names = function (currentnames, force, dry_run)
         read_blacklist ()
 
         --- pass 1: Collect the names of all fonts we are going to process.
-        local font_filenames = collect_font_filenames ()
+        local font_filenames, local_fonts = collect_font_filenames ()
+        if local_fonts then
+            targetnames.meta['local'] = true
+        end
 
         --- pass 2: read font files (normal case) or reuse information
         --- present in index
diff --git a/texmf/tex/latex-dev/luaotfload/fontloader-basics-gen.lua b/texmf/tex/latex-dev/luaotfload/fontloader-basics-gen.lua
index 3959ca0..f52fec6 100644
--- a/texmf/tex/latex-dev/luaotfload/fontloader-basics-gen.lua
+++ b/texmf/tex/latex-dev/luaotfload/fontloader-basics-gen.lua
@@ -189,7 +189,7 @@ local readables = { }
 local usingjit  = jit
 
 if not caches.namespace or caches.namespace == "" or caches.namespace == "context" then
-    caches.namespace = 'generic'
+    caches.namespace = 'generic-dev'
 end
 
 do
diff --git a/texmf/tex/latex-dev/luaotfload/luaotfload-database.lua b/texmf/tex/latex-dev/luaotfload/luaotfload-database.lua
index 705ad0d..4392f85 100644
--- a/texmf/tex/latex-dev/luaotfload/luaotfload-database.lua
+++ b/texmf/tex/latex-dev/luaotfload/luaotfload-database.lua
@@ -2552,14 +2552,13 @@ local collect_font_filenames_local = function ()
     local files  = collect_font_filenames_dir (pwd, "local")
     local nfiles = #files
     if nfiles > 0 then
-        targetnames.meta["local"] = true --- prevent saving to disk
         logreport ("term", 1, "db", "Found %d files.", pwd)
     else
         logreport ("term", 1, "db",
                    "Couldn’t find a thing here. What a waste.", pwd)
     end
     logreport ("term", 3, "db", "Collected %d files.", #files)
-    return files
+    return files, nfiles > 0
 end
 
 --- fontentry list -> filemap
@@ -3115,8 +3114,14 @@ local collect_font_filenames = function ()
 
     tableappend (filenames, collect_font_filenames_texmf  ())
     tableappend (filenames, collect_font_filenames_system ())
-    if config.luaotfload.db.scan_local == true then
-        tableappend (filenames, collect_font_filenames_local  ())
+    local scan_local = config.luaotfload.db.scan_local == true
+    if scan_local then
+        local localfonts, found = collect_font_filenames_local()
+        if found then
+            tableappend (filenames, localfonts)
+        else
+            scan_local = false
+        end
     end
     --- Now drop everything above max_fonts.
     if max_fonts < #filenames then
@@ -3126,7 +3131,7 @@ local collect_font_filenames = function ()
     if bisect then
         return { unpack (filenames, bisect[1], bisect[2]) }
     end
-    return filenames
+    return filenames, scan_local
 end
 
 --[[doc--
@@ -3397,7 +3402,10 @@ update_names = function (currentnames, force, dry_run)
         read_blacklist ()
 
         --- pass 1: Collect the names of all fonts we are going to process.
-        local font_filenames = collect_font_filenames ()
+        local font_filenames, local_fonts = collect_font_filenames ()
+        if local_fonts then
+            targetnames.meta['local'] = true
+        end
 
         --- pass 2: read font files (normal case) or reuse information
         --- present in index





More information about the latex3-commits mailing list