[latex3-commits] [git/LaTeX3-latex3-luaotfload] modules: Less config settings and modulize parsers (6b882bc)

Marcel Fabian Krüger tex at 2krueger.de
Sun May 24 01:50:38 CEST 2020


Repository : https://github.com/latex3/luaotfload
On branch  : modules
Link       : https://github.com/latex3/luaotfload/commit/6b882bc222da902eb3a81e6f4c3a1c7d458d5ba1

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

commit 6b882bc222da902eb3a81e6f4c3a1c7d458d5ba1
Author: Marcel Fabian Krüger <tex at 2krueger.de>
Date:   Sun May 24 01:50:38 2020 +0200

    Less config settings and modulize parsers


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

6b882bc222da902eb3a81e6f4c3a1c7d458d5ba1
 src/luaotfload-fontloader.lua |  6 ------
 src/luaotfload-main.lua       |  7 +++++--
 src/luaotfload-parsers.lua    | 26 ++++++++++++--------------
 src/luaotfload-tool.lua       |  2 +-
 4 files changed, 18 insertions(+), 23 deletions(-)

diff --git a/src/luaotfload-fontloader.lua b/src/luaotfload-fontloader.lua
index 92d354a..70085f1 100644
--- a/src/luaotfload-fontloader.lua
+++ b/src/luaotfload-fontloader.lua
@@ -260,12 +260,6 @@ local function verify_context_dir (pth)
 end
 
 local function init_main(early_hook)
-  config                       = config or { } --- global
-  config.luaotfload            = config.luaotfload or { }
-  config.lualibs               = config.lualibs    or { }
-  config.lualibs.verbose       = false
-  config.lualibs.prefer_merged = true
-  config.lualibs.load_extended = true
   fonts                        = fonts or { }
 
   require "lualibs"
diff --git a/src/luaotfload-main.lua b/src/luaotfload-main.lua
index ca86f3a..5f4a10e 100644
--- a/src/luaotfload-main.lua
+++ b/src/luaotfload-main.lua
@@ -33,7 +33,6 @@ if luatexbase and luatexbase.provides_module then
 end  
 
 local osgettimeofday              = os.gettimeofday
-config                            = config     or { }
 local luaotfload                  = luaotfload or { }
 _ENV.luaotfload                   = luaotfload
 local logreport                   = require "luaotfload-log".report --- Enable logging as soon as possible
@@ -169,6 +168,10 @@ luaotfload.main = function ()
 
     local starttime = osgettimeofday ()
 
+    if config and config.lualibs then
+        config.lualibs.load_extended = true
+    end
+
     -- Feature detect HarfBuzz. This is done early to allow easy HarfBuzz
     -- detection in other modules
     local harfstatus, harfbuzz = pcall(require, 'luaharfbuzz')
@@ -178,7 +181,7 @@ luaotfload.main = function ()
 
     local init      = loadmodule "fontloader" --- fontloader initialization
     init (function ()
-        initialize "parsers"         --- fonts.conf and syntax
+        luaotfload.parsers = loadmodule "parsers"         --- fonts.conf and syntax
         initialize "configuration"   --- configuration options
     end)
 
diff --git a/src/luaotfload-parsers.lua b/src/luaotfload-parsers.lua
index 7c991d0..40136dc 100644
--- a/src/luaotfload-parsers.lua
+++ b/src/luaotfload-parsers.lua
@@ -17,6 +17,7 @@ if luatexbase and luatexbase.provides_module then
   luatexbase.provides_module (ProvidesLuaModule)
 end  
 
+require'lualibs'
 
 local traversal_maxdepth  = 42 --- prevent stack overflows
 
@@ -779,19 +780,16 @@ local parse_config      = Ct (ini_sections)
 
 --doc]=]--
 
-return function ()
-  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
+return {
+  --- 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,
+}
 
 -- vim:ft=lua:tw=71:et:sw=2:sts=4:ts=8
diff --git a/src/luaotfload-tool.lua b/src/luaotfload-tool.lua
index 8265b68..e527b6b 100755
--- a/src/luaotfload-tool.lua
+++ b/src/luaotfload-tool.lua
@@ -185,7 +185,7 @@ end
 require "alt_getopt"
 
 local log = require "luaotfload-log"
-loadmodule "parsers"       --- fonts.conf, configuration, and request syntax
+luaotfload.parsers = loadmodule "parsers"       --- fonts.conf, configuration, and request syntax
 loadmodule "configuration" --- configuration file handling
 loadmodule "database"
 loadmodule "resolvers"     --- Font lookup





More information about the latex3-commits mailing list.