From b1db13ab10112f6d81522a3f0ab44a67754cf551 Mon Sep 17 00:00:00 2001
From: Philipp Gesang <megas.kapaneus@gmail.com>
Date: Wed, 10 Apr 2013 16:20:41 +0200
Subject: circumvent the callback trap from luatexbase

---
 luaotfload.lua | 36 +++++++++++++++++++++++++++---------
 1 file changed, 27 insertions(+), 9 deletions(-)

diff --git a/luaotfload.lua b/luaotfload.lua
index 0a3b398..dd650fd 100644
--- a/luaotfload.lua
+++ b/luaotfload.lua
@@ -65,24 +65,35 @@ local loadmodule = function (name)
 end
 luaotfload.loadmodule = loadmodule --- required in deferred code
 
+--[[doc--
+The imported font loader will call \verb|callback.register| once
+(during \verb|font-def.lua|).
+This is unavoidable but harmless, so we make it call a dummy instead.
+--doc]]--
+local trapped_register = callback.register
+local dummy_function   = function () end
+callback.register      = dummy_function
+
 --[[-- keep --]]
 --- from Hans (all merged):
 
----   file name              modified include name
---- × basics-gen.lua         t        luat-basics-gen
---- × font-def -> fonts-def  t        luatex-font-def (there’s also the normal font-def!)
---- × fonts-enc              f        luatex-font-enc
---- × fonts-ext              t        luatex-fonts-ext
---- × fonts-lua              f        luatex-fonts-lua
----   fonts-tfm              f        luatex-fonts-tfm
---- × fonts-cbk              f        luatex-fonts-lua
+---   file name              modified  include name
+--- × basics-gen.lua         t         luat-basics-gen
+--- × font-def -> fonts-def  t         luatex-font-def (there’s also the normal font-def!)
+--- × fonts-enc              f         luatex-font-enc
+--- × fonts-ext              t         luatex-fonts-ext
+--- × fonts-lua              f         luatex-fonts-lua
+---   fonts-tfm              f         luatex-fonts-tfm
+--- × fonts-cbk              f         luatex-fonts-lua
+
+--- from Hans (unmerged):
+---   font-otc.lua -> otfl-font-otc.lua
 
 --- from luaotfload:
 ---   otfl-luat-ovr.lua    -- override some luat-dum functions
 ---   otfl-font-clr.lua
 ---   otfl-font-ltx.lua
 ---   otfl-font-nms.lua
----   otfl-font-otc.lua
 ---   otfl-font-pfb.lua    -- ?
 
 --[[-- new --]]
@@ -154,6 +165,13 @@ _G.non_generic_context = { luatex_fonts = {
 
 loadmodule("fonts.lua")
 
+--[[doc--
+After the fontloader is ready we can restore the callback trap from
+\textsf{luatexbase}.
+--doc]]--
+
+callback.register = trapped_register
+
 --- then continue in luaotfload-deferred.lua
 
 -- vim:tw=71:sw=2:ts=2:expandtab
-- 
cgit v1.2.3