Download MetaFun - Pragma ADE

Transcript
241
vsize := ypart urcorner p - ypart lrcorner p ;
q := p xscaled ((hsize-2offset)/hsize)
yscaled ((vsize-2offset)/vsize) ;
hsize := xpart lrcorner q - xpart llcorner q ;
vsize := ypart urcorner q - ypart lrcorner q ;
\stopuseMPgraphic
We adapt the text split code to use the reduced path instead of the original.
\startuseMPgraphic{text split}
t := (ulcorner q -- urcorner q) intersectionpoint q ;
b := (llcorner q -- lrcorner q) intersectionpoint q ;
l := q cutbefore t ; l := l cutafter b ;
r := q cutbefore b ; r := r cutafter t ;
\stopuseMPgraphic
In order to test what we have reached so far, we draw the original path, the left and right part of
the reduced path, and both the top and bottom point.
\startuseMPgraphic{text draw}
drawarrow p withpen pencircle
draw
t withpen pencircle
draw
b withpen pencircle
drawarrow l withpen pencircle
drawarrow r withpen pencircle
\stopuseMPgraphic
scaled
scaled
scaled
scaled
scaled
1pt
2pt
2pt
1pt
1pt
withcolor red ;
;
;
withcolor green ;
withcolor blue ;
Again we use \includeMPgraphic to combine the components into a graphic.
\startuseMPgraphic{text}
\includeMPgraphic{text path} \includeMPgraphic{text vars}
\includeMPgraphic{text move} \includeMPgraphic{text split}
\includeMPgraphic{text draw}
\stopuseMPgraphic
Then we use \useMPgraphic{text} to call up the picture.
Talking to TEX
Typesetting in METAPOST