3. Re: \MPpos, pxy, initialize_box(), oh my! (Hongwen Qiu)
![](https://secure.gravatar.com/avatar/5fe7d09252b25723cb3c36bc891d600a.jpg?s=120&d=mm&r=g)
On 5/06/2010 6:31 a.m., ntg-context-request@ntg.nl wrote:
3. Re: \MPpos, pxy, initialize_box(), oh my! (Hongwen Qiu)
hi hongwen, thanks for taking an interest. my initial post had a mistake: i meant to refer to the /Metafun/ manual, not the Metapost manual. that probably didn't help. i guess what i should have said is, i know that pxy can give me the bounding /box/ (the rectangle with the maximum horizontal and vertical extents of its contents, be they set in horizontal or vertical mode), but can it give me the subset of that, the bounding /path/, if you will, when the contents are text which flows over several lines. the bounding /path/ may not be rectangular, although it will be something like the union of the bounding boxes of the text's individual lines. i think if you look at the correct reference, the difference of the effects is clear. i think the challenge is that you don't know where the line breaks will occur until you typeset it. --adam
![](https://secure.gravatar.com/avatar/ed51db6a8ac3f5e4dac39df91c8fb4a2.jpg?s=120&d=mm&r=g)
? 2010?06?05? 10:56, Adam Fuller ??:
my initial post had a mistake: i meant to refer to the /Metafun/ manual, not the Metapost manual. that probably didn't help. Actually, I know that you mean the /Metafun/ manual. i guess what i should have said is, i know that pxy can give me the bounding /box/ (the rectangle with the maximum horizontal and vertical extents of its contents, be they set in horizontal or vertical mode), but can it give me the subset of that, the bounding /path/, if you will, when the contents are text which flows over several lines. the bounding /path/ may not be rectangular, although it will be something like the union of the bounding boxes of the text's individual lines. So now, I understand what mean. i think if you look at the correct reference, the difference of the effects is clear. i think the challenge is that you don't know where the line breaks will occur until you typeset it. --adam And the source code from the manual may help you:
\setupMPvariables[mpos:box][linecolor=darkred] \setupMPvariables[mpos:par][linecolor=darkred] \startpositionoverlay{backgraphics} \setMPpositiongraphic{A-3}{mpos:box}{self=A-3} \setMPpositiongraphic{A-4}{mpos:box}{self=A-4} \setMPpositiongraphic{b:A-5}{mpos:par}{self=A-5} \setMPpositiongraphic{b:A-6}{mpos:par}{self=A-6} \stoppositionoverlay \fpos {A-5} Because the text must be laid on top of the graphic, the graphic must precede the first word in the typeset stream or it must be positioned on a separate layer. In the latter case it can be calculated directly after the paragraph is typeset, but in the former case a second pass is needed. \tpos {A-5} Given the above code, I think you can get some information about the horizontal and vertical pos of texts from \fpos and \tpos. And the mpos:par is defined in anch-pgr.mkii and anch-pgr.mkiv. But I haven't dig into the code which implement mpos:par. Hope you can find useful information there. And hope the following message I just searched out will help you too: http://archive.contextgarden.net/message/20080107.024554.314d9fee.ca.html
participants (2)
-
Adam Fuller
-
Hongwen Qiu