From 03f75e3305b5ce3289ea57a7c461db41f54aef55 Mon Sep 17 00:00:00 2001
From: Hans Hagen <pragma@wxs.nl>
Date: Wed, 17 May 2006 10:08:00 +0200
Subject: stable 2006.05.17 10:08

---
 tex/context/base/cont-new.tex | 57 ++++++++++++++++++++++++++++-
 tex/context/base/core-fig.tex | 84 ++++++++++++++++++++-----------------------
 tex/context/base/spec-dpx.tex | 14 ++++++--
 3 files changed, 107 insertions(+), 48 deletions(-)

(limited to 'tex')

diff --git a/tex/context/base/cont-new.tex b/tex/context/base/cont-new.tex
index aaf2f7f52..9b1fa1627 100644
--- a/tex/context/base/cont-new.tex
+++ b/tex/context/base/cont-new.tex
@@ -11,7 +11,7 @@
 %C therefore copyrighted by \PRAGMA. See mreadme.pdf for
 %C details.
 
-\newcontextversion{2006.05.16 18:35}
+\newcontextversion{2006.05.17 10:08}
 
 %D This file is loaded at runtime, thereby providing an
 %D excellent place for hacks, patches, extensions and new
@@ -26,6 +26,61 @@
 
 \writestatus{\m!systems}{beware: some patches loaded from cont-new.tex}
 
+% This will move to core-fig asap:
+%
+% todo: process between runs
+
+\startXMLmapping[rli]
+  \defineXMLprocess[rl:identify]
+  \defineXMLsavecontent[rl:width] {\!!zeropoint}
+  \defineXMLsavecontent[rl:height]{\!!zeropoint}
+\stopXMLmapping
+
+\def\getRLIfiguredimensions#1%
+  {\let\rliwidth \!!zeropoint
+   \let\rliheight\!!zeropoint
+   \doiffileelse{\@@effilenametype.rli}
+     {}
+     {% let's try runtime running first
+      \writestatus\m!figures{using rlxtools to determine size of \@@effilenametype}%
+      \executesystemcommand{texmfstart rlxtools --identify \@@effilenametype}}%
+   \doiffileelse{\@@effilenametype.rli}
+     {}
+     {% we assume that runtime running failed
+      \installprogram{texmfstart rlxtools --identify \@@effilenametype}}%
+   \startnointerference
+   \startXMLmapping[rli]%
+     \startXMLignore
+     \processXMLfile{\@@effilenametype.rli}%
+     \edef\rliwidth {\XMLflush{rl:width}}%
+     \edef\rliheight{\XMLflush{rl:height}}%
+     \stopXMLignore
+   \stopXMLmapping
+   \stopnointerference}
+
+\def\getfiguredimensionsC
+  {\ifcase\figurestatus\ifcase\figurefilemode\else
+     \doifsomething\@@efcurrentpath
+       {\doifnotinset\@@effiletype{\c!tex,\c!tmp}
+          {\doiffileelse\@@efcurrentfile
+             {\@@eftrace{using rlxtools to identify \@@effilenametype}%
+              \getRLIfiguredimensions{\@@effilenametype}%
+              \ifdim\rliwidth>\zeropoint \ifdim\rliheight>\zeropoint
+                \geteparameters % e !
+                  [\??ep]
+                  [\c!x=\!!zeropoint,\c!y=\!!zeropoint, % brrr, todo: bbox
+                   \c!w=\rliwidth,\c!h=\rliheight]%
+                \let\@@eftype\@@efcurrenttype
+                \let\@@effullname\@@efcurrentfile
+                \chardef\figurestatus\plusfour % todo, message is wrong now
+              \fi \fi
+              \@@eftrace{\ifcase\figurestatus not \fi found}}
+             {}}}%
+   \fi\fi}
+
+\let\doanalyzefigurefilesB\relax % obsolete
+\let\doanalyzefigurefilesC\relax % obsolete
+
 \def\environment #1 % at outermost level only (load only once)
   {\pushmacro\startenvironment
    \pushmacro\stopenvironment
diff --git a/tex/context/base/core-fig.tex b/tex/context/base/core-fig.tex
index cceb9cb1d..0c2d4f0c3 100644
--- a/tex/context/base/core-fig.tex
+++ b/tex/context/base/core-fig.tex
@@ -461,7 +461,7 @@
      \@EA\DOIF\@EA{\@@effilenametype}{#1} % hm, tzt ook nog eens met pad/naam
        {\getparameters[\??ep][#2]%
         \ExpandBothAfter\doif\@@epe\@@efcurrenttype
-          {\chardef\figurestatus4
+          {\chardef\figurestatus\plusfour
            \let\@@eftype\@@efcurrenttype
            \let\@@effullname\@@efcurrentfile}}%
    \else
@@ -471,24 +471,22 @@
 \def\getfiguredimensionsC
   {\ifconsultutilityfile \ifrunutilityfile
      \ifcase\figurestatus\ifcase\figurefilemode\else
-\doifsomething\@@efcurrentpath
-{%
-      \doifnotinset\@@effiletype{\c!tex,\c!tmp}
-         {\doiffileelse\@@efcurrentfile
-            {\edef\@@effilenametype{\@@effilename.\@@efcurrenttype}%
-             \@@eftrace{running texutil on \@@effilenametype}%
-             \def\@@efloadname{\f!utilityfilename.\f!temporaryextension}%
-             \executesystemcommand{texutil --fig --out=\@@efloadname\space\@@effilenametype}%
-             \@@eftrace{analyzing \@@efloadname\space on \@@effilenametype}%
-             \pushendofline
-             \startreadingfile
-             \let\presetfigure\presetfigureB
-             \readsetfile{.}\@@efloadname\donothing\donothing
-             \stopreadingfile
-             \popendofline
-             \@@eftrace{\ifcase\figurestatus not \fi found}}
-            {}}%
-}%
+       \doifsomething\@@efcurrentpath
+         {\doifnotinset\@@effiletype{\c!tex,\c!tmp}
+            {\doiffileelse\@@efcurrentfile
+               {\edef\@@effilenametype{\@@effilename.\@@efcurrenttype}%
+                \@@eftrace{running texutil on \@@effilenametype}%
+                \def\@@efloadname{\f!utilityfilename.\f!temporaryextension}%
+                \executesystemcommand{texutil --fig --out=\@@efloadname\space\@@effilenametype}%
+                \@@eftrace{analyzing \@@efloadname\space on \@@effilenametype}%
+                \pushendofline
+                \startreadingfile
+                \let\presetfigure\presetfigureB
+                \readsetfile{.}\@@efloadname\donothing\donothing
+                \stopreadingfile
+                \popendofline
+                \@@eftrace{\ifcase\figurestatus not \fi found}}
+               {}}}%
      \fi\fi
    \fi\fi}
 
@@ -503,19 +501,17 @@
 
 \def\doanalyzefigurefilesB
   {\ifconsultutilityfile\ifcase\figurestatus\ifcase\figurefilemode\else
-\doifsomething\@@efcurrentpath
-{%
-     \assignfullfilename\@@efcurrentpath\@@exfile\to\@@efloadname
-     \edef\@@effilenametype{\@@effilename.\figureextension{\@@efcurrenttype}}%
-     \@@eftrace{analyzing \@@efloadname\space on \@@efcurrentpath\space for \@@effilenametype}%
-     \pushendofline
-     \startreadingfile
-     \let\presetfigure\presetfigureC
-     \readsetfile\@@efcurrentpath\@@exfile\donothing\donothing
-     \stopreadingfile
-     \popendofline
-     \@@eftrace{\ifcase\figurestatus not \fi found}%
-}%
+     \doifsomething\@@efcurrentpath
+       {\assignfullfilename\@@efcurrentpath\@@exfile\to\@@efloadname
+        \edef\@@effilenametype{\@@effilename.\figureextension{\@@efcurrenttype}}%
+        \@@eftrace{analyzing \@@efloadname\space on \@@efcurrentpath\space for \@@effilenametype}%
+        \pushendofline
+        \startreadingfile
+        \let\presetfigure\presetfigureC
+        \readsetfile\@@efcurrentpath\@@exfile\donothing\donothing
+        \stopreadingfile
+        \popendofline
+        \@@eftrace{\ifcase\figurestatus not \fi found}}%
    \fi\fi\fi}
 
 \def\presetfigureC[#1][#2]%
@@ -523,7 +519,7 @@
      \@EA\DOIF\@EA{\@@effilenametype}{#1}
        {\getparameters[\??ep][#2]%
         \doif\@@epe\@@efcurrenttype
-          {\chardef\figurestatus4
+          {\chardef\figurestatus\plusfour
            \let\@@eftype\@@efcurrenttype
            \let\@@effullname\@@efcurrentfile}}%
    \else
@@ -535,18 +531,16 @@
 
 \def\doanalyzefigurefilesC
   {\ifconsultutilityfile\ifcase\figurestatus\ifcase\figurefilemode\else
-\doifsomething\@@efcurrentpath
-{%
-     \assignfullfilename\@@efcurrentpath\@@exfile\to\@@efloadname
-     \@@eftrace{analyzing \@@efloadname\space on \@@efcurrentpath\space for \@@effilename.* surrogate}%
-     \pushendofline
-     \startreadingfile
-     \let\presetfigure\presetfigureD
-     \readsetfile\@@efcurrentpath\@@exfile\donothing\donothing
-     \stopreadingfile
-     \popendofline
-     \@@eftrace{\ifcase\figurestatus not \fi found}%
-}%
+     \doifsomething\@@efcurrentpath
+       {\assignfullfilename\@@efcurrentpath\@@exfile\to\@@efloadname
+        \@@eftrace{analyzing \@@efloadname\space on \@@efcurrentpath\space for \@@effilename.* surrogate}%
+        \pushendofline
+        \startreadingfile
+        \let\presetfigure\presetfigureD
+        \readsetfile\@@efcurrentpath\@@exfile\donothing\donothing
+        \stopreadingfile
+        \popendofline
+        \@@eftrace{\ifcase\figurestatus not \fi found}}%
    \fi\fi\fi}
 
 \def\presetfigureD[#1][#2]%
diff --git a/tex/context/base/spec-dpx.tex b/tex/context/base/spec-dpx.tex
index 2e4aaa6f1..f317a3887 100644
--- a/tex/context/base/spec-dpx.tex
+++ b/tex/context/base/spec-dpx.tex
@@ -853,7 +853,7 @@
 
 %D 7. Copied codes from \type{spec-dvi}
 
-% coming pdftex versions will provide pos support
+% coming pdftex versions will provide pos support in dvi mode (untested)
 
 % \ifnum\pdftexversion>140 .. \fi
 
@@ -869,11 +869,21 @@
 \let\flushDVIpositionpapersize\relax
 
 \definespecial\dosetpositionpapersize#1#2%
-  {\xdef\flushDVIpositionpapersize%
+  {\xdef\flushDVIpositionpapersize
      {\special{pos:papersize #1 #2}%
       \noexpand\installprogram{dvipos -o \jobname.tuo \jobname.dvi }%
       \global\noexpand\let\noexpand\flushDVIpositionpapersize\relax}}
 
+\beginXETEX
+
+  \definespecial\dosetpositionpapersize#1#2%
+    {\xdef\flushDVIpositionpapersize
+       {\special{pos:papersize #1 #2}%
+        \noexpand\installprogram{dvipos -o \jobname.tuo \jobname.xdv }%
+        \global\noexpand\let\noexpand\flushDVIpositionpapersize\relax}}
+
+\endXETEX
+
 \prependtoksonce \flushDVIpositionpapersize \to \everyshipout
 
 \stopspecials
-- 
cgit v1.2.3