Re: PyDia and Metapost



However, the vertical positioning still seems to be off by about the
height
of a lower case letter.  Baseline vs. character center.

             Rob

In render_metapost.c , in the function draw_string , there is a switch based
on Dia's alignment parameter.  The comment says

/* We use the "top" modifier to MetaPost's alignment because Dia draws
 * text _above_ the point at which the text is "located".  */

(sorry I don't have a line number, I'm browsing source in the online CVS.)

Consequently, the code uses the MetaPost commands

label.urt
label.top
label.ulft

For right, center, and left aligned text.  This would appear to be the right
thing to do.

However, when you position text in a box, it comes out wrong.  Manually
editing the *.mp file and replacing the above strings with

label.rt
label
label.lft

Gives the behavior I'd like to see (very close to where it appears on the
Dia screen.)

The MetaPost home page w/ documentation:
http://cm.bell-labs.com/who/hobby/MetaPost.html

Should be a trivial fix, but the comment makes me think it should be right.
Has Dia's semantics for text positioning changed since this comment was
written?  Does Dia's handling of text positioning change depending on what
kind of object you're working with?  I am using labeled rectangles from the
flowchart sheet.

When I don't change the MetaPost commands noted above, the text is placed in
the wrong place in the rectangle.  This is especially evident when you have
a multi-line label, in that case, the text frequently falls outside the box.

Thanks,

             Rob




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