[Fontconfig] Strange behaviour with fixed pitch

Alan Chandler fontconfig@fontconfig.org
Sun, 2 Feb 2003 20:12:24 +0000


=2D----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Sunday 26 Jan 2003 4:51 pm, Alan Chandler wrote:
> I am not sure that I have found the right place to ask this question.
>
> A few weeks ago, I installed fontconfig (Debian Unstable), with (I assume=
 -
> and thats why I am not sure I am at the right place) libxft2.
>
> Since then, I have had a strange problem in kde (konsole) with the console
> font that it provides (see http://bugs.kde.org/show_bug.cgi?id=3D52538 )

Nobody replied to this posting so I STILL don't know if I am at the right=20
place.


>
> I have been trying to debug the problem over the last couple of weeks and
> have narrowed it down to the fact that using QT - if I toggle the
> FixedPitch property of the font that a piece of text is displayed in the
> text display displays normally when the Fixed Pitch attribute is off and
> seems to have a double width spacing when the Fixed Pitch attribute is on.
>
> With a small application doing just that - I have been running a debugger
> into the qt code to find why it changes the character spacing. =20

The font family is Helvetica

OK - I now can see exactly what is happening.  QT looks for a font that=20
matches the characteristics - it is finding a match from Xft both for non=20
=46ixed Pitch (XFT_PROPORTIONAL) and Fixed Pitch (XFT_MONO or XFT_CHARCELL)=
=20
dependent of whether its own fixedPitch flag has been set by the applicatio=
n.



> Its
> difficult to be sure but I am almost convinced that when it calls the xft
> library to render the text it does not know that it will be rendered at
> this double width.

I am wrong here - and this is the crux of the problem.  Individual characte=
r=20
widths are found by calling XftTextExtent16.  When Helvetica font (default)=
=20
is found which is XFT_PROPORTIONAL - the individual character widths vary=20
from 4 pixels wide for a space to 9 pixels wide for a 'm'.  When the same=20
font is found which has a type of XFT_MONO or XFT_CHARCELL then every=20
character has a width of 12 pixels.  This distorts the font and makes it lo=
ok=20
stretched out, with a large gap between each character.

I repeated the test with the "Console" font - which was the subject of my=20
original bug report and is supposidely a fixed pitch font naturally, at it =
is=20
returning (for point size 12) character widths of 26 pixels.

I don't know if this is considered a bug, or where to report it to.


=2D --=20
Alan Chandler
alan@chandlerfamily.org.uk
=2D----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQE+PXusuFHxcV2FFoIRAnBAAJ9GAYdeNOswudBFh0ki2KMjng7UvwCfWe3N
EBayNLqDZPHhbEXuG3tsgPk=3D
=3Dne+u
=2D----END PGP SIGNATURE-----