diff options
author | Philipp Gesang <phg@phi-gamma.net> | 2015-11-26 08:19:49 +0100 |
---|---|---|
committer | Philipp Gesang <phg@phi-gamma.net> | 2015-11-26 08:19:52 +0100 |
commit | 54654688c8aa643ec9cc068eb25464d40ead84a0 (patch) | |
tree | d6fa00d49ae7d75ecc302057c7b65cebacd27b39 /src | |
parent | f4204c1ea5fcc0368392c119530687681ab733c9 (diff) | |
download | luaotfload-54654688c8aa643ec9cc068eb25464d40ead84a0.tar.gz |
[colors] remove workaround for deprecated interface
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.
Diffstat (limited to 'src')
-rw-r--r-- | src/luaotfload-colors.lua | 23 |
1 files changed, 10 insertions, 13 deletions
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 |