diff options
author | Hans Hagen <pragma@wxs.nl> | 2018-09-21 20:54:51 +0200 |
---|---|---|
committer | Context Git Mirror Bot <phg@phi-gamma.net> | 2018-09-21 20:54:51 +0200 |
commit | 7c2efd42267783f01b64e0a47cba89f84742618c (patch) | |
tree | 4517e6bd3e024424dd82c5bb3c5e800cdff06fea /tex/context/base/mkiv/lpdf-nod.lua | |
parent | 56ca0139232f16679918613ef45a5dd643f0f9b3 (diff) | |
download | context-7c2efd42267783f01b64e0a47cba89f84742618c.tar.gz |
2018-09-21 20:00:00
Diffstat (limited to 'tex/context/base/mkiv/lpdf-nod.lua')
-rw-r--r-- | tex/context/base/mkiv/lpdf-nod.lua | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/tex/context/base/mkiv/lpdf-nod.lua b/tex/context/base/mkiv/lpdf-nod.lua index ec71571d2..2f9282a10 100644 --- a/tex/context/base/mkiv/lpdf-nod.lua +++ b/tex/context/base/mkiv/lpdf-nod.lua @@ -63,6 +63,15 @@ function nodepool.pdfrestore() return copy_node(pdfrestore) end +local s_matrix_0 = "1 0 0 1" +local f_matrix_2 = formatters["%.6F 0 0 %.6F"] +local f_matrix_4 = formatters["%.6F %.6F %.6F %.6F"] + +directives.register("pdf.stripzeros",function() + f_matrix_2 = formatters["%.6N 0 0 %.6N"] + f_matrix_4 = formatters["%.6N %.6N %.6N %.6N"] +end) + function nodepool.pdfsetmatrix(rx,sx,sy,ry,tx,ty) -- todo: tx ty local t = copy_node(pdfsetmatrix) if type(rx) == "string" then @@ -86,12 +95,12 @@ function nodepool.pdfsetmatrix(rx,sx,sy,ry,tx,ty) -- todo: tx ty end if sx == 0 and sy == 0 then if rx == 1 and ry == 1 then - setdata(t,"1 0 0 1") + setdata(t,s_matrix_0) else - setdata(t,formatters["%0.6F 0 0 %0.6F"](rx,ry)) + setdata(t,f_matrix_2(rx,ry)) end else - setdata(t,formatters["%0.6F %0.6F %0.6F %0.6F"](rx,sx,sy,ry)) + setdata(t,f_matrix_4(rx,sx,sy,ry)) end end return t |