3. Re: \MPpos, pxy, initialize_box(), oh my! (Hongwen Qiu)
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
? 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