[latex3-commits] [git/LaTeX3-latex3-luaotfload] dev, nosymlink: Simplify access to luaotfload.parsers (5dafd8f)

Marcel Fabian Krüger tex at 2krueger.de
Tue Jul 14 17:34:56 CEST 2020


Repository : https://github.com/latex3/luaotfload
On branches: dev,nosymlink
Link       : https://github.com/latex3/luaotfload/commit/5dafd8f6f8a259c517c48e02a8e685237249bcfb

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

commit 5dafd8f6f8a259c517c48e02a8e685237249bcfb
Author: Marcel Fabian Krüger <tex at 2krueger.de>
Date:   Tue Jul 14 17:33:12 2020 +0200

    Simplify access to luaotfload.parsers


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

5dafd8f6f8a259c517c48e02a8e685237249bcfb
 src/luaotfload-database.lua | 10 ++--------
 src/luaotfload-parsers.lua  | 23 ++++++++++++-----------
 2 files changed, 14 insertions(+), 19 deletions(-)

diff --git a/src/luaotfload-database.lua b/src/luaotfload-database.lua
index 27ea583..2bfb0cb 100644
--- a/src/luaotfload-database.lua
+++ b/src/luaotfload-database.lua
@@ -2120,14 +2120,13 @@ do
 
     local current_formats = { }
 
+    local splitcomma = luaotfload.parsers.splitcomma
     function set_font_filter (formats)
 
         if not formats or type (formats) ~= "string" then
             return
         end
 
-        local splitcomma = luaotfload.parsers and luaotfload.parsers.splitcomma
-
         if stringsub (formats, 1, 1) == "+" then -- add
             formats = lpegmatch (splitcomma, stringsub (formats, 2))
             if formats then
@@ -2329,12 +2328,10 @@ local function collect_font_filenames_dir (dirname, location)
     return files
 end
 
+local stripslashes = luaotfload.parsers.stripslashes
 --- string list -> string list
 local function filter_out_pwd (dirs)
     local result = { }
-    if stripslashes == nil then
-        stripslashes = luaotfload.parsers and luaotfload.parsers.stripslashes
-    end
     local pwd = path_normalize (lpegmatch (stripslashes,
                                            lfscurrentdir ()))
     for i = 1, #dirs do
@@ -2426,9 +2423,6 @@ local function get_os_dirs ()
             "/usr/local/etc/fonts/fonts.conf",
             "/etc/fonts/fonts.conf",
         }
-        if not luaotfload.parsers then
-            logreport ("log", 0, "db", "Fatal: no fonts.conf parser.")
-        end
         local os_dirs = luaotfload.parsers.read_fonts_conf(fonts_conves, find_files)
         return os_dirs
     end
diff --git a/src/luaotfload-parsers.lua b/src/luaotfload-parsers.lua
index c2ac6f8..48d158f 100644
--- a/src/luaotfload-parsers.lua
+++ b/src/luaotfload-parsers.lua
@@ -779,19 +779,20 @@ local parse_config      = Ct (ini_sections)
 
 --doc]=]--
 
+luaotfload.parsers = {
+  --- parameters
+  traversal_maxdepth    = traversal_maxdepth,
+  --- main parsers
+  read_fonts_conf       = read_fonts_conf,
+  font_request          = font_request,
+  config                = parse_config,
+  --- common patterns
+  stripslashes          = stripslashes,
+  splitcomma            = splitcomma,
+}
+
 return function ()
   logreport = luaotfload.log.report
-  luaotfload.parsers = {
-    --- parameters
-    traversal_maxdepth    = traversal_maxdepth,
-    --- main parsers
-    read_fonts_conf       = read_fonts_conf,
-    font_request          = font_request,
-    config                = parse_config,
-    --- common patterns
-    stripslashes          = stripslashes,
-    splitcomma            = splitcomma,
-  }
   return true
 end
 





More information about the latex3-commits mailing list.