diff options
Diffstat (limited to 'tex/context/base/spec-xtx.tex')
-rw-r--r-- | tex/context/base/spec-xtx.tex | 111 |
1 files changed, 111 insertions, 0 deletions
diff --git a/tex/context/base/spec-xtx.tex b/tex/context/base/spec-xtx.tex new file mode 100644 index 000000000..56a61631c --- /dev/null +++ b/tex/context/base/spec-xtx.tex @@ -0,0 +1,111 @@ +%D \module +%D [ file=spec-xtx, +%D version=2004.*.*, +%D title=\CONTEXT\ Special Macros, +%D subtitle=DVIPDFMx support, +%D author={Adam Lindsay \& Hans Hagen \& \unknown}, +%D date=\currentdate, +%D copyright={Adam Lindsay \& Hans Hagen}] + +\unprotect + +\startspecials[xetex] + +%D Rotation looks fine. Scaling and mirroring are also fine. + +\definespecial\dostartrotation #1{\special{x:gsave}\special{x:rotate #1}} +\definespecial\dostartscaling #1#2{\special{x:gsave}\special{x:scale #1 #2}} +\definespecial\dostartmirroring {\special{x:gsave}\special{x:scale -1 1}} + +\definespecial\dostoprotation {\special{x:grestore}} +\definespecial\dostopscaling {\special{x:grestore}} +\definespecial\dostopmirroring{\special{x:grestore}} + +\ifx\colorhexcomponent\undefined + + % this will be added to colo-hex.tex + +\else + + % because we intercept the zero condition, the .23pt in 1.23pt will disappear in the + % ifcase zero part branch + + \def\colorhexcomponent#1% + {\ifdim#1\points<.005\points + 00\else\lchexnumbers{\the\dimexpr(255\dimexpr(#1\points)\relax+.5\points)\relax}% + \fi} + + % the faster one + + \newdimen\hex@color@a \hex@color@a=.005pt + \newdimen\hex@color@b \hex@color@b=.5pt + \chardef \hex@color@c =255 + + \def\colorhexcomponent#1% + {\ifdim#1\points<\hex@color@a + 00\else\lchexnumbers{\the\dimexpr(#1\points*\hex@color@c+\hex@color@b)\relax}% + \fi} + +\fi + +% + +\definespecial\dostartrgbcolormode#1#2#3% + {\bgroup + \edef\hexcolorstring{\colorhexcomponent{#1}\colorhexcomponent{#2}\colorhexcomponent{#3}}% + \special{x:textcolor=\hexcolorstring}% + \special{x:rulecolor=\hexcolorstring}% + \egroup} + +\definespecial\dostopcolormode + {\special{x:textcolor=000000}% + \special{x:rulecolor=000000}} + +%D Whadda you mean by 'corected;, this hex color model is crazy. Why does +%D \XETEX\ provide high end font support but only hex rgb colors -) + +%D once colors are ``corrected'' by Hans, transparency should +%D follow fairly easily. A good side-effect of the above approach +%D is that we need to keep track of the color state (transparency +%D in \XETEX\ is accomplished setting the color to an RGBA quadruple, +%D rather than an RGB triple) + +%D File/graphic insertion is fouled up. I don't know why, but +%D the externalfile misses its designated box/frame. It's also not +%D finding files without the help of a \TEXUTIL\ file. + +%D Maybe \XETEX\ should provide a way to report the figure dimensions, +%D I suppose it can ask the QuickTime Driver. + +%D However it gets resolved, the following is the basic schema +%D of file inclusion for \XETEX. \type {\XeTeXpicfile} supports +%D rotation, as well, but it seems less important for \CONTEXT. +%D \XETEX\ uses QuickTime file import, which means a huge number of +%D file import options. + +%D More importantly and interestingly, there is \type +%D {XeTeXpdffile}, which supports a \type {page} option. + +\definespecial\doinsertfile#1#2#3#4#5#6#7#8#9% + {\bgroup + \dodoinsertfile{xtx}{#1}{#2}{#3}{#4}{#5}{#6}{#7}{#8}{#9}% + \egroup} + +\definefileinsertion{xtx}{jpg}{\handlepdfimage} +\definefileinsertion{xtx}{png}{\handlepdfimage} +\definefileinsertion{xtx}{pdf}{\handlepdfimage} +\definefileinsertion{xtx}{gif}{\handlepdfimage} +\definefileinsertion{xtx}{tif}{\handlepdfimage} + +% do we need it this way? either provide width and height or provide scales, +% best provide the dimensions + +% \def\handlepdfimage#1#2#3#4#5#6#7#8#9% +% {\XeTeXpicfile "#1" width #7 height #8 xscaled #3 yscaled #4\relax} + +\def\handlepdfimage#1#2#3#4#5#6#7#8#9% + {\XeTeXpicfile "#1" width #7 height #8\relax} + +\stopspecials + +\protect \endinput |