[Top][All Lists]

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

[ft] Incorrect text spacing.

From: address@hidden
Subject: [ft] Incorrect text spacing.
Date: Tue, 2 Jun 2009 15:59:04 -0400
User-agent: Thunderbird (X11/20081209)

Hello, again:

Third times a charm...

1 - I have replaced the X11 font identifiers
    with English descriptions.

2 - As stated in the posting, this is not
    strictly a Qt issue. I have observed this problem
    with wxWidget and Tcl/Tk based applications.



I am using the Qt (Trolltech/Nokia) toolkit
to write C++ applications on the Linux/X11 platform.

BUT, all text appears to be improperly spaced.
The line spacing is too large.
Upon examination the ascent and descent
font metrics appear to be ~50% too large.
(An example is included at the end of this post.)

I grew up with the understanding that ascent
was typically the distance from the base-line to the top
of the lower case 'd' character and the descent
was typically the distance from the base-line
to the bottom of the lower case 'y' character.
You add a little leading and you have the line-spacing.

There is a nice picture here:

But, the font metrics from Qt show ascent and descent
numbers which are typically 50% larger than this
resulting in visually unacceptable text spacing.

This does not appear to be a Qt-only problem
as I have also observed the same over-spacing
in applications written with the wxWidgets toolkit.

Qt tech-support blames the X11 layers (FontConfig, Truetype etc.)
for providing incorrect font metrics.

Is this true or are they misinterpreting the numbers?

It is hard to believe that 20+ years after the invention
of X11 that there are still font problems.

How do I fix this problem (at a low level) so that
text looks properly spaced in my applications?

Thanks in advance.


Example values for a real font.

Font: Courier 12 Point.
Expected-ascent : 9
Qt ascent       : 14
Expected-descent: 3
Qt descent      : 6

Font: Courier 24 Point.
Expected-ascent : 19
Qt ascent       : 27
Expected-descent: 5
Qt descent      : 11

Font: Courier 48 Point.
Expected-ascent : 39
Qt ascent       : 54
Expected-descent: 10
Qt descent      : 20

I obtained the 'expected' numbers by measuring the
appropriate characters.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]