[latex3-commits] [git/LaTeX3-latex3-luaotfload] dev: Less duplication in load order (47ca691)
Marcel Fabian Krüger
tex at 2krueger.de
Sat May 23 13:52:18 CEST 2020
Repository : https://github.com/latex3/luaotfload
On branch : dev
Link : https://github.com/latex3/luaotfload/commit/47ca691e292d19a23af942f0847e5f8fcb7561e6
>---------------------------------------------------------------
commit 47ca691e292d19a23af942f0847e5f8fcb7561e6
Author: Marcel Fabian Krüger <tex at 2krueger.de>
Date: Sat May 23 13:50:42 2020 +0200
Less duplication in load order
>---------------------------------------------------------------
47ca691e292d19a23af942f0847e5f8fcb7561e6
src/luaotfload-init.lua | 134 ++++++++++++++++--------------------------------
src/luaotfload-main.lua | 4 +-
2 files changed, 46 insertions(+), 92 deletions(-)
diff --git a/src/luaotfload-init.lua b/src/luaotfload-init.lua
index 4edd5af..1cc5823 100644
--- a/src/luaotfload-init.lua
+++ b/src/luaotfload-init.lua
@@ -79,37 +79,42 @@ local logreport --- filled in after loading the log module
--doc]]--
--- below paths are relative to the texmf-context
-local ltx = "tex/generic/context/luatex"
-local ctx = { "tex/context/base/mkiv", "tex/context/base" }
+
+local ignore, ltx, ctx = 0, 1, 2
+
+local context_module_paths = { -- [ltx] =
+ "tex/generic/context/luatex", -- [ctx] =
+ {"tex/context/base/mkiv", "tex/context/base" },
+}
local context_modules = {
--- Since 2.6 those are directly provided by the Lualibs package.
- { false, "l-lua" },
- { false, "l-lpeg" },
- { false, "l-function" },
- { false, "l-string" },
- { false, "l-table" },
- { false, "l-io" },
- { false, "l-file" },
- { false, "l-boolean" },
- { false, "l-math" },
- { false, "l-unicode" }, -- NEW UF 19.09.2018
- { false, "util-str" },
- { false, "util-fil" },
+ { ignore, "l-lua" },
+ { ignore, "l-lpeg" },
+ { ignore, "l-function" },
+ { ignore, "l-string" },
+ { ignore, "l-table" },
+ { ignore, "l-io" },
+ { ignore, "l-file" },
+ { ignore, "l-boolean" },
+ { ignore, "l-math" },
+ { ignore, "l-unicode" }, -- NEW UF 19.09.2018
+ { ignore, "util-str" },
+ { ignore, "util-fil" },
--- These constitute the fontloader proper.
- { ltx, "luatex-basics-gen" },
+ { ltx, "basics-gen" },
{ ctx, "data-con" },
- { ltx, "luatex-basics-nod" },
- { ltx, "luatex-basics-chr" }, -- NEW UF 14.12.2018
+ { ltx, "basics-nod" },
+ { ltx, "basics-chr" }, -- NEW UF 14.12.2018
{ ctx, "font-ini" },
- { ltx, "luatex-fonts-mis" }, -- NEW UF 19.09.2018
+ { ltx, "fonts-mis" }, -- NEW UF 19.09.2018
{ ctx, "font-con" },
- { ltx, "luatex-fonts-enc" },
+ { ltx, "fonts-enc" },
{ ctx, "font-cid" },
{ ctx, "font-map" },
--- { ltx, "luatex-fonts-syn" }, -- ignore??
+-- { ltx, "fonts-syn" }, -- ignore??
{ ctx, "font-vfc" }, -- NEW UF 19.09.2018
{ ctx, "font-otr" },
{ ctx, "font-oti" },
@@ -129,18 +134,17 @@ local context_modules = {
{ ctx, "font-onr" },
{ ctx, "font-one" },
{ ctx, "font-afk" },
- { ltx, "luatex-fonts-tfm" },
+ { ltx, "fonts-tfm" },
{ ctx, "font-lua" },
{ ctx, "font-def" },
- { ltx, "luatex-fonts-def" },
- { ltx, "luatex-fonts-ext" },
+ { ltx, "fonts-def" },
+ { ltx, "fonts-ext" },
{ ctx, "font-imp-tex" },
{ ctx, "font-imp-ligatures"},
{ ctx, "font-imp-italics" },
{ ctx, "font-imp-effects" },
- { ltx, "luatex-fonts-lig" },
- { ltx, "luatex-fonts-gbn" },
-
+ { ltx, "fonts-lig" },
+ { ltx, "fonts-gbn" },
} --[[context_modules]]
@@ -151,12 +155,15 @@ local function load_context_modules (pth)
logreport ("both", 2, "init",
"Loading fontloader components from context.")
- local n = #context_modules
- for i = 1, n do
- local sub, spec = unpack (context_modules [i])
- if sub == false then
+ for i = 1, #context_modules do
+ local kind, spec = unpack (context_modules [i])
+ if kind == ignore then
ignore_module (spec)
else
+ if kind == ltx then
+ spec = 'luatex-' .. spec
+ end
+ local sub = context_module_paths[kind]
local tsub = type (sub)
if not pth then
load_module (spec)
@@ -193,10 +200,10 @@ local function load_context_modules (pth)
end
local function verify_context_dir (pth)
- if lfsisdir(file.join(pth, ltx)) then
+ if lfsisdir(file.join(pth, context_module_paths[ltx])) then
return true
end
- for _, d in ipairs(ctx) do
+ for _, d in ipairs(context_module_paths[ctx]) do
if lfsisdir(file.join(pth, d)) then
return true
end
@@ -324,66 +331,13 @@ local function init_main(early_hook)
load_fontloader_module (luaotfload.fontloader_package)
elseif fontloader == "unpackaged" then
+
logreport ("log", 0, "init",
"Loading fontloader components individually.")
- --- The loading sequence is known to change, so this might have to be
- --- updated with future updates. Do not modify it though unless there is
- --- a change to the upstream package!
-
- --- Since 2.6 those are directly provided by the Lualibs package.
- ignore_module "l-lua"
- ignore_module "l-lpeg"
- ignore_module "l-function"
- ignore_module "l-string"
- ignore_module "l-table"
- ignore_module "l-io"
- ignore_module "l-file"
- ignore_module "l-boolean"
- ignore_module "l-math"
- ignore_module "util-str"
- ignore_module "util-fil"
- ignore_module "luatex-basics-gen"
-
- load_fontloader_module "data-con"
- load_fontloader_module "basics-nod"
- load_fontloader_module "basics-chr"
- load_fontloader_module "font-ini"
- load_fontloader_module "fonts-mis"
- load_fontloader_module "font-con"
- load_fontloader_module "fonts-enc"
- load_fontloader_module "font-cid"
- load_fontloader_module "font-map"
--- load_fontloader_module "fonts-syn" -- ignore?
- load_fontloader_module "font-vfc"
- load_fontloader_module "font-otr"
- load_fontloader_module "font-oti"
- load_fontloader_module "font-ott"
- load_fontloader_module "font-cff"
- load_fontloader_module "font-ttf"
- load_fontloader_module "font-dsp"
- load_fontloader_module "font-oup"
- load_fontloader_module "font-otl"
- load_fontloader_module "font-oto"
- load_fontloader_module "font-otj"
- load_fontloader_module "font-ota"
- load_fontloader_module "font-ots"
- load_fontloader_module "font-osd"
- load_fontloader_module "font-ocl"
- load_fontloader_module "font-otc"
- load_fontloader_module "font-onr"
- load_fontloader_module "font-one"
- load_fontloader_module "font-afk"
- load_fontloader_module "fonts-tfm"
- load_fontloader_module "font-lua"
- load_fontloader_module "font-def"
- load_fontloader_module "fonts-def"
- load_fontloader_module "fonts-ext"
- load_fontloader_module "font-imp-tex"
- load_fontloader_module "font-imp-ligatures"
- load_fontloader_module "font-imp-italics"
- load_fontloader_module "font-imp-effects"
- load_fontloader_module "fonts-lig"
- load_fontloader_module "fonts-gbn"
+ for i = 1, #context_modules do
+ local mod = context_modules[i];
+ (mod[1] == ignore and ignore_module or load_fontloader_module)(mod[2])
+ end
elseif fontloader == "context" then
logreport ("log", 0, "init",
diff --git a/src/luaotfload-main.lua b/src/luaotfload-main.lua
index 0c8a909..e1a9781 100644
--- a/src/luaotfload-main.lua
+++ b/src/luaotfload-main.lua
@@ -234,13 +234,13 @@ local function context_loader (name, path)
local t_end = osgettimeofday ()
timing_info.t_load [name] = t_end - t_0
- if ret ~= true then
+ if ret ~= nil then
--- require () returns “true” upon success unless the loaded file
--- yields a non-zero exit code. This isn’t per se indicating that
--- something isn’t right, but against HH’s coding practices. We’ll
--- silently ignore this ever happening on lower log levels.
luaotfload.log.report ("log", 4, "load",
- "Module %q returned %q.", ret)
+ "Module %q returned %q.", modname, ret)
end
return ret
end
More information about the latex3-commits
mailing list.