summaryrefslogtreecommitdiff
path: root/tex/context/base/spec-tpd.tex
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2004-08-15 00:00:00 +0200
committerHans Hagen <pragma@wxs.nl>2004-08-15 00:00:00 +0200
commit57f1545214ebba9625b9be722d4e4f9357dab87a (patch)
tree29dd99fb0b08de5fca50a557e8af043ea082478a /tex/context/base/spec-tpd.tex
parent599c5089a184d1967ec8dc66307de52378e911d4 (diff)
downloadcontext-57f1545214ebba9625b9be722d4e4f9357dab87a.tar.gz
stable 2004.08.15
Diffstat (limited to 'tex/context/base/spec-tpd.tex')
-rw-r--r--tex/context/base/spec-tpd.tex142
1 files changed, 117 insertions, 25 deletions
diff --git a/tex/context/base/spec-tpd.tex b/tex/context/base/spec-tpd.tex
index 10ab42ed3..224f7520e 100644
--- a/tex/context/base/spec-tpd.tex
+++ b/tex/context/base/spec-tpd.tex
@@ -125,6 +125,8 @@
\pdfoptionpdfminorversion=5
+\def\PDFversion{1.\the\pdfoptionpdfminorversion}%
+
% %D Why are the Acrobat viewers so buggy? To prevent font cache
% %D mismatches, we say:
%
@@ -243,7 +245,7 @@
\definespecial\dogetnofinsertpages#1%
{\xdef\nofinsertpages{1}% global
\doifvalidpdfimagefileelse{#1}%
- {\pdfximage{#1}\xdef\nofinsertpages{\the\pdflastximagepages}}
+ {\pdfximage {#1}\xdef\nofinsertpages{\the\pdflastximagepages}}
{}}
%D Currently we support \type{pdf} for \PDF\ files, \type{mps}
@@ -320,6 +322,7 @@
\ifdim#7>\zeropoint \!!width #7\fi
\ifdim#8>\zeropoint \!!height #8\fi
\pdfimagepagenumber
+% \@@DriverImageBox
{#1}%
\xdef\PDFimagereference{\the\pdflastximage}%
\xdef\nofinsertpages{\the\pdflastximagepages}%
@@ -370,6 +373,8 @@
%D themselves have alternatives, especially cylcic
%D dependencies.
+\ifx\@@DriverImageBox\undefined \def\@@DriverImageBox{artbox} \fi
+
\ifnum\pdftexversion>13
\def\checkpdfimageattributes
@@ -400,8 +405,9 @@
\the\everyPDFximage
\checkpdfimagepagenumber{#3}%
\checkpdfimageattributes
- \global\setbox\foundexternalfigure\vbox
- {\immediate\pdfximage \pdfimageattributes \pdfimagepagenumber{#2}%
+ \global\setbox\foundexternalfigure\hbox
+ {\immediate\pdfximage
+ \pdfimageattributes \pdfimagepagenumber \@@DriverImageBox {#2}%
\xdef\PDFimagereference{\the\pdflastximage}%
\xdef\nofinsertpages{\the\pdflastximagepages}%
\pdfrefximage\pdflastximage}%
@@ -419,19 +425,19 @@
\else
-\def\dogetTPDfiguresize#1#2#3#4#5#6#7%
- {\ifmeasureTPDfiguresize
- #4\zeropoint
- #5\zeropoint
- \doifvalidpdfimagefileelse{#2}
- {\global\setbox\foundexternalfigure\vbox{\pdfimage{#2}}%
- #6\wd\foundexternalfigure
- #7\ht\foundexternalfigure}
- {#6\zeropoint
- #7\zeropoint}%
- \else
- #1{#2}{#3}{#4}{#5}{#6}{#7}% \normaldogetfiguresize...
- \fi}
+ \def\dogetTPDfiguresize#1#2#3#4#5#6#7%
+ {\ifmeasureTPDfiguresize
+ #4\zeropoint
+ #5\zeropoint
+ \doifvalidpdfimagefileelse{#2}
+ {\global\setbox\foundexternalfigure\vbox{\pdfimage{#2}}%
+ #6\wd\foundexternalfigure
+ #7\ht\foundexternalfigure}
+ {#6\zeropoint
+ #7\zeropoint}%
+ \else
+ #1{#2}{#3}{#4}{#5}{#6}{#7}% \normaldogetfiguresize...
+ \fi}
\fi
@@ -510,17 +516,77 @@
\definespecial\doregisterrgbspotcolor {\doPDFregisterrgbspotcolor}
\definespecial\doregistergrayspotcolor{\doPDFregistergrayspotcolor}
+\definespecial\doregistercmykindexcolor{\doPDFregistercmykindexcolor}
+\definespecial\doregisterrgbindexcolor {\doPDFregisterrgbindexcolor}
+\definespecial\doregistergrayindexcolor{\doPDFregistergrayindexcolor}
+
\definespecial\dostartnonecolormode{\doPDFstartnonecolormode}
\definespecial\doregisternonecolor {\doPDFregisternonecolor}
-\def\doPDFregistersomespotcolor#1#2#3#4%
- {\immediate \pdfobj stream attr
- {/FunctionType 4 /Domain [0.0 1.0] /Range #3}{#4}%
+% \def\doPDFregistersomespotcolor#1#2#3#4%
+% {\immediate \pdfobj stream attr
+% {/FunctionType 4 /Domain [0.0 1.0] /Range #3}{#4}%
+% \immediate \pdfobj
+% {[/Separation /#1 /Device#2 \the\pdflastobj\space0 R]}%
+% \dosetobjectreference{PDFCS}{#1}{\the\pdflastobj}%
+% \appendtoPDFdocumentcolorspaces
+% {/#1 \the\pdflastobj\space0 R}}
+
+\def\doPDFregistersomespotcolor#1#2#3#4#5#6#7% name fractions names p's space domain function
+ {\bgroup
+ \let\spotpops\empty
+ \ifcase#2\or
+ \def\PDFspotcolornames{/Separation /#1}%
+ \def\PDFspotcolordomain{0.0 1.0}%
+ \else
+ \dorecurse{#2}{\edef\spotpops{\spotpops pop }}%
+ \let\PDFspotcolornames \empty
+ \let\PDFspotcolordomain\empty
+ \def\dospotcolorcommand##1%
+ {\edef\PDFspotcolornames {\PDFspotcolornames/##1\space}%
+ \edef\PDFspotcolordomain{\PDFspotcolordomain 0.0 1.0\space}}%
+ \processcommacommand[#3]\dospotcolorcommand
+ \edef\PDFspotcolornames{/DeviceN [\PDFspotcolornames]}%
+ \fi
+ \immediate \pdfobj stream attr
+ {/FunctionType 4 /Domain [\PDFspotcolordomain] /Range [#6]}{{\spotpops#7}}%
\immediate \pdfobj
- {[/Separation /#1 /Device#2 \the\pdflastobj\space0 R]}%
+ {[\PDFspotcolornames\space /Device#5 \the\pdflastobj\space0 R]}%
\dosetobjectreference{PDFCS}{#1}{\the\pdflastobj}%
- \appendtoPDFdocumentcolorspaces
- {/#1 \the\pdflastobj\space0 R}}
+ \appendtoPDFdocumentcolorspaces{/#1 \the\pdflastobj\space0 R}%
+ \egroup}
+
+%D New and very experimental.
+
+\def\doPDFregistersomeindexcolor#1#2#3#4#5#6#7% name fractions names p's space domain function
+ {\bgroup
+ \let\spotpops\empty
+ \dorecurse{#2}{\edef\spotpops{\spotpops exch pop\space}}%
+ \let\PDFspotcolornames \empty
+ \let\PDFspotcolordomain\empty
+ \def\docommand##1%
+ {\edef\PDFspotcolornames {\PDFspotcolornames/##1\space}%
+ \edef\PDFspotcolordomain{\PDFspotcolordomain 0.0 1.0\space}}%
+ \processcommacommand[#3,None]\docommand
+ \let\PDFcolorindexvector\empty
+ \def\docommand##1%
+ {\scratchdimen##1\points
+ \scratchdimen\recurselevel\scratchdimen
+ \scratchcounter\scratchdimen
+ \divide\scratchcounter \maxcard
+ \edef\PDFcolorindexvector{\PDFcolorindexvector\uchexnumbers\scratchcounter}}%
+ \dostepwiserecurse\zerocount{255}\plusone
+ {\rawprocesscommacommand[#4,1]\docommand
+ \xdef\PDFcolorindexvector{\PDFcolorindexvector\space}}%
+ \immediate \pdfobj stream attr
+ {/FunctionType 4 /Domain [\PDFspotcolordomain] /Range [#6]}{{\spotpops#7}}%
+ \immediate \pdfobj
+ {[/Indexed
+ [/DeviceN [\PDFspotcolornames] /Device#5 \the\pdflastobj\space0 R] %
+ 255 <\PDFcolorindexvector>]}%
+ \dosetobjectreference{PDFIX}{#1}{\the\pdflastobj}%
+ \appendtoPDFdocumentcolorspaces{/#1_INDEXED \the\pdflastobj\space0 R}%
+ \egroup}
%D \macros
%D {dostarttransparency,dostoptransparency}
@@ -535,7 +601,9 @@
\def\@@PDT{@PDT@}
-\newcount\PDFcurrenttransparency \PDFcurrenttransparency=0 % -1
+\ifx\PDFcurrenttransparency\undefined
+ \newcount\PDFcurrenttransparency \PDFcurrenttransparency=0 % -1
+\fi
\def\assignPDFtransparency#1#2%
{\def\PDFtransparencyidentifier{/Tr#1}%
@@ -1140,11 +1208,13 @@
\def\doPDFdictionaryobject class #1 name #2 data #3%
{\flushatshipout
- {\immediate\pdfobj{<< #3 >>}\dosetobjectreference{#1}{#2}{\the\pdflastobj}}}
+ {\immediate\pdfobj{<< #3 >>}%
+ \dosetobjectreference{#1}{#2}{\the\pdflastobj}}}
\def\doPDFarrayobject class #1 name #2 data #3%
{\flushatshipout
- {\immediate\pdfobj{[ #3 ]}\dosetobjectreference{#1}{#2}{\the\pdflastobj}}}
+ {\immediate\pdfobj{[ #3 ]}%
+ \dosetobjectreference{#1}{#2}{\the\pdflastobj}}}
%D \macros
%D {defaultobjectreference,doPDFgetobjectreference}
@@ -1234,6 +1304,28 @@
\definespecial\dostartfonteffect{\doPDFstartfonteffect}
\definespecial\dostopfonteffect {\doPDFstopfonteffect}
+%D Some MP stuff:
+
+\let\handleMPfshow\dohandleMPfshow % default anyway
+
+\ifnum\pdftexversion<14
+
+ \def\setMPPDFobject#1#2% resources boxnumber
+ {\def\getMPPDFobject{\box#2}}
+
+\else
+
+ \def\setMPPDFobject#1#2% resources boxnumber
+ {\immediate\pdfxform resources{#1}#2%
+ \edef\getMPPDFobject{\noexpand\pdfrefxform\the\pdflastxform}}
+
+\fi
+
+\let\getMPPDFobject\relax
+
+\definespecial\doinsertMPfile#1%
+ {\doiffileelse{./#1}{\includeMPasPDF{./#1}}{\message{[MP #1]}}}
+
%D Now we can finish this module.
\stopspecials