Mail Archives: geda-user/2013/06/18/14:51:55
On 06/18/2013 09:34 AM, Edward Hennessy wrote:
> Sent from my iPhone
>
> On Jun 18, 2013, at 3:17 AM, Roland Lutz <rlutz AT hedmen DOT org> wrote:
>
>> In my opinion, the way text measurements are handled in gEDA is somewhat broken.
> I would like to see the behavior centering text vertically in gschem changed. Right now, it uses a function of the inked rectangle. So, when centering the words "hello" and "goodbye" vertically, each winds up with a different y coordinate for the baseline, because of the descenders.
>
> I would rather text was centered between the baseline of the bottom row of text and the cap height of the top row of text. This way, the baseline of text would be centered vertically, on a pin for example, regardless of wether the text contains descenders or not.
>
> The only way I know to obtain the cap height is to measure it. For example, measuring the inked rectangle from a capital letter with a flat top, like H or I.
>
> Does anyone else have thoughts on centering text vertically?
>
> Ed
>
Look at the way Cairo renders text. Each font has four lines, I forget
all the names, but for what you want, you would ignore the ascent and
descent and use the baseline and the ummm.... foo-line (not it's real
name :) You can get those numbers from Cairo functions. You could whip
up a quick Python program to get the numbers for a font of interest.
Google some Cairo text rendering tutorials and it should all show up.
I've spent a few minutes over the last couple of days looking at gschem
text rendering, and it does a lot of work to munge Cairo font metrics
into something that has reasonable backwards compatibility with old
gschem text rendering. So, the behavior you are seeing is a feature :)
For what I want, I need to figure out how to scale a font so that the "y
advance" number matches with gschem's way of measuring the world. Or at
least to within a few percent, since for laying out a symbol all the
interesting anchor points get rounded up to a grid unit (100 mil)
boundary anyway. I just want to avoid overlap, mainly.
-dave
- Raw text -