summaryrefslogtreecommitdiff
path: root/tex/context/base/lpdf-nod.lua
diff options
context:
space:
mode:
Diffstat (limited to 'tex/context/base/lpdf-nod.lua')
-rw-r--r--tex/context/base/lpdf-nod.lua71
1 files changed, 59 insertions, 12 deletions
diff --git a/tex/context/base/lpdf-nod.lua b/tex/context/base/lpdf-nod.lua
index fe0c975f7..0ce589c32 100644
--- a/tex/context/base/lpdf-nod.lua
+++ b/tex/context/base/lpdf-nod.lua
@@ -59,7 +59,7 @@ 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
+ t.data = format("%s %s %s %s",rx or 0,sx or 0,sy or 0,ry or 0) -- todo: tx ty
return t
end
@@ -69,21 +69,68 @@ 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
- if h and h ~= 0 then t.height = h end
- if d and d ~= 0 then t.depth = d end
- if n then t.objnum = n end
- if data and data ~= "" then t.data = data end
+ if w and w ~= 0 then
+ t.width = w
+ end
+ if h and h ~= 0 then
+ t.height = h
+ end
+ if d and d ~= 0 then
+ t.depth = d
+ end
+ if n then
+ t.objnum = n
+ end
+ if data and data ~= "" then
+ t.data = data
+ end
return t
end
+-- (!) The next code in pdfdest.w is wrong:
+--
+-- case pdf_dest_xyz:
+-- if (matrixused()) {
+-- set_rect_dimens(pdf, p, parent_box, cur, alt_rule, pdf_dest_margin) ;
+-- } else {
+-- pdf_ann_left(p) = pos.h ;
+-- pdf_ann_top (p) = pos.v ;
+-- }
+-- break ;
+--
+-- so we need to force a matrix.
+
function nodepool.pdfdestination(w,h,d,name,view,n)
local t = copy_node(pdfdest)
- if w and w ~= 0 then t.width = w end
- if h and h ~= 0 then t.height = h end
- if d and d ~= 0 then t.depth = d end
- if n then t.objnum = n end
+ local hasdimensions = false
+ if w and w ~= 0 then
+ t.width = w
+ hasdimensions = true
+ end
+ if h and h ~= 0 then
+ t.height = h
+ hasdimensions = true
+ end
+ if d and d ~= 0 then
+ t.depth = d
+ hasdimensions = true
+ end
+ if n then
+ t.objnum = n
+ end
+ view = views[view] or view or 1 -- fit is default
t.dest_id = name
- t.dest_type = views[view] or view or 1 -- fit is default
- return t
+ t.dest_type = view
+ if hasdimensions and view == 0 then -- xyz
+ -- see (!) s -> m -> t -> r
+ local s = copy_node(pdfsave)
+ local m = copy_node(pdfsetmatrix)
+ local r = copy_node(pdfrestore)
+ m.data = format("1 0 0 1")
+ s.next = m m.next = t t.next = r
+ m.prev = s t.prev = m r.prev = t
+ return s -- a list
+ else
+ return t
+ end
end