Re: Metapost - text alignment



> I don't remember the exact details of the fix, but I've posted on it
> before.  Search the archives for messages from me, or if you can't
> find it, ask me and I'll look it up.

I take it you're thinking of
<http://mail.gnome.org/archives/dia-list/2006-February/msg00114.html>.
Could you extend the example with something that sets the width of the
text?  With draw_textline, that is available for free and is essential
for correct rendering.

That is the thread I was remembering.  There were some red herrings
which preceded it due to my confusion.

In MetaPost, LaTeX renders the text, and I don't think MP ever 'knows'
or 'controls' the text width.  The text width is a fallout from the
font size and the string.

However, the DIA calculated text width can be used to horizontally
align the string.  The draw command positions the text according to
the left end of the baseline.  So, by shifting the text by -w/2 or -w,
you can center or right justify the text about the intended point.

Looking at the MetaPost documentation
(http://www.tug.org/docs/metapost/mpman.pdf), it looks like you can
still access the bounding box information when you render text with
draw instead of label.  Consequently, it may be possible to do the
centering correctly after all.

From the documentation, I do not understand the scope of the bounding
box information (when it exists, and how it can be accessed), I will
try to find some time to play with it soon.  Right now, I don't even
have LaTeX up and running on my laptop.

                Rob



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