From 68deea6dce2d816a208b940cdfb529e976d5dfa6 Mon Sep 17 00:00:00 2001 From: Khaled Hosny Date: Wed, 17 Nov 2010 20:15:09 +0200 Subject: Simplify callback registering We never turn off the package as it makes no sense to load it then (and it does not really turn everything off since we already register another callback in the color module. --- luaotfload.dtx | 58 +++++++++++++++++----------------------------------------- 1 file changed, 17 insertions(+), 41 deletions(-) diff --git a/luaotfload.dtx b/luaotfload.dtx index 322acb8..683481c 100644 --- a/luaotfload.dtx +++ b/luaotfload.dtx @@ -690,35 +690,22 @@ for _,v in next, gsubs do end % \end{macrocode} % -% Finally two functions +% Finally we register the callbacks % % \begin{macrocode} -function luaotfload.register_callbacks() - luatexbase.add_to_callback('pre_linebreak_filter', - nodes.simple_font_handler, - 'luaotfload.pre_linebreak_filter') - luatexbase.add_to_callback('hpack_filter', - nodes.simple_font_handler, - 'luaotfload.hpack_filter') - luatexbase.reset_callback('define_font') - luatexbase.add_to_callback('define_font', - def_font, - 'luaotfload.define_font', 1) - luatexbase.add_to_callback('find_vf_file', - fonts.vf.find, - 'luaotfload.find_vf_file') -end - -function luaotfload.unregister_callbacks() - luatexbase.remove_from_callback('pre_linebreak_filter', - 'luaotfload.pre_linebreak_filter') - luatexbase.remove_from_callback('hpack_filter', - 'luaotfload.hpack_filter') - luatexbase.remove_from_callback('define_font', - 'luaotfload.define_font') - luatexbase.remove_from_callback('find_vf_file', - 'luaotfload.find_vf_file') -end +luatexbase.add_to_callback('pre_linebreak_filter', + nodes.simple_font_handler, + 'luaotfload.pre_linebreak_filter') +luatexbase.add_to_callback('hpack_filter', + nodes.simple_font_handler, + 'luaotfload.hpack_filter') +luatexbase.reset_callback('define_font') +luatexbase.add_to_callback('define_font', + def_font, + 'luaotfload.define_font', 1) +luatexbase.add_to_callback('find_vf_file', + fonts.vf.find, + 'luaotfload.find_vf_file') % \end{macrocode} % % \iffalse @@ -755,26 +742,15 @@ end \catcode64 11 % \end{macrocode} % -% Two small macros to register or unregister the callbacks. Without the -% callbacks this package is totally turned off. +% Finally we load the |lua| module % % \begin{macrocode} -\def\otfl@off{ -\directlua{luaotfload.unregister_callbacks()} -} - -\def\otfl@on{ -\directlua{luaotfload.register_callbacks()} -} +\RequireLuaModule{luaotfload} % \end{macrocode} % -% We load the |lua| file, and we turn the package on. +% and finalize the package. % % \begin{macrocode} -\RequireLuaModule{luaotfload} - -\otfl@on - \otfl@AtEnd % \end{macrocode} % \iffalse -- cgit v1.2.3