summaryrefslogtreecommitdiff
path: root/macros/luatex/generic/luaotfload/luaotfload-main.lua
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2020-05-03 03:02:51 +0000
committerNorbert Preining <norbert@preining.info>2020-05-03 03:02:51 +0000
commitd78de17ddf0443233483fd98f40802cae5aa87c5 (patch)
tree1b7128cc505808a09c18e158288d6c3cdcf5c2fb /macros/luatex/generic/luaotfload/luaotfload-main.lua
parent8626a9c3cb5dc8d02d779d5b5b1e3933d5626f43 (diff)
CTAN sync 202005030302
Diffstat (limited to 'macros/luatex/generic/luaotfload/luaotfload-main.lua')
-rw-r--r--macros/luatex/generic/luaotfload/luaotfload-main.lua69
1 files changed, 37 insertions, 32 deletions
diff --git a/macros/luatex/generic/luaotfload/luaotfload-main.lua b/macros/luatex/generic/luaotfload/luaotfload-main.lua
index 35378d91cb..1c962c3950 100644
--- a/macros/luatex/generic/luaotfload/luaotfload-main.lua
+++ b/macros/luatex/generic/luaotfload/luaotfload-main.lua
@@ -20,8 +20,8 @@ local authors = "\z
-- version number is used below!
local ProvidesLuaModule = {
name = "luaotfload-main",
- version = "3.12", --TAGVERSION
- date = "2020-02-02", --TAGDATE
+ version = "3.13", --TAGVERSION
+ date = "2020-05-01", --TAGDATE
description = "luaotfload entry point",
author = authors,
copyright = authors,
@@ -37,6 +37,7 @@ config = config or { }
luaotfload = luaotfload or { }
local luaotfload = luaotfload
luaotfload.log = luaotfload.log or { }
+local logreport
luaotfload.version = ProvidesLuaModule.version
luaotfload.loaders = { }
luaotfload.min_luatex_version = { 0, 95, 0 }
@@ -68,7 +69,7 @@ end
if not utf8 then
texio.write_nl("term and log", string.format("\z
\tluaotfload: module utf8 is unavailable\n\z
- \tutf8 is available in Lua 5.3+; engine\'s _VERSION is '%s'\n\z
+ \tutf8 is available in Lua 5.3+; engine\'s _VERSION is %q\n\z
\tThis probably means that the engine is not supported\n\z
\n",
_VERSION))
@@ -118,7 +119,7 @@ local type = type
--doc]]--
-local make_loader_name = function (prefix, name)
+local function make_loader_name (prefix, name)
local msg = luaotfload.log and luaotfload.log.report
or function (stream, lvl, cat, ...)
if lvl > 1 then --[[not pressing]] return end
@@ -129,14 +130,14 @@ local make_loader_name = function (prefix, name)
end
if not name then
msg ("both", 0, "load",
- "Fatal error: make_loader_name (“%s”, “%s”).",
+ "Fatal error: make_loader_name (%q, %q).",
tostring (prefix), tostring (name))
return "dummy-name"
end
name = tostring (name)
if prefix == false then
msg ("log", 9, "load",
- "No prefix requested, passing module name “%s” unmodified.",
+ "No prefix requested, passing module name %q unmodified.",
name)
return tostring (name) .. ".lua"
end
@@ -152,7 +153,7 @@ local timing_info = {
t_init = { },
}
-local make_loader = function (prefix, load_helper)
+local function make_loader (prefix, load_helper)
return function (name)
local t_0 = osgettimeofday ()
local modname = make_loader_name (prefix, name)
@@ -164,8 +165,8 @@ local make_loader = function (prefix, load_helper)
io.write "\n"
local msg = luaotfload.log and luaotfload.log.report or print
msg ("both", 0, "load", "FATAL ERROR")
- msg ("both", 0, "load", " × Failed to load module %q.",
- tostring (modname))
+ msg ("both", 0, "load", " × Failed to load %q module %q.",
+ tostring (prefix), tostring (name))
local lines = string.split (data, "\n\t")
if not lines then
msg ("both", 0, "load", " × Error message: %q", data)
@@ -194,9 +195,9 @@ end
called in the expected places.
--doc]]--
-local dummy_loader = function (name)
+local function dummy_loader (name)
luaotfload.log.report ("log", 3, "load",
- "Skipping module “%s” on purpose.",
+ "Skipping module %q on purpose.",
name)
end
@@ -205,14 +206,14 @@ luaotfload.fontloader = context_environment
local function context_isolated_load(name)
local fullname = kpse.find_file(name, 'lua')
if not fullname then
- error(string.format('Fontloader module "%s" could not be found.', name))
+ error(string.format('Fontloader module %q could not be found.', name))
end
return assert(loadfile(fullname, nil, context_environment))(name)
end
-local context_loader = function (name, path)
+local function context_loader (name, path)
luaotfload.log.report ("log", 3, "load",
- "Loading module “%s” from Context.",
+ "Loading module %q from Context.",
name)
local t_0 = osgettimeofday ()
local modname = make_loader_name (false, name)
@@ -220,12 +221,12 @@ local context_loader = function (name, path)
if path then
if lfs.isdir (path) then
luaotfload.log.report ("log", 3, "load",
- "Prepending path “%s”.",
+ "Prepending path %q.",
path)
modpath = file.join (path, modname)
else
luaotfload.log.report ("both", 0, "load",
- "Non-existant path “%s” specified, ignoring.",
+ "Non-existant path %q specified, ignoring.",
path)
end
end
@@ -239,12 +240,12 @@ local context_loader = function (name, path)
--- 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 “%s” returned “%s”.", ret)
+ "Module %q returned %q.", ret)
end
return ret
end
-local install_loaders = function ()
+local function install_loaders ()
local loaders = { }
local loadmodule = make_loader "luaotfload"
loaders.luaotfload = loadmodule
@@ -253,22 +254,21 @@ local install_loaders = function ()
loaders.ignore = dummy_loader
----loaders.plaintex = make_loader "luatex" --=> for Luatex-Plain
- loaders.initialize = function (name)
+ function loaders.initialize (name)
local tmp = loadmodule (name)
- local logreport = luaotfload.log.report
local init = type(tmp) == "table" and tmp.init or tmp
if init and type (init) == "function" then
local t_0 = osgettimeofday ()
if not init () then
logreport ("log", 0, "load",
- "Failed to load module “%s”.", name)
+ "Failed to load module %q.", name)
return
end
local t_end = osgettimeofday ()
local d_t = t_end - t_0
logreport ("log", 4, "load",
- "Module “%s” loaded in %d ms.",
- name, d_t)
+ "Module %q loaded in %g ms.",
+ name, d_t * 1000)
timing_info.t_init [name] = d_t
end
end
@@ -294,15 +294,22 @@ luaotfload.main = function ()
local initialize = loaders.initialize
local starttime = osgettimeofday ()
+
+ -- Feature detect HarfBuzz. This is done early to allow easy HarfBuzz
+ -- detection in other modules
+ local harfstatus, harfbuzz = pcall(require, 'luaharfbuzz')
+ if harfstatus then
+ luaotfload.harfbuzz = harfbuzz
+ end
+
local init = loadmodule "init" --- fontloader initialization
init (function ()
+ logreport = luaotfload.log.report
initialize "parsers" --- fonts.conf and syntax
initialize "configuration" --- configuration options
end)
- local logreport = luaotfload.log.report
-
initialize "loaders" --- Font loading; callbacks
initialize "database" --- Font management.
initialize "colors" --- Per-font colors.
@@ -316,18 +323,16 @@ luaotfload.main = function ()
initialize "features" --- font request and feature handling
- loadmodule "letterspace" --- extra character kerning
- loadmodule "embolden" --- fake bold
- loadmodule "notdef" --- missing glyph handling
- local harfstatus, harfbuzz = pcall(require, 'luaharfbuzz')
if harfstatus then
- luaotfload.harfbuzz = harfbuzz
loadmodule "harf-define"
loadmodule "harf-plug"
end
+ loadmodule "letterspace" --- extra character kerning
+ loadmodule "embolden" --- fake bold
+ loadmodule "notdef" --- missing glyph handling
+ loadmodule "suppress" --- suppress ligatures by adding ZWNJ
+ loadmodule "szss" --- missing glyph handling
initialize "auxiliary" --- additional high-level functionality
- loadmodule "fallback" --- ...
- loadmodule "multiscript" --- ...
loadmodule "tounicode"
luaotfload.aux.start_rewrite_fontname () --- to be migrated to fontspec