From 54654688c8aa643ec9cc068eb25464d40ead84a0 Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Thu, 26 Nov 2015 08:19:49 +0100 Subject: [colors] remove workaround for deprecated interface MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Luatexbase API was consolidated. Since the priority_in_callback functionality wasn’t used for anything but determining whether we need to convert to an hlist first, there’s not really any gain in keeping it around in the generic form. --- src/luaotfload-colors.lua | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) (limited to 'src/luaotfload-colors.lua') diff --git a/src/luaotfload-colors.lua b/src/luaotfload-colors.lua index 576a432..ca5a067 100644 --- a/src/luaotfload-colors.lua +++ b/src/luaotfload-colors.lua @@ -313,18 +313,15 @@ local color_handler = function (head) return head end +local color_callback_name = "luaotfload.color_handler" local color_callback_activated = 0 local add_to_callback = luatexbase.add_to_callback -local function priority_in_callback (name,description) - for i,v in ipairs(luatexbase.callback_descriptions(name)) - do - if v == description then - return i - end - end - return false -end +--- unit -> bool +local mlist_to_hlist_initial = function () + local cdesc = luatexbase.callback_descriptions "mlist_to_hlist" + return cdesc and cdesc[1] == color_callback_name +end --- unit -> unit add_color_callback = function ( ) @@ -336,7 +333,7 @@ add_color_callback = function ( ) if color_callback_activated == 0 then add_to_callback(color_callback, color_handler, - "luaotfload.color_handler") + color_callback_name) add_to_callback("hpack_filter", function (head, groupcode) if groupcode == "hbox" or @@ -346,10 +343,10 @@ add_color_callback = function ( ) end return head end, - "luaotfload.color_handler") + color_callback_name) add_to_callback("mlist_to_hlist", function (head, display_type, need_penalties) - if priority_in_callback("mlist_to_hlist","luaotfload.color_handler") == 1 then + if mlist_to_hlist_initial () then head = mlist_to_hlist(head, display_type, need_penalties) end if display_type == "text" then @@ -357,7 +354,7 @@ add_color_callback = function ( ) end return color_handler(head) end, - "luaotfload.color_handler") + color_callback_name) color_callback_activated = 1 end end -- cgit v1.2.3