Re: [NTG-context] 3. Re: \MPpos, pxy, initialize_box(), oh, my! (Hongwen Qiu)
hmm, that's interesting. the source of the metafun manual is a logical place to look... hadn't thought of that, but where can i find it? i searched the source browser for metafun and metafun.tex to no avail. the challenge of learning a new system like context is like cooking out of someone else's kitchen: everything you need is probably there somewhere, it's just a matter of knowing where to look. yes, i'd like to know how this family of macros---\fpos, \tpos, mpos:box and mpos:par and friends, etc.---work, and what information you can get from them. the only mention of these on this mailing list seems to be that bunch of messages you forwarded, which was back in 2008. if i can get a bit of a kickstart toward figuring them out, i'd be compelled to put the basics in the wiki. assuming mpos:box and mpos:par were some sort of built-in MPgraphics, i compiled the following short context document, where mpos:box and mpos:par had no effect :( \setupMPvariables[mpos:box][linecolor=darkred] \setupMPvariables[mpos:par][linecolor=darkred] \startpositionoverlay{testing_paragraph_outline} \setMPpositiongraphic{pos1}{mpos:box}{self=pos1} \setMPpositiongraphic{pos1}{mpos:par}{self=pos1} \stoppositionoverlay \defineoverlay[mylayer][\positionoverlay{testing_paragraph_outline}] \setupbackgrounds[page][background=mylayer] \starttext \fpos{pos1}Something special.\tpos{pos1} \stoptext On 6/06/2010 12:34 a.m., ntg-context-request@ntg.nl wrote:
Date: Sat, 05 Jun 2010 19:12:28 +0800 From: Hongwen Qiu
To:ntg-context@ntg.nl Subject: Re: [NTG-context] 3. Re: \MPpos, pxy, initialize_box(), oh my! (Hongwen Qiu) Message-ID:<4C0A311C.6010808@gmail.com> Content-Type: text/plain; charset="iso-8859-1"; Format="flowed" ? 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
Adam Fuller wrote:
hmm, that's interesting. the source of the metafun manual is a logical place to look... hadn't thought of that, but where can i find it?
http://context.aanhet.net/svn/manuals/metafun/ Best wishes, Taco
participants (2)
-
Adam Fuller
-
Taco Hoekwater