Re: Metapost - text alignment

On 1/27/07, Lars Clausen <lars raeder dk> wrote:
On Fri, 2007-01-26 at 07:51 -0800, Rob McDonald wrote:
> 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.

Can't we tell the LaTeX part to scale it to a certain width?

I'll see what I can do.  I think I can come up with another MetaPost
macro to scale any object to a desired width.  However, I don't think
that is a great idea.

Can you explain why the current approach is not sufficient?

In the current approach, you set the font (cmr10) in DIA, which is
10pt Computer Modern.  You also set the font height in DIA (say

In the MetaPost output you saw, there is the 'scaled 1.0'
transformation.  DIA's output for the above situation is actually
'scaled 1.05000'.  As 0.35cm is 5% greater than 10pt.

I prefer text size to be controlled directly (in terms of text height.
10pt preferred, 0.35cm ok).  That way, no matter what text I create,
the font size will be globally the same.

For example, DIA doesn't know how to calculate the width of the
following string.


If it estimates the width, and then forces MetaPost to scale the text
to its estimate, it will end up in a larger font size than the
following string.

Mary had a little lamb.

Which I don't think is a good idea.

What I demonstrated in the MetaPost code in the other e-mail was
sufficient to position any text, left, right, or center justified, in
any font size (via 'scaled 1.575' for 12pt).  This will be done
correctly, even if the text string contains math expressions that DIA
doesn't really know how to handle.

Is there someplace I can post a pdf demonstrating the results of this stuff?


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