[latex3-commits] [git/LaTeX3-latex3-luaotfload] dev: luaotfload-main -> luaotfload (b8ff3e9)
Marcel Fabian Krüger
tex at 2krueger.de
Sat Sep 5 01:06:40 CEST 2020
Repository : https://github.com/latex3/luaotfload
On branch : dev
Link : https://github.com/latex3/luaotfload/commit/b8ff3e9ee23c343459bd57f954983aadf5652ba2
>---------------------------------------------------------------
commit b8ff3e9ee23c343459bd57f954983aadf5652ba2
Author: Marcel Fabian Krüger <tex at 2krueger.de>
Date: Sat Sep 5 00:20:26 2020 +0200
luaotfload-main -> luaotfload
>---------------------------------------------------------------
b8ff3e9ee23c343459bd57f954983aadf5652ba2
build.lua | 6 +-
doc/filegraph.tex | 2 +-
scripts/mkstatus | 2 +-
src/auto/luaotfload-status.lua | 2 +-
src/luaotfload-main.lua | 339 +---------------------------
src/{luaotfload-main.lua => luaotfload.lua} | 4 +-
src/luaotfload.sty | 2 +-
testfiles/aaaaa-luakern.lvt | 2 +-
8 files changed, 12 insertions(+), 347 deletions(-)
diff --git a/build.lua b/build.lua
index bc2511c..b330583 100644
--- a/build.lua
+++ b/build.lua
@@ -165,7 +165,7 @@ typesetdemofiles =
sourcefiles =
{
"luaotfload.sty",
- "**/luaotfload-*.lua",
+ "**/luaotfload*.lua",
"**/fontloader-*.lua",
"**/fontloader-*.tex",
"luaotfload-blacklist.cnf",
@@ -175,7 +175,7 @@ typesetdemofiles =
installfiles = {
"luaotfload.sty",
"luaotfload-blacklist.cnf",
- "**/luaotfload-*.lua",
+ "**/luaotfload*.lua",
"**/fontloader-*.lua",
"**/fontloader-*.tex",
}
@@ -197,7 +197,7 @@ tagfiles = {
"doc/CTANREADME.md",
"README.md",
"src/luaotfload.sty",
- "src/luaotfload-*.lua",
+ "src/luaotfload*.lua",
"src/auto/luaotfload-glyphlist.lua",
"src/auto/luaotfload-status.lua",
"doc/luaotfload-main.tex",
diff --git a/doc/filegraph.tex b/doc/filegraph.tex
index ee76912..1301319 100644
--- a/doc/filegraph.tex
+++ b/doc/filegraph.tex
@@ -103,7 +103,7 @@ label={[name=mL3,font=\itshape,anchor=south]above:Lualibs -- Lua Libraries from
%>>>>>>>>>>>>>>>>
};
% m4
-\node[left=2cm of m3,fill=gray!20,draw=gray!30,thick,basic,inner sep=6mm] (m4) {luaotfload-main.lua};
+\node[left=2cm of m3,fill=gray!20,draw=gray!30,thick,basic,inner sep=6mm] (m4) {luaotfload.lua};
% m5
\node[fill=gray!20,draw=gray!30,dashed,basic,inner sep=6mm,anchor=south west] at (m3.south -|
m2.west)(m5){%
diff --git a/scripts/mkstatus b/scripts/mkstatus
index 3da209e..075e3fb 100644
--- a/scripts/mkstatus
+++ b/scripts/mkstatus
@@ -111,7 +111,7 @@ local oldnames = {
{ srcdir, "luaotfload-letterspace.lua", },
{ srcdir, "luaotfload-loaders.lua", },
{ srcdir, "luaotfload-log.lua", },
- { srcdir, "luaotfload-main.lua", },
+ { srcdir, "luaotfload.lua", },
{ srcdir, "luaotfload-parsers.lua", },
{ srcdir, "luaotfload-resolvers.lua", },
{ srcdir, "luaotfload-tool.lua", },
diff --git a/src/auto/luaotfload-status.lua b/src/auto/luaotfload-status.lua
index 1ca7928..9993235 100644
--- a/src/auto/luaotfload-status.lua
+++ b/src/auto/luaotfload-status.lua
@@ -85,7 +85,7 @@ return {
{ "luaotfload-diagnostics.lua", "797176921da30591e6112831ed7459a7" },
{ "luaotfload-log.lua", "932117045a6abfe303314a295c24d338" },
{ "luaotfload-init.lua", "eb1bfca3833688aba31521032ed38883" },
- { "luaotfload-main.lua", "133ee97a73e07f3116d0417c9373398b" },
+ { "luaotfload.lua", "133ee97a73e07f3116d0417c9373398b" },
},
["notes"]={
["committer"]="Marcel Fabian Krüger <tex at 2krueger.de>",
diff --git a/src/luaotfload-main.lua b/src/luaotfload-main.lua
index fb3dbbb..1b029bd 100644
--- a/src/luaotfload-main.lua
+++ b/src/luaotfload-main.lua
@@ -1,341 +1,6 @@
-----------------------------------------------------------------------
-- FILE: luaotfload-main.lua
--- DESCRIPTION: OpenType layout system / luaotfload entry point
--- REQUIREMENTS: luatex v.0.95.0 or later; package lualibs
--- AUTHOR: Élie Roux, Khaled Hosny, Philipp Gesang, Ulrike Fischer, Marcel Krüger
+-- DESCRIPTION: OpenType layout system / compatibility wrapper
-----------------------------------------------------------------------
-local authors = "\z
- Hans Hagen,\z
- Khaled Hosny,\z
- Elie Roux,\z
- Will Robertson,\z
- Philipp Gesang,\z
- Dohyun Kim,\z
- Reuben Thomas,\z
- David Carlisle,\
- Ulrike Fischer,\z
- Marcel Krüger\z
-"
--- version number is used below!
-local ProvidesLuaModule = {
- name = "luaotfload-main",
- version = "3.16-dev", --TAGVERSION
- date = "2020-09-03", --TAGDATE
- description = "luaotfload entry point",
- author = authors,
- copyright = authors,
- license = "GPL v2.0"
-}
-
-if luatexbase and luatexbase.provides_module then
- luatexbase.provides_module (ProvidesLuaModule)
-end
-
-local osgettimeofday = os.gettimeofday
-config = config or { }
-luaotfload = luaotfload or { }
-local luaotfload = luaotfload
-luaotfload.log = luaotfload.log or { }
-local logreport
-luaotfload.version = ProvidesLuaModule.version
-luaotfload.loaders = { }
-luaotfload.fontloader_package = "reference" --- default: from current Context
-
-if not tex or not tex.luatexversion then
- error "this program must be run in TeX mode" --- or call tex.initialize() =)
-end
-
---- version check
-local revno = tonumber(tex.luatexrevision)
-local minimum = { 110, 0 }
-if tex.luatexversion < minimum[1] or tex.luatexversion == minimum[1] and revno < minimum[2] then
- texio.write_nl ("term and log",
- string.format ("\tFATAL ERROR\n\z
- \tLuaotfload requires a Luatex version >= %d.%d.%d.\n\z
- \tPlease update your TeX distribution!\n\n",
- math.floor(minimum[1] / 100), minimum[1] % 100, minimum[2]))
- error "version check failed"
-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 %q\n\z
- \tThis probably means that the engine is not supported\n\z
- \n",
- _VERSION))
- error "module utf8 is unavailable"
-end
-
-if status.safer_option ~= 0 then
- texio.write_nl("term and log","luaotfload can't run with option --safer. Aborting")
- error("safer_option used")
-end
-
-
-
-
---[[doc--
-
- This file initializes the system and loads the font loader. To
- minimize potential conflicts between other packages and the code
- imported from \CONTEXT, several precautions are in order. Some of
- the functionality that the font loader expects to be present, like
- raw access to callbacks, are assumed to have been disabled by
- \identifier{luatexbase} when this file is processed. In some cases
- it is possible to trick it by putting dummies into place and
- restoring the behavior from \identifier{luatexbase} after
- initilization. Other cases such as attribute allocation require
- that we hook the functionality from \identifier{luatexbase} into
- locations where they normally wouldn’t be.
-
- Anyways we can import the code base without modifications, which is
- due mostly to the extra effort by Hans Hagen to make \LUATEX-Fonts
- self-contained and encapsulate it, and especially due to his
- willingness to incorporate our suggestions.
-
---doc]]--
-
-local luatexbase = luatexbase
-local require = require
-local type = type
-
-
---[[doc--
-
- \subsection{Module loading}
- We load the files imported from \CONTEXT with function derived this way. It
- automatically prepends a prefix to its argument, so we can refer to the
- files with their actual \CONTEXT name.
-
---doc]]--
-
-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
- texio.write_nl ("log",
- string.format ("luaotfload | %s : ",
- tostring (cat)))
- texio.write (string.format (...))
- end
- if not name then
- msg ("both", 0, "load",
- "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 %q unmodified.",
- name)
- return tostring (name) .. ".lua"
- end
- prefix = tostring (prefix)
- msg ("log", 9, "load",
- "Composing module name from constituents %s, %s.",
- prefix, name)
- return prefix .. "-" .. name .. ".lua"
-end
-
-local timing_info = {
- t_load = { },
- t_init = { },
-}
-
-local function make_loader (prefix, load_helper)
- return function (name)
- local t_0 = osgettimeofday ()
- local modname = make_loader_name (prefix, name)
- --- We don’t want the stack info from inside, so just pcall().
- local ok, data = pcall (load_helper or require, modname)
- local t_end = osgettimeofday ()
- timing_info.t_load [name] = t_end - t_0
- if not ok then
- 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 %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)
- else
- msg ("both", 0, "load", " × Error message:")
- for i = 1, #lines do
- msg ("both", 0, "load", " × %q.", lines [i])
- end
- end
- io.write "\n\n"
- local debug = debug
- if debug then
- io.write (debug.traceback())
- io.write "\n\n"
- end
- os.exit(-1)
- end
- return data
- end
-end
-
---[[doc--
- Certain files are kept around that aren’t loaded because they are part of
- the imported fontloader. In order to keep the initialization structure
- intact we also provide a no-op version of the module loader that can be
- called in the expected places.
---doc]]--
-
-local function dummy_loader (name)
- luaotfload.log.report ("log", 3, "load",
- "Skipping module %q on purpose.",
- name)
-end
-
-local context_environment = setmetatable({}, {__index = _G})
-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 %q could not be found.', name))
- end
- return assert(loadfile(fullname, nil, context_environment))(name)
-end
-
-local function context_loader (name, path)
- luaotfload.log.report ("log", 3, "load",
- "Loading module %q from Context.",
- name)
- local t_0 = osgettimeofday ()
- local modname = make_loader_name (false, name)
- local modpath = modname
- if path then
- if lfs.isdir (path) then
- luaotfload.log.report ("log", 3, "load",
- "Prepending path %q.",
- path)
- modpath = file.join (path, modname)
- else
- luaotfload.log.report ("both", 0, "load",
- "Non-existant path %q specified, ignoring.",
- path)
- end
- end
- local ret = context_isolated_load (modpath)
- local t_end = osgettimeofday ()
- timing_info.t_load [name] = t_end - t_0
-
- 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.", modname, ret)
- end
- return ret
-end
-
-local function install_loaders ()
- local loaders = { }
- local loadmodule = make_loader "luaotfload"
- loaders.luaotfload = loadmodule
- loaders.fontloader = make_loader ("fontloader", context_isolated_load)
- loaders.context = context_loader
- loaders.ignore = dummy_loader
-----loaders.plaintex = make_loader "luatex" --=> for Luatex-Plain
-
- function loaders.initialize (name)
- local tmp = loadmodule (name)
- 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 %q.", name)
- return
- end
- local t_end = osgettimeofday ()
- local d_t = t_end - t_0
- logreport ("log", 4, "load",
- "Module %q loaded in %g ms.",
- name, d_t * 1000)
- timing_info.t_init [name] = d_t
- end
- end
-
- return loaders
-end
-
-local luaotfload_initialized = false --- prevent multiple invocations
-
-luaotfload.main = function ()
-
- if luaotfload_initialized then
- logreport ("log", 0, "load",
- "Luaotfload initialization requested but is already \z
- loaded, ignoring.")
- return
- end
- luaotfload_initialized = true
-
- luaotfload.loaders = install_loaders ()
- local loaders = luaotfload.loaders
- local loadmodule = loaders.luaotfload
- 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)
-
- initialize "loaders" --- Font loading; callbacks
- initialize "database" --- Font management.
- initialize "colors" --- Per-font colors.
-
- local init_resolvers = loadmodule "resolvers" --- Font lookup
- init_resolvers ()
-
- if not config.actions.reconfigure () then
- logreport ("log", 0, "load", "Post-configuration hooks failed.")
- end
-
- initialize "features" --- font request and feature handling
-
- if harfstatus then
- 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 "tounicode"
- if tex.outputmode == 0 then
- loadmodule "dvi" --- allow writing fonts to DVI files
- end
-
- luaotfload.aux.start_rewrite_fontname () --- to be migrated to fontspec
-
- logreport ("log", 1, "main",
- "initialization completed in %0.3f seconds\n",
- osgettimeofday() - starttime)
-----inspect (timing_info)
-end
-
--- vim:tw=79:sw=4:ts=4:et
+return require'luaotfload'
diff --git a/src/luaotfload-main.lua b/src/luaotfload.lua
similarity index 99%
copy from src/luaotfload-main.lua
copy to src/luaotfload.lua
index fb3dbbb..0213ff3 100644
--- a/src/luaotfload-main.lua
+++ b/src/luaotfload.lua
@@ -1,5 +1,5 @@
-----------------------------------------------------------------------
--- FILE: luaotfload-main.lua
+-- FILE: luaotfload.lua
-- DESCRIPTION: OpenType layout system / luaotfload entry point
-- REQUIREMENTS: luatex v.0.95.0 or later; package lualibs
-- AUTHOR: Élie Roux, Khaled Hosny, Philipp Gesang, Ulrike Fischer, Marcel Krüger
@@ -19,7 +19,7 @@ local authors = "\z
"
-- version number is used below!
local ProvidesLuaModule = {
- name = "luaotfload-main",
+ name = "luaotfload",
version = "3.16-dev", --TAGVERSION
date = "2020-09-03", --TAGDATE
description = "luaotfload entry point",
diff --git a/src/luaotfload.sty b/src/luaotfload.sty
index 2418135..298c9db 100644
--- a/src/luaotfload.sty
+++ b/src/luaotfload.sty
@@ -43,7 +43,7 @@
\fi
\directlua{
if xpcall(function ()%
- require('luaotfload-main')%
+ require('luaotfload')%
end,texio.write_nl) then %
local _void = luaotfload.main ()%
else %
diff --git a/testfiles/aaaaa-luakern.lvt b/testfiles/aaaaa-luakern.lvt
index 635b9a3..fd9413c 100644
--- a/testfiles/aaaaa-luakern.lvt
+++ b/testfiles/aaaaa-luakern.lvt
@@ -15,7 +15,7 @@ abc
texio.write_nl(luaotfload.version .. " with " .. string.gsub(tostring(config.luaotfload.run.fontloader),"[%-]","xxx"))
--- t = {kpse.lookup("luaotfload-main.lua",{["all"]=true})}
+-- t = {kpse.lookup("luaotfload.lua",{["all"]=true})}
--
-- texio.write_nl(table.serialize(t))
--
More information about the latex3-commits
mailing list.