Re: Metapost - text alignment

On Tue, 2007-01-23 at 21:32 -0800, Rob McDonald wrote:
Unless DIA goes so far as to have some tight integration with a TeX
renderer, it will never be able to properly calculate the size of
$A_{BC}$, which makes proper centering impossible.

Which is not impossible, just takes some work.

MetaPost has two commands for positioning text.   or   draw

The label command will do the left right positioning correctly, but it
is based on the bounding box, not the baseline, so it will not get the
vertical positioning correct.

The draw command is based on the left hand end of the baseline.
Vertical positioning will be correct, but unless you can calculate
text width, you won't get horizontal positioning right.

I am of the opinion that draw is the better way to go.  Most text will
not have special characters or formulas, so I think it is most
important to get the common case right (rather than none of them).  If
a user is using lots of special LaTeX formatting, then manually
adjusting the horizontal positioning isn't that big of a deal.

You can't expect to get correct positioning for anything but "plain
text".  If you want to do formatting, you're on your own until there's
TeX integration.  It's better that we do one thing right than both
things wrong.

Now the nice thing about the TextLine system is that you can get the
correct width of the string easily.  You'll notice for instance the SVG
renderer using this to specify what width the string should have in its
output.  Surely MetaPost can do the same.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]