summaryrefslogtreecommitdiff
path: root/src/luaotfload-loaders.lua
diff options
context:
space:
mode:
authorPhilipp Gesang <phg@phi-gamma.net>2015-11-29 22:53:50 +0100
committerPhilipp Gesang <phg@phi-gamma.net>2015-11-29 22:53:50 +0100
commit12b177a7f918797314efadf3a70afe40b3e060e5 (patch)
tree3254587ae3352186b2f6798c2a06b89cbf1d6ee0 /src/luaotfload-loaders.lua
parent3966255142bdf450ea92376349160f90a69368f8 (diff)
parent9ceba217e323ab5572ab32708af1f4e1934397a7 (diff)
downloadluaotfload-12b177a7f918797314efadf3a70afe40b3e060e5.tar.gz
Merge pull request #301 from phi-gamma/master
fixes, rc3
Diffstat (limited to 'src/luaotfload-loaders.lua')
-rw-r--r--src/luaotfload-loaders.lua30
1 files changed, 20 insertions, 10 deletions
diff --git a/src/luaotfload-loaders.lua b/src/luaotfload-loaders.lua
index 715aa8a..0f22f46 100644
--- a/src/luaotfload-loaders.lua
+++ b/src/luaotfload-loaders.lua
@@ -2,8 +2,9 @@
-----------------------------------------------------------------------
-- FILE: luaotfload-loaders.lua
-- DESCRIPTION: Luaotfload callback handling
--- REQUIREMENTS: luatex v.0.80 or later; packages lualibs, luatexbase
--- AUTHOR: Philipp Gesang (Phg), <phg@phi-gamma.net>, Hans Hagen, Khaled Hosny, Elie Roux
+-- REQUIREMENTS: luatex v.0.80 or later; package lualibs
+-- AUTHOR: Philipp Gesang <phg@phi-gamma.net>
+-- AUTHOR: Hans Hagen, Khaled Hosny, Elie Roux, David Carlisle
-----------------------------------------------------------------------
--
--- Contains parts of the earlier main script.
@@ -110,13 +111,22 @@ end
--doc]]--
-local function reset_callback(name,make_false)
- for _,v in pairs(luatexbase.callback_descriptions(name))
- do
- luatexbase.remove_from_callback(name,v)
- end
- if make_false == true then
- luatexbase.disable_callback(name)
+local purge_define_font = function ()
+ local cdesc = luatexbase.callback_descriptions "define_font"
+ --- define_font is an “exclusive” callback, meaning that there can
+ --- only ever be one entry. Everything beyond that would indicate
+ --- that something is broken.
+ local _, d = next (cdesc)
+ if d then
+ local i, d2 = next (cdesc, 1)
+ if d2 then --> issue warning
+ logreport ("both", 0, "loaders",
+ "Callback table for define_font contains multiple entries: \z
+ { [%d] = “%s” } -- seems fishy.", i, d2)
+ end
+ logreport ("log", 0, "loaders",
+ "Entry ``%s`` present in define_font callback; overriding.", d)
+ luatexbase.remove_from_callback ("define_font", d)
end
end
@@ -125,7 +135,7 @@ local install_callbacks = function ()
local dummy_function = function () end
create_callback ("luaotfload.patch_font", "simple", dummy_function)
create_callback ("luaotfload.patch_font_unsafe", "simple", dummy_function)
- reset_callback "define_font"
+ purge_define_font ()
local definer = config.luaotfload.run.definer
luatexbase.add_to_callback ("define_font",
definers[definer or "patch"],