summaryrefslogtreecommitdiff
path: root/tex/context/base/mkxl/back-pdf.lmt
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2020-12-01 18:35:58 +0100
committerContext Git Mirror Bot <phg@phi-gamma.net>2020-12-01 18:35:58 +0100
commit9273441a6cb7b02b3336e0a862ee311dbd3653e9 (patch)
treeb6156b80c8d3cd658ace7fa082dfc49407d1f388 /tex/context/base/mkxl/back-pdf.lmt
parent0e813ddcd6168945510ca50913c00fc8b633b733 (diff)
downloadcontext-9273441a6cb7b02b3336e0a862ee311dbd3653e9.tar.gz
2020-12-01 17:51:00
Diffstat (limited to 'tex/context/base/mkxl/back-pdf.lmt')
-rw-r--r--tex/context/base/mkxl/back-pdf.lmt55
1 files changed, 55 insertions, 0 deletions
diff --git a/tex/context/base/mkxl/back-pdf.lmt b/tex/context/base/mkxl/back-pdf.lmt
new file mode 100644
index 000000000..44d0230bd
--- /dev/null
+++ b/tex/context/base/mkxl/back-pdf.lmt
@@ -0,0 +1,55 @@
+if not modules then modules = { } end modules ['back-pdf'] = {
+ version = 1.001,
+ comment = "companion to back-pdf.mkiv",
+ author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+ copyright = "PRAGMA ADE / ConTeXt Development Team",
+ license = "see context related readme files"
+}
+
+-- We hide the pdf table from users so that we can guarantee no interference with
+-- the way we manage resources, info, etc. Users should use the \type {lpdf}
+-- interface instead. If needed I will provide replacement functionality.
+
+local setmetatableindex = table.setmetatableindex
+
+local pdfsetcompression
+local pdfimmediateobject
+
+updaters.register("backend.update.lpdf",function()
+ pdfsetcompression = lpdf.setcompression
+ pdfimmediateobject = lpdf.immediateobject
+end)
+
+interfaces.implement {
+ name = "setpdfcompression",
+ arguments = { "integer", "integer" },
+ actions = function(...) pdfsetcompression(...) end,
+}
+
+do
+
+ local dummy = function() end
+ local report = logs.reporter("backend")
+
+ local function unavailable(t,k)
+ report("calling unavailable pdf.%s function",k)
+ t[k] = dummy
+ return dummy
+ end
+
+ updaters.register("backend.update",function()
+ --
+ -- For now we keep this for tikz. If really needed some more can be made
+ -- accessible but it has to happen in a controlled way then, for instance
+ -- by first loading or enabling some compatibility layer so that we can
+ -- trace possible interferences.
+ --
+ pdf = {
+ immediateobj = pdfimmediateobject
+ }
+ setmetatableindex(pdf,unavailable)
+ end)
+
+end
+
+backends.install("pdf")