textext vs. btex ... etex
Hi, I've been trying to troubleshoot a problem with TeX labels I ran into the other day... finally I discovered that 1. MkIV (textext) includes TeX material as one single chunk apparently while MkII (btex ... etex) used to include a decomposable picture and that 2. the anchor point is completely different! Is there any way to restore both the "individual addressing" of glyphs and the MkII anchor point in MkIV? This would be crucial for a customized labelling macro... Best, Oliver P.S. Why is "h," included as one piece in MkII?
On 17-8-2010 4:32, Oliver Buerschaper wrote:
Hi,
I've been trying to troubleshoot a problem with TeX labels I ran into the other day... finally I discovered that
1. MkIV (textext) includes TeX material as one single chunk apparently while MkII (btex ... etex) used to include a decomposable picture and that 2. the anchor point is completely different!
Is there any way to restore both the "individual addressing" of glyphs and the MkII anchor point in MkIV?
This would be crucial for a customized labelling macro...
Best, Oliver
P.S. Why is "h," included as one piece in MkII?
the fact that you have pieces in mkii is a side effect of dvitomp turning dvi output in mp pictures; in the process it combines glyphs that have no kerning and whatever spacing becomes shifts in mkiv the text is treated as a whole and that will not change so, if in mkiv you want pieces, you need to textext each snippet that you want as such keep in mind that the way mkii (read: external tex processing and dvitomp) works is quite unpredictable Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
the fact that you have pieces in mkii is a side effect of dvitomp turning dvi output in mp pictures; in the process it combines glyphs that have no kerning and whatever spacing becomes shifts
Oh, I didn't know the pieces used to come about by accident... actually, by a rather favourable accident if I may add :-)
in mkiv the text is treated as a whole and that will not change
That's rather bad news... then essentially MetaPost is a lost case for retouching digital typography it seems. Will have to switch to Illustrator (with the Scriptographer plugin) for these tasks. Sadly, batch processing and TeX integration will be gone with that alternative.
so, if in mkiv you want pieces, you need to textext each snippet that you want as such
Alright... in that case how would I make sure that all glyph positions are kept if my TeX material is, say, some complex formula? How could I find the baseline with textext?
keep in mind that the way mkii (read: external tex processing and dvitomp) works is quite unpredictable
Sure. Similar functionality doesn't need to resort to the same implementation :-) Oliver
On Wed, Aug 18, 2010 at 02:20:51PM +0200, Oliver Buerschaper wrote:
the fact that you have pieces in mkii is a side effect of dvitomp turning dvi output in mp pictures; in the process it combines glyphs that have no kerning and whatever spacing becomes shifts
Oh, I didn't know the pieces used to come about by accident... actually, by a rather favourable accident if I may add :-)
in mkiv the text is treated as a whole and that will not change
That's rather bad news... then essentially MetaPost is a lost case for retouching digital typography it seems. Will have to switch to Illustrator (with the Scriptographer plugin) for these tasks. Sadly, batch processing and TeX integration will be gone with that alternative.
I always develop a kind of romantic relationship with the tools I use, I either hate it and stop using it no matter what it can or can not do; I hate OpenOffice and Qt, for example, and I would never, willingly use either. On the other hand, when I love some tool I never turn my back to it, no matter what shortcomings it might have, love is blind. I love TeX, and though it has a horrible macro language, I keep using it. One don't just drop his tools just because he can't, yet, figure out how to make it do what he wants. You have to try harder, show your love, your commitment, it will certainly pay back. ;) Regards, Khaled -- Khaled Hosny Arabic localiser and member of Arabeyes.org team Free font developer
I always develop a kind of romantic relationship with the tools I use, I either hate it and stop using it no matter what it can or can not do; I hate OpenOffice and Qt, for example, and I would never, willingly use either. On the other hand, when I love some tool I never turn my back to it, no matter what shortcomings it might have, love is blind. I love TeX, and though it has a horrible macro language, I keep using it.
One don't just drop his tools just because he can't, yet, figure out how to make it do what he wants. You have to try harder, show your love, your commitment, it will certainly pay back.
;)
Sigh. Oliver
On 18-8-2010 2:20, Oliver Buerschaper wrote:
the fact that you have pieces in mkii is a side effect of dvitomp turning dvi output in mp pictures; in the process it combines glyphs that have no kerning and whatever spacing becomes shifts
Oh, I didn't know the pieces used to come about by accident... actually, by a rather favourable accident if I may add :-)
Well, it all depends on kerning. So 'abc' can become 'a' 'b' 'c' or 'ab' 'c' or 'a' 'bc' or 'abc' depending on the kerning pairs. IN math it depends on the spacing of math characters.
in mkiv the text is treated as a whole and that will not change
That's rather bad news... then essentially MetaPost is a lost case for retouching digital typography it seems. Will have to switch to Illustrator (with the Scriptographer plugin) for these tasks. Sadly, batch processing and TeX integration will be gone with that alternative.
so, if in mkiv you want pieces, you need to textext each snippet that you want as such
Alright... in that case how would I make sure that all glyph positions are kept if my TeX material is, say, some complex formula? How could I find the baseline with textext?
see mp.mplib for all those anchor points Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
so, if in mkiv you want pieces, you need to textext each snippet that you want as such
Alright... in that case how would I make sure that all glyph positions are kept if my TeX material is, say, some complex formula? How could I find the baseline with textext?
see mp.mplib for all those anchor points
OK. I found in mp-mplib.mp that rawtextext() does what I was looking for... the baseline is anchored to the current point: --- \setupbodyfont[10pt] \starttext \startMPinclusions pickup pencircle scaled 0.05pt; defaultpen := savepen; picture crosshair; crosshair := image(draw fullcircle scaled 2pt; draw (0,-2pt)--(0,2pt); draw (-2pt,0)--(2pt,0); ); bboxmargin := 0; \stopMPinclusions \startMPpage for item within rawtextext("$(h,g)$"): draw bbox item withcolor 0.8white; draw item; endfor; draw crosshair; \stopMPpage \stoptext --- This solves step one! Now onto step two: how can I typeset each glyph in the formula individually such that it appears precisely in the right location? Thanks, Oliver
On 08/21/2010 04:24 PM, Oliver Buerschaper wrote:
Now onto step two: how can I typeset each glyph in the formula individually such that it appears precisely in the right location?
I must be misreading something here, but I cannot figure out what 'the right location' means. Best wishes, Taco
Now onto step two: how can I typeset each glyph in the formula individually such that it appears precisely in the right location?
I must be misreading something here, but I cannot figure out what 'the right location' means.
Since textext() always returns a single picture that can't be decomposed into smaller building blocks Hans suggested to textext() each desired snippet individually. So I tried --- \setupbodyfont[10pt] \starttext \startMPinclusions pickup pencircle scaled 0.05pt; defaultpen := savepen; picture crosshair; crosshair := image(draw fullcircle scaled 2pt; draw (0,-2pt)--(0,2pt); draw (-2pt,0)--(2pt,0); ); bboxmargin := 0; \stopMPinclusions \startMPpage for item within rawtextext("$(h,g)$"): draw bbox item withcolor 0.8white; draw item; endfor; draw crosshair; \stopMPpage \startMPpage draw bbox rawtextext("$($") withcolor 0.8white; draw rawtextext("$($"); draw bbox rawtextext("$h$") withcolor 0.8white; draw rawtextext("$h$"); draw bbox rawtextext("$,$") withcolor 0.8white; draw rawtextext("$,$"); draw bbox rawtextext("$g$") withcolor 0.8white; draw rawtextext("$g$"); draw bbox rawtextext("$)$") withcolor 0.8white; draw rawtextext("$)$"); draw crosshair; \stopMPpage \stoptext --- Clearly, this gives me each glyph individually but stacked on top of each other. What I need though is that the second figure looks exactly like the first one (with all glyphs in the right location) except that the grey bounding boxes appear per glyph. Thanks for your help, Oliver
On 08/22/2010 09:53 AM, Oliver Buerschaper wrote:
Clearly, this gives me each glyph individually but stacked on top of each other. What I need though is that the second figure looks exactly like the first one (with all glyphs in the right location) except that the grey bounding boxes appear per glyph.
I know what you want now, but I have no idea how to go about doing it via this approach. It could be made to work from the other direction (by writing lua code to intercept tex nodes) but that is not trivial either. You could use standalone metapost with btex ... etex, that would work. Best wishes, Taco
Clearly, this gives me each glyph individually but stacked on top of each other. What I need though is that the second figure looks exactly like the first one (with all glyphs in the right location) except that the grey bounding boxes appear per glyph.
I know what you want now, but I have no idea how to go about doing it via this approach. It could be made to work from the other direction (by writing lua code to intercept tex nodes) but that is not trivial either.
I see.
You could use standalone metapost with btex ... etex, that would work.
OK. But then I would lose e.g. OpenType fonts, right? Oliver
Oliver Buerschaper wrote:
Clearly, this gives me each glyph individually but stacked on top of each other. What I need though is that the second figure looks exactly like the first one (with all glyphs in the right location) except that the grey bounding boxes appear per glyph. I know what you want now, but I have no idea how to go about doing it via this approach. It could be made to work from the other direction (by writing lua code to intercept tex nodes) but that is not trivial either.
I see.
You could use standalone metapost with btex ... etex, that would work.
OK. But then I would lose e.g. OpenType fonts, right?
Yes, sorry
participants (4)
-
Hans Hagen
-
Khaled Hosny
-
Oliver Buerschaper
-
Taco Hoekwater