Behavioral changes to KFontChooser

James Richard Tyrer tyrerj at
Thu Dec 13 19:36:29 GMT 2007

Chusslove Illich wrote:

> * The style listbox double checks available styles (try set/get style and
>   see if they match before showing it). Still renames Normal into Regular,

Actually, I think that "Medium" would be the best choice except that 
according to the W3C, there are issues here.  The use of 'Normal' for 
weight is correct, however 'normal' is also used for other attributes so 
IMHO, usability would improve by using 'medium' for weight when the 
weight actually is 'Medium".  However, what is "Medium".  Actually, 
according to the CSS3 spec:

which is one of the few font spec standards that exists (although it 
isn't followed by fonts :-()), 'normal' and 'medium' are not the same. 
Following the W3C recommendations would mean that you could have both 
'Normal' (also called 'Book', 'Regular', or 'Roman' for the standard 
weight and "Medium" only if the font face was actually called that -- 
although a "Medium" weight face could be used when "Normal" requested" 
if 'Normal', 'Book', 'Regular', or 'Roman' were not available.

Personally, I would not rename what the user sees -- only make what ever 
conversion is needed to conform to the Qt API.  They probably know the 
name of the font if they actually installed it and will be a bit puzzled 
if the name in the QFontDialog isn't the same as what they installed.

Having also read the comments in QFont.cpp, it would appear that 
'Normal' is probably the best choice.  However, it should be noted that 
Qt makes no distinction between 'Normal' & 'Medium' which is going to 
cause problems unless KDE undertakes to map between the CSS3 numerical 
range: 100 to 900 where 400 is 'Normal', 500 is 'Medium', and 700 is 
'Bold'. to the Qt scale 0 to 99:

     Light 25
     Normal 50
     DemiBold 63
     Bold 75
     Black 87

Note that 'Black" is the same as 'ExtraBold' and the same is applied to 
darker faces; "ExtraBlack" can also be called "UltraBold", and then 
there is "UltraBLack" as the heaviest face.  So, it would seem that Qt 
has crowded the heavy end of the weights while there is plenty of room 
at the light end.

Note that Qt uses 50 for 'Normal' vs. CSS which uses 400 for normal.

A formula of Qt = (CSS - 100)*99/800

Gives 37.125 for 'Normal and 49.5, so there is no question that Qt is 
substituting 'Normal' for 'Medium'.

Conversion of the basis the Qt goes from 1 to 100 would be more practical.

A formula of: Qt = (CSS - 100)/8 is much easier to deal with except that 
you need to remember that UltraBlack is 99 rather than 100.

>   but no longer renames Oblique into Italic (but considers them as fallback
>   for each other when switching between families).

I agree with this since they really are not the same face.  I also have 
to tell you that there are also a few fonts that are called 'Slanted' 
which the Qt API doesn't recognize.  I don't think that there is any 
difference between 'Oblique' and 'Slanted' but I would have KDE use both.

The correct fall back (according to the WC3) would be if the user 
requests 'Italic' and it doesn't exist to fall back to 'Oblique' (or 
'Slanted').  It is possible that a type face might include both 'Italic' 
and 'Oblique' so they shouldn't just be used to mean the same thing.

Fonts are not simple, and this needs a great deal of thought to get it 
to work correctly.  Trying to simplify it works for common fonts but it 
doesn't work for the less common fonts.  Currently, Pango works better 
than KDE3, but it doesn't list the different faces in a family in a 
proper order, and it does make a few errors.

If you have volunteered to figure this out, I will provide what help I 
can.  I did not start out as a font expert, I just read up on it.

By now you probably are getting a bad headache.  But read up on it if 
you want to do this, eventually it will start to make sense.


More information about the kde-core-devel mailing list