summaryrefslogtreecommitdiff
path: root/tex/context/base/mkiv/back-pdf.lua
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2017-02-17 10:31:56 +0100
committerContext Git Mirror Bot <phg42.2a@gmail.com>2017-02-17 10:31:56 +0100
commitb14f992ef5f4e868c9959b174278c86516d60dbc (patch)
tree28587bb46c025ea7b0d27ba93f09c93dcf53c73a /tex/context/base/mkiv/back-pdf.lua
parent95a1799032dc61dbca4a11e495be34b4397c8fec (diff)
downloadcontext-b14f992ef5f4e868c9959b174278c86516d60dbc.tar.gz
2017-02-17 10:23:00
Diffstat (limited to 'tex/context/base/mkiv/back-pdf.lua')
-rw-r--r--tex/context/base/mkiv/back-pdf.lua136
1 files changed, 136 insertions, 0 deletions
diff --git a/tex/context/base/mkiv/back-pdf.lua b/tex/context/base/mkiv/back-pdf.lua
index b6633f091..a3f7ffff7 100644
--- a/tex/context/base/mkiv/back-pdf.lua
+++ b/tex/context/base/mkiv/back-pdf.lua
@@ -19,6 +19,9 @@ local context = context
local scanners = tokens.scanners
local scannumber = scanners.number
local scankeyword = scanners.keyword
+local scandimen = scanners.dimen
+local scancount = scanners.count
+local scanstring = scanners.string
local scanners = interfaces.scanners
local implement = interfaces.implement
@@ -178,3 +181,136 @@ implement {
pdf.setobjcompresslevel(o)
end
}
+
+local report = logs.reporter("backend","pdftex primitives")
+local trace = false
+
+scanners.pdfannot = function()
+ if scankeyword("reserveobjectnum") then
+ report("\\pdfannot reserveobjectnum is not (yet) supported")
+ -- if trace then
+ -- report()
+ -- report("\\pdfannot: reserved number (not supported yet)")
+ -- report()
+ -- end
+ else
+ local width = false
+ local height = false
+ local depth = false
+ local data = false
+ local object = false
+ local attr = false
+ --
+ if scankeyword("useobjnum") then
+ object = scancount()
+ report("\\pdfannot useobjectnum is not (yet) supported")
+ end
+ while true do
+ if scankeyword("width") then
+ width = scandimen()
+ elseif scankeyword("height") then
+ height = scandimen()
+ elseif scankeyword("depth") then
+ depth = scandimen()
+ else
+ break
+ end
+ end
+ if scankeyword("attr") then
+ attr = scanstring()
+ end
+ data = scanstring()
+ --
+ -- less strict variant:
+ --
+ -- while true do
+ -- if scankeyword("width") then
+ -- width = scandimen()
+ -- elseif scankeyword("height") then
+ -- height = scandimen()
+ -- elseif scankeyword("depth") then
+ -- depth = scandimen()
+ -- elseif scankeyword("useobjnum") then
+ -- object = scancount()
+ -- elseif scankeyword("attr") then
+ -- attr = scanstring()
+ -- else
+ -- data = scanstring()
+ -- break
+ -- end
+ -- end
+ --
+ -- if trace then
+ -- report()
+ -- report("\\pdfannot:")
+ -- report()
+ -- report(" object: %s",object or "<unset> (not supported yet)")
+ -- report(" width : %p",width or "<unset>")
+ -- report(" height: %p",height or "<unset>")
+ -- report(" depth : %p",depth or "<unset>")
+ -- report(" attr : %s",attr or "<unset>")
+ -- report(" data : %s",data or "<unset>")
+ -- report()
+ -- end
+ context(backends.nodeinjections.annotation(width or 0,height or 0,depth or 0,data or ""))
+ end
+end
+
+scanners.pdfdest = function()
+ local name = false
+ local zoom = false
+ local view = false
+ local width = false
+ local height = false
+ local depth = false
+ if scankeyword("num") then
+ report("\\pdfdest num is not (yet) supported")
+ elseif scankeyword("name") then
+ name = scanstring()
+ end
+ if scankeyword("xyz") then
+ view = "xyz"
+ if scankeyword("zoom") then
+ report("\\pdfdest zoom is ignored")
+ zoom = scancount()
+ end
+ elseif scankeyword("fitbh") then
+ view = "fitbh"
+ elseif scankeyword("fitbv") then
+ view = "fitbv"
+ elseif scankeyword("fitb") then
+ view = "fitb"
+ elseif scankeyword("fith") then
+ view = "fith"
+ elseif scankeyword("fitv") then
+ view = "fitv"
+ elseif scankeyword("fitr") then
+ view = "fitr"
+ while true do
+ if scankeyword("width") then
+ width = scandimen()
+ elseif scankeyword("height") then
+ height = scandimen()
+ elseif scankeyword("depth") then
+ depth = scandimen()
+ else
+ break
+ end
+ end
+ elseif scankeyword("fit") then
+ view = "fit"
+ end
+ -- if trace then
+ -- report()
+ -- report("\\pdfdest:")
+ -- report()
+ -- report(" name : %s",name or "<unset>")
+ -- report(" view : %s",view or "<unset>")
+ -- report(" zoom : %s",zoom or "<unset> (not supported)")
+ -- report(" width : %p",width or "<unset>")
+ -- report(" height: %p",height or "<unset>")
+ -- report(" depth : %p",depth or "<unset>")
+ -- report()
+ -- end
+ context(backends.nodeinjections.destination(width or 0,height or 0,depth or 0,{ name or "" },view or "fit"))
+end