summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPhilipp Gesang <phg@phi-gamma.net>2015-07-16 08:15:29 +0200
committerPhilipp Gesang <phg@phi-gamma.net>2015-07-16 08:15:29 +0200
commit28c4d1840be50e186ddeae4adc510233c2837042 (patch)
treeedd0e682955802003ab8dd0f9a00f3e5fee26b82 /src
parente8a56b051a32ed4c468c9325048ded01002a841a (diff)
downloadluaotfload-28c4d1840be50e186ddeae4adc510233c2837042.tar.gz
[init] implement hook list for post-fontloader initialization
Diffstat (limited to 'src')
-rw-r--r--src/luaotfload-init.lua35
1 files changed, 30 insertions, 5 deletions
diff --git a/src/luaotfload-init.lua b/src/luaotfload-init.lua
index feff4cc..170cbad 100644
--- a/src/luaotfload-init.lua
+++ b/src/luaotfload-init.lua
@@ -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,6 +313,33 @@ local init_post = function ()
nodes.simple_font_handler,
"luaotfload.node_processor",
1)
+end
+
+--- (unit -> unit) list
+local init_post_actions = {
+ init_post_install_callbacks,
+}
+
+--- 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 {
@@ -328,7 +352,8 @@ return {
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
}