summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/luatex/luaotfload/luaotfload-colors.lua
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2014-07-15 22:56:45 +0000
committerKarl Berry <karl@freefriends.org>2014-07-15 22:56:45 +0000
commit6caf348b43edcfc1dce127bf0895a5fb9bd77f2d (patch)
tree7b4b79f90596e69716ad87e3293743756b2a1954 /Master/texmf-dist/tex/luatex/luaotfload/luaotfload-colors.lua
parentd71cd04a4c07d1cdaf85a7b7c2398022cc39beab (diff)
luaotfload (15jul14)
git-svn-id: svn://tug.org/texlive/trunk@34622 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/luatex/luaotfload/luaotfload-colors.lua')
-rw-r--r--Master/texmf-dist/tex/luatex/luaotfload/luaotfload-colors.lua39
1 files changed, 23 insertions, 16 deletions
diff --git a/Master/texmf-dist/tex/luatex/luaotfload/luaotfload-colors.lua b/Master/texmf-dist/tex/luatex/luaotfload/luaotfload-colors.lua
index b8ecb875c7d..9be29746c4b 100644
--- a/Master/texmf-dist/tex/luatex/luaotfload/luaotfload-colors.lua
+++ b/Master/texmf-dist/tex/luatex/luaotfload/luaotfload-colors.lua
@@ -1,9 +1,9 @@
if not modules then modules = { } end modules ['luaotfload-colors'] = {
- version = "2.4",
- comment = "companion to luaotfload.lua (font color)",
+ version = "2.5",
+ comment = "companion to luaotfload-main.lua (font color)",
author = "Khaled Hosny, Elie Roux, Philipp Gesang",
copyright = "Luaotfload Development Team",
- license = "GNU GPL v2"
+ license = "GNU GPL v2.0"
}
--[[doc--
@@ -19,14 +19,8 @@ explanation: http://tug.org/pipermail/luatex/2013-May/004305.html
--doc]]--
-
-local color_callback = config.luaotfload.color_callback
-if not color_callback then
- --- maybe this would be better as a method: "early" | "late"
- color_callback = "pre_linebreak_filter"
--- color_callback = "pre_output_filter" --- old behavior, breaks expansion
-end
-
+local log = luaotfload.log
+local logreport = log.report
local newnode = node.new
local nodetype = node.id
@@ -34,6 +28,9 @@ local traverse_nodes = node.traverse
local insert_node_before = node.insert_before
local insert_node_after = node.insert_after
+local texset = tex.set
+local texget = tex.get
+
local stringformat = string.format
local stringgsub = string.gsub
local stringfind = string.find
@@ -86,8 +83,9 @@ local sanitize_color_expression = function (digits)
digits = tostring(digits)
local sanitized = lpegmatch(valid_digits, digits)
if not sanitized then
- luaotfload.warning(
- "%q is not a valid rgb[a] color expression", digits)
+ logreport("both", 0, "color",
+ "%q is not a valid rgb[a] color expression",
+ digits)
return nil
end
return sanitized
@@ -276,20 +274,24 @@ local color_handler = function (head)
local new_head = node_colorize(head, nil, nil)
-- now append our page resources
if res then
- res["1"] = true
- local tpr, t = tex.pdfpageresources, ""
+ res["1"] = true
+ local tpr = texget("pdfpageresources")
+ local t = ""
for k in pairs(res) do
local str = stringformat("/TransGs%s<</ca %s/CA %s>>", k, k, k)
if not stringfind(tpr,str) then
t = t .. str
end
end
+ print""
if t ~= "" then
+ print(">>", tpr, "<<")
if not stringfind(tpr,"/ExtGState<<.*>>") then
tpr = tpr.."/ExtGState<<>>"
end
tpr = stringgsub(tpr,"/ExtGState<<","%1"..t)
- tex.pdfpageresources = tpr
+ texset("global", "pdfpageresources", tpr)
+ print(">>", tpr, "<<")
end
res = nil -- reset res
end
@@ -300,6 +302,11 @@ local color_callback_activated = 0
--- unit -> unit
add_color_callback = function ( )
+ local color_callback = config.luaotfload.run.color_callback
+ if not color_callback then
+ color_callback = "pre_linebreak_filter"
+ end
+
if color_callback_activated == 0 then
luatexbase.add_to_callback(color_callback,
color_handler,