summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile20
-rw-r--r--NEWS2
-rw-r--r--doc/filegraph.dot3
-rwxr-xr-x[-rw-r--r--]scripts/mkimport152
-rwxr-xr-xscripts/mkstatus62
-rw-r--r--src/fontloader/luaotfload-package.lua6
-rw-r--r--src/fontloader/runtime/fontloader-reference.lua (renamed from src/fontloader/runtime/fontloader-fontloader.lua)0
-rw-r--r--src/luaotfload-configuration.lua6
-rw-r--r--src/luaotfload-init.lua138
-rw-r--r--src/luaotfload-letterspace.lua9
-rw-r--r--src/luaotfload-log.lua49
-rw-r--r--src/luaotfload-main.lua12
-rw-r--r--src/luaotfload-override.lua52
13 files changed, 331 insertions, 180 deletions
diff --git a/Makefile b/Makefile
index ab5c464..bd0021b 100644
--- a/Makefile
+++ b/Makefile
@@ -6,6 +6,7 @@ DOCSRCDIR = ./doc
SCRIPTSRCDIR = ./scripts
SRCSRCDIR = ./src
FONTLOADERDIR = $(SRCSRCDIR)/fontloader/runtime
+PACKAGEDIR = $(SRCSRCDIR)/fontloader
BUILDDIR = ./build
MISCDIR = ./misc
@@ -48,7 +49,8 @@ DOCS = $(DOCPDF) $(DOTPDF) $(MANPAGES)
GLYPHS = $(BUILDDIR)/$(NAME)-glyphlist.lua
CHARS = $(BUILDDIR)/$(NAME)-characters.lua
STATUS = $(BUILDDIR)/$(NAME)-status.lua
-RESOURCES = $(GLYPHS) $(CHARS) $(STATUS)
+LOADER = $(BUILDDIR)/fontloader-$(shell date +%F).lua
+RESOURCES = $(GLYPHS) $(CHARS) $(LOADER) $(STATUS)
SOURCE = $(DOCSRC) $(MANSRC) $(SRC) README COPYING Makefile NEWS $(RESOURCESCRIPTS)
# Files grouped by installation location
@@ -88,8 +90,10 @@ LUA = texlua
## variables.
DO_GLYPHS = $(LUA) $(GLYPHSCRIPT) > /dev/null
DO_CHARS = $(LUA) $(CHARSCRIPT) > /dev/null
-DO_STATUS = $(LUA) $(STATUSSCRIPT) > /dev/null
-DO_IMPORT = $(LUA) $(IMPORTSCRIPT) > /dev/null
+DO_STATUS = $(LUA) $(STATUSSCRIPT) --fontloader=$(LOADER) >/dev/null
+DO_IMPORT = $(LUA) $(IMPORTSCRIPT) import >/dev/null
+DO_PACKAGE = $(LUA) $(IMPORTSCRIPT) package \
+ $(PACKAGEDIR)/luaotfload-package.lua $(LOADER) >/dev/null
define check-lua-files
@echo validating syntax
@@ -113,8 +117,12 @@ builddir: $(BUILDDIR)
resources: $(RESOURCES)
chars: $(CHARS)
status: $(STATUS)
+package: loader
+loader: $(LOADER)
ctan: $(CTAN_ZIP)
tds: $(TDS_ZIP)
+import:
+ $(DO_IMPORT)
graph: $(DOTPDF)
doc: $(DOCS)
@@ -136,9 +144,12 @@ $(GLYPHS): builddir
$(CHARS): builddir
$(DO_CHARS)
-$(STATUS): builddir
+$(STATUS): builddir loader
$(DO_STATUS)
+$(LOADER): builddir
+ $(DO_PACKAGE)
+
$(BUILDDIR): /dev/null
mkdir -p $(BUILDDIR)
@@ -222,6 +233,7 @@ showtargets:
@echo " luaotfload.conf(5) (requires Docutils)"
@echo " graph generate file graph (requires GraphViz)"
@echo
+ @echo " loader merge fontloader"
@echo " chars import char-def.lua as luaotfload-characters.lua"
@echo " status create repository info (luaotfload-status.lua)"
@echo
diff --git a/NEWS b/NEWS
index 7902abc..c36825b 100644
--- a/NEWS
+++ b/NEWS
@@ -11,6 +11,8 @@ Change History
* Revised letterspacing, now utilizing the ``node.direct`` interface
* Revized colorization of fonts, utilizing ``node.direct`` (Dohyun Kim)
* Colorization was moved to the ``post_linebreak_filter`` stage
+ * Move remaining functionality from ``luaotfload-override`` into
+ initialization
2014/07/13, luaotfload v2.5
* Remove legacy code.
diff --git a/doc/filegraph.dot b/doc/filegraph.dot
index 47db9ea..e1a9937 100644
--- a/doc/filegraph.dot
+++ b/doc/filegraph.dot
@@ -199,10 +199,9 @@ strict digraph luaotfload_files { //looks weird with circo ...
<table cellborder="0" bgcolor="#FFFFFFAA">
<th> <td colspan="2"> <font point-size="12" face="Iwona Italic">Luaotfload Libraries</font> </td> </th>
<tr> <td>luaotfload-auxiliary.lua</td> <td>luaotfload-features.lua</td> </tr>
- <tr> <td>luaotfload-override.lua</td> <td>luaotfload-loaders.lua</td> </tr>
+ <tr> <td>luaotfload-loaders.lua</td> <td>luaotfload-color.lua</td> </tr>
<tr> <td>luaotfload-log.lua</td> <td>luaotfload-letterspace.lua</td> </tr>
<tr> <td>luaotfload-parsers.lua</td> <td>luaotfload-database.lua</td> </tr>
- <tr> <td>luaotfload-color.lua</td> </tr>
</table>
>,
]
diff --git a/scripts/mkimport b/scripts/mkimport
index a430587..0833ccb 100644..100755
--- a/scripts/mkimport
+++ b/scripts/mkimport
@@ -1,7 +1,7 @@
#!/usr/bin/env texlua
-------------------------------------------------------------------------------
-- FILE: mkimport.lua
--- USAGE: ./mkimport.lua
+-- USAGE: texlua ./mkimport.lua
-- DESCRIPTION: check luaotfload imports against Context
-- REQUIREMENTS: luatex, the lualibs package, Context MkIV
-- AUTHOR: Philipp Gesang (Phg), <phg@phi-gamma.net>
@@ -12,12 +12,15 @@
-------------------------------------------------------------------------------
--- PURPOSE
----
+---
--- - Facilitate detecting changes in the fontloader source.
--- - Assist in updating source code and (partially) automate importing.
+---
--- - Account for files in the plain fontloader distribution, alert in case of
--- additions or deletions.
----
+---
+--- - Fontloader packaging.
+---
-------------------------------------------------------------------------------
local debug = false
@@ -26,18 +29,23 @@ kpse.set_program_name "luatex"
local lfs = require "lfs"
local md5 = require "md5"
+local os = require "os"
require "lualibs"
+local filedirname = file.dirname
local fileiswritable = file.is_writable
local ioloaddata = io.loaddata
local iopopen = io.popen
local iowrite = io.write
local lfschdir = lfs.chdir
+local lfscurrentdir = lfs.currentdir
local lfsisdir = lfs.isdir
local lfsisfile = lfs.isfile
local md5sumhexa = md5.sumhexa
+local osdate = os.date
local osgettimeofday = os.gettimeofday
+local osrename = os.rename
local stringformat = string.format
local tableconcat = table.concat
@@ -71,6 +79,26 @@ local prefixes = {
fontloader = "luatex",
}
+--[[doc--
+
+ The output name is fixed so we have to deal with it but maybe we
+ can get a patch to mtx-package upstreamed in the future. In any
+ case, we are content with renaming the result for the time being.
+
+ The target name is constructed on the fly from the current date.
+ TODO It should be possible to supply a name and possibly
+ destination path on the command line.
+
+ Paths are relative to the base directory (``$PWD``).
+
+--doc]]--
+
+local loader_merge_name = "luaotfload-package.lua"
+local loader_output_name = "luaotfload-package-merged.lua"
+local loader_target_name = "fontloader-%s.lua"
+local loader_orig_dir = "/src/fontloader/"
+local loader_target_dir = "/build/"
+
-------------------------------------------------------------------------------
-- helpers
-------------------------------------------------------------------------------
@@ -169,7 +197,7 @@ local imports = {
{ name = "fonts-ext" , ours = nil , kind = kind_merged },
{ name = "fonts-inj" , ours = nil , kind = kind_merged },
{ name = "fonts-lua" , ours = nil , kind = kind_merged },
- { name = "fonts-merged" , ours = "fontloader" , kind = kind_essential },
+ { name = "fonts-merged" , ours = "reference" , kind = kind_essential },
{ name = "fonts-ota" , ours = nil , kind = kind_merged },
{ name = "fonts-otn" , ours = nil , kind = kind_merged },
{ name = "fonts" , ours = nil , kind = kind_merged },
@@ -641,6 +669,49 @@ local tell = function (arg)
return describe (target, location)
end
+local build_paths = function (argv)
+ if not argv or type (argv) ~= "table" then die "build_paths" end
+
+ local orig_dir = lfscurrentdir ()
+ local base_dir = orig_dir .. loader_orig_dir
+ local target_name = orig_dir .. loader_target_dir
+ .. stringformat (loader_target_name, os.date ("%F"))
+ local merge_name = base_dir .. loader_merge_name
+ local output_name = base_dir .. loader_output_name
+
+ if #argv >= 2 then
+ local fname = argv[2]
+ local dir = filedirname (fname) .. "/"
+ if not lfsisdir (dir) then
+ die ("second argument must be point into existing directory, not “%s”",
+ argv[2])
+ end
+ base_dir = dir
+ merge_name = fname
+ output_name = dir .. loader_output_name
+ end
+
+ if #argv == 3 then
+ --- also set the target name
+ local fname = argv[3]
+ local dir = filedirname (fname)
+ if not lfsisdir (dir) then
+ die ("third argument must be point into writable directory, not “%s”",
+ argv[3])
+ end
+ target_name = fname
+ end
+
+ local ret = {
+ orig_dir = orig_dir,
+ base_dir = base_dir,
+ merge_name = merge_name,
+ target_name = target_name,
+ output_name = output_name,
+ }
+ return ret
+end
+
--[[doc--
Packaging works as follows:
@@ -659,43 +730,40 @@ end
--doc]]--
-local package = function (args)
- local t0 = osgettimeofday ()
- local orig_dir = lfs.currentdir ()
- local base_dir = orig_dir .. "/src/fontloader/"
- local merge_name = base_dir .. "luaotfload-package.lua"
- --- output name is fixed so we have to deal with it but maybe we can
- --- get a patch to mtx-package upstreamed in the future
- local output_name = base_dir .. "luaotfload-package-merged.lua"
- local target_name = stringformat ("fontloader-%s.lua",
- os.date ("%F"))
- status ("assuming fontloader source in %s", base_dir)
- status ("reading merge instructions from %s", merge_name)
- status ("writing output to %s", target_name)
+local package = function (argv)
+ local t0 = osgettimeofday ()
+ local paths = build_paths (argv)
+
+ status ("assuming fontloader source in %s", paths.base_dir)
+ status ("reading merge instructions from %s", paths.merge_name)
+ status ("mtx-package result at %s", paths.output_name)
+ status ("writing output to %s", paths.target_name)
--- check preconditions
- if not lfsisdir (base_dir) then die ("directory %s does not exist", emphasis (base_dir )) end
- if not lfsisfile (merge_name) then die ("missing merge file at %s", emphasis (merge_name )) end
- if not fileiswritable (output_name) then die ("cannot write to %s", emphasis (output_name)) end
- if not fileiswritable (target_name) then die ("cannot write to %s", emphasis (target_name)) end
- if not lfschdir (base_dir) then die ("failed to cd into %s", emphasis (base_dir )) end
+ if not lfsisdir (paths.base_dir) then die ("directory %s does not exist", emphasis (paths.base_dir )) end
+ if not lfsisfile (paths.merge_name) then die ("missing merge file at %s", emphasis (paths.merge_name )) end
+ if not fileiswritable (paths.output_name) then die ("cannot write to %s", emphasis (paths.output_name)) end
+ if not fileiswritable (paths.target_name) then die ("cannot write to %s", emphasis (paths.target_name)) end
+---- not lfschdir (paths.base_dir) then die ("failed to cd into %s", emphasis (paths.base_dir )) end
- if lfsisfile (output_name) then
- status ("output file already exists at “%s”, unlinking", output_name)
- local ret, err = os.remove (output_name)
+ if lfsisfile (paths.output_name) then
+ status ("output file already exists at “%s”, unlinking",
+ paths.output_name)
+ local ret, err = os.remove (paths.output_name)
if ret == nil then
- if not lfschdir (orig_dir) then
- status ("warning: failed to cd retour into %s", emphasis (orig_dir))
+ if not lfschdir (paths.orig_dir) then
+ status ("warning: failed to cd retour into %s",
+ emphasis (paths.orig_dir))
end
die ("failed to remove existing merge package")
end
end
- --die ("missing merge file at %s", emphasis (merge_name )) end
+ --die ("missing merge file at %s", emphasis (paths.merge_name )) end
--- perform merge
- local cmd = { "mtxrun", "--script", "package", "--merge", merge_name }
+ local cmd = { "mtxrun", "--script", "package", "--merge", paths.merge_name }
local shl = tableconcat (cmd, " ")
status ("invoking %s as “%s”", emphasis "mtx-package", shl)
@@ -703,8 +771,9 @@ local package = function (args)
local fh = iopopen (shl, "r")
if not fh then
- if not lfschdir (orig_dir) then
- status ("warning: failed to cd retour into %s", emphasis (orig_dir))
+ if not lfschdir (paths.orig_dir) then
+ status ("warning: failed to cd retour into %s",
+ emphasis (paths.orig_dir))
end
die ("merge failed; failed to invoke mtxrun")
end
@@ -720,19 +789,34 @@ local package = function (args)
--- clean up
- if not lfschdir (orig_dir) then
- status ("warning: failed to cd retour into %s", emphasis (orig_dir))
+ if not lfschdir (paths.orig_dir) then
+ status ("warning: failed to cd retour into %s",
+ emphasis (paths.orig_dir))
end
--- check postconditions
- if not lfsisfile (output_name) then die ("merge failed; package not found at " .. output_name) end
+ if not lfsisfile (paths.output_name) then
+ die ("merge failed; package not found at " .. paths.output_name)
+ end
--- at this point we know that mtxrun was invoked correctly and the
--- result file has been created
+ if lfsisfile (paths.target_name) then
+ status ("target file %s exists, overwriting", emphasis (paths.target_name))
+ end
+
+ local res, err = osrename (paths.output_name, paths.target_name)
+
+ if res == nil then
+ die ("merge failed; failed to move package from %s to %s",
+ paths.output_name, paths.target_name)
+ end
+
status ("merge complete; operation finished in %.0f ms",
(osgettimeofday() - t0) * 1000)
+ status ("a fresh fontloader at %s is ready to roll", paths.target_name)
end
local help = function ()
diff --git a/scripts/mkstatus b/scripts/mkstatus
index e18abb7..809d4af 100755
--- a/scripts/mkstatus
+++ b/scripts/mkstatus
@@ -26,6 +26,7 @@ local iosavedata = io.savedata
local iopopen = io.popen
local iowrite = io.write
local lfsisdir = lfs.isdir
+local stringmatch = string.match
-----------------------------------------------------------------------
-- settings
@@ -55,8 +56,8 @@ local names = {
{ "src", "luaotfload-loaders.lua", },
{ "src", "luaotfload-log.lua", },
{ "src", "luaotfload-main.lua", },
- { "src/fontloader/runtime", "fontloader-fontloader.lua", },
- { "src", "luaotfload-override.lua", },
+ { "src/fontloader/runtime", "fontloader-reference.lua", },
+ --{ "src", "luaotfload-override.lua", }, --> part of init now
{ "src", "luaotfload-parsers.lua", },
{ "src", "luaotfload-tool.lua", },
{ "scripts", "mkcharacters", },
@@ -121,8 +122,9 @@ end
local hash_all
hash_all = function (list, acc)
- if list == nil then
- return hash_all (table.fastcopy (names), { })
+ if acc == nil then
+ local base = table.fastcopy (names)
+ return hash_all (table.append (base, list), { })
end
local finfo = list[#list]
@@ -156,10 +158,58 @@ hash_all = function (list, acc)
return acc
end
+local handle_argv = function (argv)
+ local ret = { files = { }, loader = nil }
+ local argc = #argv
+ if argc < 1 then return ret end
+ local argoff = 1
+ if argv [1] == "-v" then
+ verbose = true
+ if argc == 1 then return ret end
+ argoff = 2
+ end
+ local aux aux = function (acc, i)
+ if i > argc then return acc else
+ local cur = argv[i]
+ if type (cur) == "string" then
+ local loader = stringmatch (cur, "--fontloader=(.+)$")
+ if loader then
+ cur = loader
+ acc.loader = file.basename (cur)
+ end
+ if lfs.isfile (cur) then
+ local files = acc.files
+ files[#files + 1] = cur
+ end
+ else
+ die ("file not found: %s", tostring (cur))
+ end
+ return aux (acc, i + 1)
+ end
+ end
+ return aux (ret, argoff)
+end
+
+local add_files
+add_files = function (lst, acc)
+ if lst == nil then return end
+ if acc == nil then return add_files (lst, { }) end
+ local len = #lst
+ if len == 0 then return acc end
+ local cur = lst[len]
+ local fname = file.basename (cur)
+ local path = file.dirname (cur)
+ acc[#acc + 1] = { path, fname }
+ lst[len] = nil
+ return add_files (lst, acc)
+end
+
local main = function ()
- if arg [1] == "-v" then verbose = true end
- local hashes = hash_all ()
+ local raw_extra = handle_argv (arg)
+ local cuit_extra = add_files (raw_extra.files)
+ local hashes = hash_all (cuit_extra)
local notes = git_info ()
+ notes.loader = raw_extra.loader
local serialized = table.serialize ({ notes = notes,
hashes = hashes }, true)
local success = io.savedata (filelist, serialized)
diff --git a/src/fontloader/luaotfload-package.lua b/src/fontloader/luaotfload-package.lua
index b60ae17..725c498 100644
--- a/src/fontloader/luaotfload-package.lua
+++ b/src/fontloader/luaotfload-package.lua
@@ -63,12 +63,16 @@ loadmodule "l-boolean.lua"
loadmodule "l-math.lua"
loadmodule "util-str.lua"
+--- Another file containing auxiliary definitions must be present
+--- prior to initialization of the configuration.
+
+loadmodule "luatex-basics-gen.lua"
+
--- The files below constitute the “fontloader proper”. Some of the
--- functionality like file resolvers is overloaded later by
--- Luaotfload. Consequently, the resulting package is pretty
--- bare-bones and not usable independently.
-loadmodule("luatex-basics-gen.lua")
loadmodule("data-con.lua")
loadmodule("luatex-basics-nod.lua")
loadmodule("font-ini.lua")
diff --git a/src/fontloader/runtime/fontloader-fontloader.lua b/src/fontloader/runtime/fontloader-reference.lua
index d8095a2..d8095a2 100644
--- a/src/fontloader/runtime/fontloader-fontloader.lua
+++ b/src/fontloader/runtime/fontloader-reference.lua
diff --git a/src/luaotfload-configuration.lua b/src/luaotfload-configuration.lua
index e9393c5..e2cfbd8 100644
--- a/src/luaotfload-configuration.lua
+++ b/src/luaotfload-configuration.lua
@@ -140,9 +140,9 @@ local feature_presets = {
--doc]]--
local registered_loaders = {
- default = "fontloader",
- fontloader = "fontloader",
- tl2013 = "tl2013",
+ default = luaotfloadstatus and luaotfloadstatus.notes.loader or "reference",
+ reference = "reference",
+ tl2014 = "tl2014",
}
--[[doc--
diff --git a/src/luaotfload-init.lua b/src/luaotfload-init.lua
index feff4cc..0ef968d 100644
--- a/src/luaotfload-init.lua
+++ b/src/luaotfload-init.lua
@@ -65,7 +65,7 @@ local logreport --- filled in after loading the log module
--doc]]--
-local init_pre = function ()
+local init_early = function ()
local store = { }
config = config or { } --- global
@@ -74,6 +74,7 @@ local init_pre = function ()
config.lualibs.verbose = false
config.lualibs.prefer_merged = true
config.lualibs.load_extended = true
+ fonts = fonts or { }
require "lualibs"
@@ -131,8 +132,10 @@ local init_pre = function ()
return number
end
+ luaotfload.loaders.fontloader "basics-gen"
+
return store
-end --- [init_pre]
+end --- [init_early]
--[[doc--
@@ -180,11 +183,8 @@ end
local init_adapt = function ()
- luaotfload.context_environment = { }
- luaotfload.push_namespaces = push_namespaces
- luaotfload.pop_namespaces = pop_namespaces
-
- local our_environment = push_namespaces ()
+ local context_environment = { }
+ local our_environment = push_namespaces ()
--[[doc--
@@ -196,7 +196,7 @@ local init_adapt = function ()
tex.attribute[0] = 0
- return our_environment
+ return our_environment, context_environment
end --- [init_adapt]
@@ -277,9 +277,9 @@ local init_cleanup = function (store)
--doc]]--
- luaotfload.pop_namespaces (store.our_environment,
- false,
- luaotfload.context_environment)
+ pop_namespaces (store.our_environment,
+ false,
+ store.context_environment)
--[[doc--
@@ -294,10 +294,7 @@ local init_cleanup = function (store)
callback.register = store.trapped_register
end --- [init_cleanup]
-local init_post = function ()
- --- hook for actions that need to take place after the fontloader is
- --- installed
-
+local init_post_install_callbacks = function ()
--[[doc--
we do our own callback handling with the means provided by
@@ -316,19 +313,122 @@ local init_post = function ()
nodes.simple_font_handler,
"luaotfload.node_processor",
1)
+end
+
+local init_post_load_agl = function ()
+
+ --[[doc--
+
+ Adobe Glyph List.
+ -----------------------------------------------------------------
+
+ Context provides a somewhat different font-age.lua from an
+ unclear origin. Unfortunately, the file name it reads from is
+ hard-coded in font-enc.lua, so we have to replace the entire
+ table.
+
+ This shouldn’t cause any complications. Due to its implementation
+ the glyph list will be loaded upon loading a OTF or TTF for the
+ first time during a TeX run. (If one sticks to TFM/OFM then it is
+ never read at all.) For this reason we can install a metatable
+ that looks up the file of our choosing and only falls back to the
+ Context one in case it cannot be found.
+
+ --doc]]--
+
+ local findfile = resolvers.findfile
+ local encodings = fonts.encodings
+
+ if not findfile or not encodings then
+ --- Might happen during refactoring; we continue graciously but in
+ --- a somewhat defect state.
+ logreport ("log", 0, "init",
+ "preconditions unmet, skipping the Adobe Glyph List; "
+ .. "this is a Luaotfload bug.")
+ return
+ end
+
+ if next (fonts.encodings.agl) then
+ --- unnecessary because the file shouldn’t be loaded at this time
+ --- but we’re just making sure
+ fonts.encodings.agl = nil
+ collectgarbage"collect"
+ end
+
+ local agl_init = { } --- start out empty, fill on demand
+ encodings.agl = agl_init --- ugh, replaced again later
+
+ setmetatable (agl_init, { __index = function (t, k)
+
+ if k ~= "unicodes" then
+ return nil
+ end
+
+ local glyphlist = findfile "luaotfload-glyphlist.lua"
+ if glyphlist then
+ logreport ("log", 1, "init", "loading the Adobe glyph list")
+ else
+ glyphlist = findfile "font-age.lua"
+ logreport ("both", 0, "init",
+ "loading the extended glyph list from ConTeXt")
+ end
+
+ if not glyphlist then
+ logreport ("both", 4, "init",
+ "Adobe glyph list not found, please check your installation.")
+ return nil
+ end
+ logreport ("both", 4, "init",
+ "found Adobe glyph list file at ``%s``, using that.",
+ glyphlist)
+
+ local unicodes = dofile(glyphlist)
+ encodings.agl = { unicodes = unicodes }
+ return unicodes
+ end })
+
+end
+
+--- (unit -> unit) list
+local init_post_actions = {
+ init_post_install_callbacks,
+ init_post_load_agl,
+}
+
+--- unit -> size_t
+local init_post = function ()
+ --- hook for actions that need to take place after the fontloader is
+ --- installed
+
+ local n = #init_post_actions
+ for i = 1, n do
+ local action = init_post_actions[i]
+ local taction = type (action)
+ if not action or taction ~= "function" then
+ logreport ("both", 1, "init",
+ "post hook WARNING: action %d not a function but %s/%s; ignoring.",
+ i, action, taction)
+ else
+ --- call closure
+ action ()
+ end
+ end
+
+ return n
end --- [init_post]
return {
- init = function ()
+ early = init_early,
+ main = function (store)
local starttime = os.gettimeofday ()
- local store = init_pre ()
- store.our_environment = init_adapt ()
+ store.our_environment, store.context_environment = init_adapt ()
init_main ()
init_cleanup (store)
logreport ("both", 1, "init",
"fontloader loaded in %0.3f seconds",
os.gettimeofday() - starttime)
- init_post ()
+ local n = init_post ()
+ logreport ("both", 5, "init", "post hook terminated, %d actions performed", n)
end
}
diff --git a/src/luaotfload-letterspace.lua b/src/luaotfload-letterspace.lua
index 8956f82..9a0646b 100644
--- a/src/luaotfload-letterspace.lua
+++ b/src/luaotfload-letterspace.lua
@@ -471,12 +471,15 @@ local enablefontkerning = function ( )
local handler = function (hd)
local direct_hd = todirect (hd)
- local hd, _done = kerncharacters (hd)
- if not hd then --- bad
+ logreport ("term", 5, "letterspace",
+ "kerncharacters() invoked with node.direct interface \z
+ (``%s`` -> ``%s``)", tostring (hd), tostring (direct_hd))
+ local direct_hd, _done = kerncharacters (direct_hd)
+ if not direct_hd then --- bad
logreport ("both", 0, "letterspace",
"kerncharacters() failed to return a valid new head")
end
- return tonode (hd)
+ return tonode (direct_hd)
end
return add_processor( handler
diff --git a/src/luaotfload-log.lua b/src/luaotfload-log.lua
index a0e78bd..7c012f4 100644
--- a/src/luaotfload-log.lua
+++ b/src/luaotfload-log.lua
@@ -355,52 +355,3 @@ end
texio.reporter = texioreporter
---[[doc--
-
- Adobe Glyph List.
- -------------------------------------------------------------------
-
- Context provides a somewhat different font-age.lua from an unclear
- origin. Unfortunately, the file name it reads from is hard-coded
- in font-enc.lua, so we have to replace the entire table.
-
- This shouldn’t cause any complications. Due to its implementation
- the glyph list will be loaded upon loading a OTF or TTF for the
- first time during a TeX run. (If one sticks to TFM/OFM then it is
- never read at all.) For this reason we can install a metatable that
- looks up the file of our choosing and only falls back to the
- Context one in case it cannot be found.
-
---doc]]--
-
-if fonts then --- need to be running TeX
- if next(fonts.encodings.agl) then
- --- unnecessary because the file shouldn’t be loaded at this time
- --- but we’re just making sure
- fonts.encodings.agl = nil
- collectgarbage"collect"
- end
-
-
- fonts.encodings.agl = { }
-
- setmetatable(fonts.encodings.agl, { __index = function (t, k)
- if k == "unicodes" then
- local glyphlist = resolvers.findfile"luaotfload-glyphlist.lua"
- if glyphlist then
- report ("log", 1, "load", "loading the Adobe glyph list")
- else
- glyphlist = resolvers.findfile"font-age.lua"
- report ("both", 0, "load",
- "loading the extended glyph list from ConTeXt")
- end
- local unicodes = dofile(glyphlist)
- fonts.encodings.agl = { unicodes = unicodes }
- return unicodes
- else
- return nil
- end
- end })
-end
-
--- vim:tw=71:sw=4:ts=4:expandtab
diff --git a/src/luaotfload-main.lua b/src/luaotfload-main.lua
index e8f05d6..5ac1421 100644
--- a/src/luaotfload-main.lua
+++ b/src/luaotfload-main.lua
@@ -1,6 +1,6 @@
-----------------------------------------------------------------------
-- FILE: luaotfload-main.lua
--- DESCRIPTION: Luaotfload initialization
+-- DESCRIPTION: Luaotfload entry point
-- REQUIREMENTS: luatex v.0.80 or later; packages lualibs, luatexbase
-- AUTHOR: Élie Roux, Khaled Hosny, Philipp Gesang
-- VERSION: same as Luaotfload
@@ -20,9 +20,7 @@ luaotfload.log = luaotfload.log or { }
luaotfload.version = "2.6"
luaotfload.loaders = { }
luaotfload.min_luatex_version = 79 --- i. e. 0.79
-luaotfload.fontloader_package = "fontloader" --- default: from current Context
-----------.fontloader_package = "slim"
-
+luaotfload.fontloader_package = "reference" --- default: from current Context
local authors = "\z
Hans Hagen,\z
@@ -155,13 +153,11 @@ luaotfload.loaders.luaotfload = load_luaotfload_module
luaotfload.loaders.fontloader = load_fontloader_module
luaotfload.init = load_luaotfload_module "init" --- fontloader initialization
-luaotfload.init.init ()
+local store = luaotfload.init.early ()
local log = luaotfload.log
local logreport = log.report
-load_luaotfload_module "override" --- load glyphlist on demand
-
--[[doc--
Now we load the modules written for \identifier{luaotfload}.
@@ -175,6 +171,8 @@ if not config.actions.apply_defaults () then
logreport ("log", 0, "load", "Configuration unsuccessful.")
end
+luaotfload.init.main (store)
+
load_luaotfload_module "loaders" --- Type1 font wrappers
load_luaotfload_module "database" --- Font management.
load_luaotfload_module "colors" --- Per-font colors.
diff --git a/src/luaotfload-override.lua b/src/luaotfload-override.lua
deleted file mode 100644
index b75530b..0000000
--- a/src/luaotfload-override.lua
+++ /dev/null
@@ -1,52 +0,0 @@
-if not modules then modules = { } end modules ["luaotfload-override"] = {
- version = "2.5",
- comment = "companion to Luaotfload",
- author = "Khaled Hosny, Elie Roux, Philipp Gesang",
- copyright = "Luaotfload Development Team",
- license = "GNU GPL v2.0"
-}
-
-local findfile = resolvers.findfile
-local encodings = fonts.encodings
-
-local log = luaotfload.log
-local report = log.report
-
---[[doc--
-
- Adobe Glyph List.
- -------------------------------------------------------------------
-
- Context provides a somewhat different font-age.lua from an unclear
- origin. Unfortunately, the file name it reads from is hard-coded
- in font-enc.lua, so we have to replace the entire table.
-
- This shouldn’t cause any complications. Due to its implementation
- the glyph list will be loaded upon loading a OTF or TTF for the
- first time during a TeX run. (If one sticks to TFM/OFM then it is
- never read at all.) For this reason we can install a metatable that
- looks up the file of our choosing and only falls back to the
- Context one in case it cannot be found.
-
---doc]]--
-
-encodings.agl = { }
-
-setmetatable(fonts.encodings.agl, { __index = function (t, k)
- if k ~= "unicodes" then
- return nil
- end
- local glyphlist = findfile "luaotfload-glyphlist.lua"
- if glyphlist then
- report ("log", 1, "load", "loading the Adobe glyph list")
- else
- glyphlist = findfile "font-age.lua"
- report ("both", 0, "load",
- "loading the extended glyph list from ConTeXt")
- end
- local unicodes = dofile(glyphlist)
- encodings.agl = { unicodes = unicodes }
- return unicodes
-end })
-
--- vim:tw=71:sw=4:ts=4:expandtab