two dvipos fixes so that it works with ConTeXt
[Karl and Norbert CC'ed in case dvipos is going into their trees]
The dvipos I have (cvs'ed from cvs.ktug.or.kr:/home/cvsroot) needs two
fixes for it to work with the 2007.01.02 context (and maybe with earlier
versions too). This is on Ubuntu i386, texlive 2005.
Try this file with 'texexec --dvi --nobackend' to see the problems -- or
if there are none, let me know why it works for you!
=================== begin: to-dvi.tex ==================
\defineoverlay [foregraphics] [\positionoverlay{foregraphics}]
\setupbackgrounds
[page]
[background={foreground,foregraphics}]
\starttext
\hpos{r23}{7} \quad \hpos{r24}{8}
\startMPpositiongraphic{mypos:line}
mpprocset := 0; % context doesn't yet handle the new mpprocsets
path pa, pb, pab ; numeric na, nb ;
initialize_box(\MPpos{\MPvar{from}}) ;
na := nxy ; pa := llxy..lrxy..urxy..ulxy..cycle ;
initialize_box(\MPpos{\MPvar{to}}) ;
nb := nxy ; pb := llxy..lrxy..urxy..ulxy..cycle ;
if na=nb :
pab := center pa -- center pb ;
pab := pab cutbefore (pab intersectionpoint pa) ;
pab := pab cutafter (pab intersectionpoint pb) ;
pickup pencircle;
draw pab;
anchor_box(\MPanchor{\MPvar{from}}) ;
fi ;
\stopMPpositiongraphic
\startpositionoverlay{foregraphics}
\setMPpositiongraphic{r23}{mypos:line}{to=r24}
\stoppositionoverlay
The pattern.
\stoptext
=================== end: to-dvi.tex ==================
Problems:
1. The dvipos output is in sp (but without labelling that), which
confuses the next run of ConTeXt. So the first patch makes dvipos
append 'sp' to the coordinates it outputs. That change was easier
than hacking the tex macros that parses the output.
2. After that is fixed, the coordinates are wrong, so running the above
file again crashes because the boxes are in the wrong place and the
paths no longer intersect. The second patch corrects this problem,
which is caused by dvipos parsing the dvi file incorrectly.
Maybe ConTeXt used to output the dimens in the pos: \special in sp?
Anyway, the special now looks like (see to-dvi.dvi):
pos:pxywhd "text:1" 426.78743pt 597.51323pt 0.0pt
which was being parsed by dvipos as 426 etc. and assumed to be sp, so
it was writing junk to to-dvi.tuo file, and the next run was failing
becaues the boxes were in the wrong location. So I made dvipos read
in floats with 'pt' appended, then convert them to sp.
By the way, what is the 'list' that dvipos is looking for after the
three dimens above? If anything needs a \pospxyplus, it'll be in
trouble since I think 'list' scanf target is not being parsed, so the
var remains uninitialized.
-Sanjoy
`A nation of slaves is always prepared to applaud the clemency of their
master who, in the abuse of absolute power, does not proceed to the
last extremes of injustice and oppression.' (Gibbon)
# HG changeset patch
# User Sanjoy Mahajan
participants (1)
-
Sanjoy Mahajan