summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/lpdf-nod.lua
diff options
context:
space:
mode:
authorMojca Miklavec <mojca.miklavec@gmail.com>2012-05-14 17:38:55 +0000
committerMojca Miklavec <mojca.miklavec@gmail.com>2012-05-14 17:38:55 +0000
commit15995e10bfc68edf79970c4ea4fbb6678566c46e (patch)
tree2de7ca2a83f2d37ef043ad7429a5cb945bb79ddb /Master/texmf-dist/tex/context/base/lpdf-nod.lua
parentc9a39f716f1e5ec820ed3aab2c9aef25c5a9d730 (diff)
ConTeXt 2012.05.14 16:00
git-svn-id: svn://tug.org/texlive/trunk@26371 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/context/base/lpdf-nod.lua')
-rw-r--r--Master/texmf-dist/tex/context/base/lpdf-nod.lua39
1 files changed, 32 insertions, 7 deletions
diff --git a/Master/texmf-dist/tex/context/base/lpdf-nod.lua b/Master/texmf-dist/tex/context/base/lpdf-nod.lua
index 39bba2d6364..fe0c975f70e 100644
--- a/Master/texmf-dist/tex/context/base/lpdf-nod.lua
+++ b/Master/texmf-dist/tex/context/base/lpdf-nod.lua
@@ -6,17 +6,24 @@ if not modules then modules = { } end modules ['lpdf-nod'] = {
license = "see context related readme files"
}
-local copy_node, new_node = node.copy, node.new
+local format = string.format
-local nodepool = nodes.pool
+local copy_node = node.copy
+local new_node = node.new
-local register = nodepool.register
+local nodepool = nodes.pool
+local register = nodepool.register
+local whatsitcodes = nodes.whatsitcodes
+local nodeinjections = backends.nodeinjections
-local pdfliteral = register(new_node("whatsit", 8)) pdfliteral.mode = 1
-local pdfdest = register(new_node("whatsit",19)) pdfdest.named_id = 1 -- xyz_zoom untouched
-local pdfannot = register(new_node("whatsit",15))
+local pdfliteral = register(new_node("whatsit", whatsitcodes.pdfliteral)) pdfliteral.mode = 1
+local pdfsave = register(new_node("whatsit", whatsitcodes.pdfsave))
+local pdfrestore = register(new_node("whatsit", whatsitcodes.pdfrestore))
+local pdfsetmatrix = register(new_node("whatsit", whatsitcodes.pdfsetmatrix))
+local pdfdest = register(new_node("whatsit", whatsitcodes.pdfdest)) pdfdest.named_id = 1 -- xyz_zoom untouched
+local pdfannot = register(new_node("whatsit", whatsitcodes.pdfannot))
-local variables = interfaces.variables
+local variables = interfaces.variables
local views = { -- beware, we do support the pdf keys but this is *not* official
xyz = 0, [variables.standard] = 0,
@@ -42,6 +49,24 @@ function nodepool.pdfdirect(str)
return t
end
+function nodepool.pdfsave()
+ return copy_node(pdfsave)
+end
+
+function nodepool.pdfrestore()
+ return copy_node(pdfrestore)
+end
+
+function nodepool.pdfsetmatrix(rx,sx,sy,ry,tx,ty)
+ local t = copy_node(pdfsetmatrix)
+ t.data = format("%s %s %s %s",rs or 0,sx or 0,sy or 0,rx or 0) -- todo: tx ty
+ return t
+end
+
+nodeinjections.save = nodepool.pdfsave
+nodeinjections.restore = nodepool.pdfrestore
+nodeinjections.transform = nodepool.pdfsetmatrix
+
function nodepool.pdfannotation(w,h,d,data,n)
local t = copy_node(pdfannot)
if w and w ~= 0 then t.width = w end