[Fontconfig] Strange behaviour with fixed pitch

Alan Chandler alan at chandlerfamily.org.uk
Mon Feb 3 07:12:24 EST 2003


-----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=52538 )

Nobody replied to this posting so I STILL don't know if I am at the right 
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.  

The font family is Helvetica

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



> 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 character 
widths are found by calling XftTextExtent16.  When Helvetica font (default) 
is found which is XFT_PROPORTIONAL - the individual character widths vary 
from 4 pixels wide for a space to 9 pixels wide for a 'm'.  When the same 
font is found which has a type of XFT_MONO or XFT_CHARCELL then every 
character has a width of 12 pixels.  This distorts the font and makes it look 
stretched out, with a large gap between each character.

I repeated the test with the "Console" font - which was the subject of my 
original bug report and is supposidely a fixed pitch font naturally, at it is 
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.


- -- 
Alan Chandler
alan at chandlerfamily.org.uk
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQE+PXusuFHxcV2FFoIRAnBAAJ9GAYdeNOswudBFh0ki2KMjng7UvwCfWe3N
EBayNLqDZPHhbEXuG3tsgPk=
=ne+u
-----END PGP SIGNATURE-----





More information about the Fontconfig mailing list