summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/mkxl/back-pdf.mkxl
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/context/base/mkxl/back-pdf.mkxl')
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/back-pdf.mkxl157
1 files changed, 157 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/context/base/mkxl/back-pdf.mkxl b/Master/texmf-dist/tex/context/base/mkxl/back-pdf.mkxl
new file mode 100644
index 00000000000..d59c29bc01c
--- /dev/null
+++ b/Master/texmf-dist/tex/context/base/mkxl/back-pdf.mkxl
@@ -0,0 +1,157 @@
+%D \module
+%D [ file=back-pdf,
+%D version=2009.04.15,
+%D title=\CONTEXT\ Backend Macros,
+%D subtitle=\PDF,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+%D The less there is here, the better. After a decade it is time to remove the \type
+%D {\pdf*} ones completely. For the moment I keep them commented but even that will
+%D go away.
+
+\writestatus{loading}{ConTeXt Backend Macros / PDF}
+
+\registerctxluafile{lpdf-ini}{autosuffix,optimize}
+\registerctxluafile{lpdf-lmt}{autosuffix,optimize}
+\registerctxluafile{lpdf-col}{autosuffix}
+\registerctxluafile{lpdf-xmp}{autosuffix}
+\registerctxluafile{lpdf-ano}{autosuffix}
+\registerctxluafile{lpdf-res}{autosuffix}
+\registerctxluafile{lpdf-mis}{autosuffix}
+\registerctxluafile{lpdf-ren}{autosuffix}
+\registerctxluafile{lpdf-grp}{autosuffix}
+\registerctxluafile{lpdf-wid}{autosuffix}
+\registerctxluafile{lpdf-fld}{autosuffix}
+\registerctxluafile{lpdf-mov}{autosuffix}
+\registerctxluafile{lpdf-u3d}{autosuffix} % this will become a module
+%registerctxluafile{lpdf-swf}{} % this will become a module
+\registerctxluafile{lpdf-tag}{autosuffix}
+\registerctxluafile{lpdf-fmt}{autosuffix}
+\registerctxluafile{lpdf-pde}{autosuffix}
+\registerctxluafile{lpdf-img}{autosuffix,optimize}
+\registerctxluafile{lpdf-epa}{autosuffix}
+\registerctxluafile{lpdf-emb}{autosuffix,optimize}
+\registerctxluafile{lpdf-fnt}{autosuffix}
+\registerctxluafile{lpdf-rul}{autosuffix}
+
+\registerctxluafile{back-pdp}{autosuffix}
+\registerctxluafile{back-pdf}{autosuffix} % some code will move to lpdf-*
+
+\loadmkxlfile{back-u3d} % this will become a module
+%loadmkxlfile{back-swf} % this will become a module
+
+\unprotect
+
+%D We will minimize the number of calls to \PDF\ specific primitives and delegate
+%D all management and injection of code to the backend.
+%D
+%D Because we do a lot in \LUA\ and don't want interferences, we nil most of the
+%D \PDFTEX\ primitives. Of course one can always use the \type {\pdfvariable},
+%D \type {\pdfextension} and \type {\pdffeedback} primitives but it will probably
+%D have bad side effects.
+
+\permanent\protected\def\pdfextension{\clf_pdfextension}
+\permanent \def\pdffeedback {\clf_pdffeedback}
+\permanent \def\pdfvariable {\clf_pdfvariable}
+
+%D For the moment we keep this for tikz but hopefully it will at some point use
+%D the proper ones. Consider them obsolete:
+
+\permanent\protected\def\pdfliteral {\clf_pdfliteral}
+\permanent\protected\def\pdfobj {\clf_pdfobj}%
+\permanent\protected\def\pdflastobj {\numexpr\clf_pdflastobj\relax}
+\permanent\protected\def\pdfrefobj {\clf_pdfrefobj}
+
+\permanent\protected\def\pdfrestore {\pdfextension restore}
+\permanent\protected\def\pdfsave {\pdfextension save}
+\permanent\protected\def\pdfsetmatrix{\pdfextension setmatrix}
+
+\permanent\let\pdfxform \saveboxresource
+\permanent\let\pdflastxform\lastsavedboxresourceindex
+\permanent\let\pdfrefxform \useboxresource
+
+%D Here are quick and dirty compression flippers, mostly used when testing something
+%D as one can best stick to the defaults that also adapt to specific standards.
+
+\permanent\protected\def\nopdfcompression {\clf_setpdfcompression\zerocount\zerocount}
+\permanent\protected\def\onlypdfobjectcompression{\clf_setpdfcompression\zerocount\plusthree}
+\permanent\protected\def\maximumpdfcompression {\clf_setpdfcompression\plusnine \plusnine }
+\permanent\protected\def\normalpdfcompression {\clf_setpdfcompression\plusthree\plusthree}
+
+%D PDF/X (maybe combine the two lua calls)
+
+\setupbackend
+ [xmpfile=]
+
+\appendtoks
+ \edef\p_file{\backendparameter{xmpfile}}%
+ \ifempty\p_file\else
+ \clf_setxmpfile{\p_file}%
+ \fi
+\to \everysetupbackend
+
+%D This will change:
+
+\appendtoks
+ \clf_setformat
+ format {\backendparameter\c!format}%
+ level {\backendparameter\c!level}%
+ option {\backendparameter\c!option}%
+ profile {\backendparameter\c!profile}%
+ intent {\backendparameter\c!intent}%
+ file {\backendparameter\c!file}%
+ \relax
+\to \everysetupbackend
+
+%D These are the only official methods to add stuff to the resources. If more is
+%D needed for third party low level code, it can be added.
+
+\permanent\protected\def\pdfbackendsetcatalog #1#2{\clf_lpdf_addtocatalog{#1}{#2}}
+\permanent\protected\def\pdfbackendsetinfo #1#2{\clf_lpdf_addtoinfo{#1}{#2}}
+\permanent\protected\def\pdfbackendsetname #1#2{\clf_lpdf_addtonames{#1}{#2}}
+
+\permanent\protected\def\pdfbackendsetpageattribute #1#2{\clf_lpdf_addtopageattributes{#1}{#2}}
+\permanent\protected\def\pdfbackendsetpagesattribute#1#2{\clf_lpdf_addtopagesattributes{#1}{#2}}
+\permanent\protected\def\pdfbackendsetpageresource #1#2{\clf_lpdf_addtopageresources{#1}{#2}}
+
+\permanent\protected\def\pdfbackendsetextgstate #1#2{\clf_lpdf_adddocumentextgstate{#1}{#2}}
+\permanent\protected\def\pdfbackendsetcolorspace #1#2{\clf_lpdf_adddocumentcolorspace{#1}{#2}}
+\permanent\protected\def\pdfbackendsetpattern #1#2{\clf_lpdf_adddocumentpattern{#1}{#2}}
+\permanent\protected\def\pdfbackendsetshade #1#2{\clf_lpdf_adddocumentshade{#1}{#2}}
+
+\permanent \def\pdfbackendcurrentresources {\clf_lpdf_collectedresources}
+\permanent \def\pdfcolor #1{\clf_lpdf_color\numexpr\rawcolorattribute{#1}\relax}
+
+%D This is a temporary hack mthat will be removed, improved or somehow can become
+%D default.
+
+\permanent\def\TransparencyHack{\setupcolors[\c!pagecolormodel=\v!auto]}
+
+%D Just in case one needs this \unknown:
+%D
+%D \starttyping
+%D text \pdfbackendactualtext{Meier}{Müller} text
+%D \stoptyping
+
+\permanent\protected\def\pdfbackendactualtext#1#2% not interfaced
+ {\clf_startactualtext{#2}%
+ #1%
+ \clf_stopactualtext}
+
+\aliased\let\pdfactualtext\pdfbackendactualtext
+
+%D Bah, this is also needed for tikz:
+
+\ifdefined\pdfsavepos\else
+ \permanent\let\pdfsavepos \savepos
+ \permanent\let\pdflastxpos\lastxpos
+ \permanent\let\pdflastypos\lastypos
+\fi
+
+\protect \endinput