Review Request 123458: Improvements to the handling of font weights and styles

René J.V. Bertin rjvbertin-Re5JQEeQqe8AvxtiuMwx3w at
Tue Apr 21 23:06:05 BST 2015

This is an automatically generated e-mail. To reply, visit:

(Updated April 22, 2015, 12:06 a.m.)

Review request for KDE Software on Mac OS X and Qt KDE.

Repository: qt


Handling of and support for less common font weight/style combinations is far from ideal on OS X but not perfect on Linux either. It is not difficult to run into typefaces that will not be restored properly from settings files for instance, because QFont(family,weight,style) and other methods to obtain a QFont from a font description do not return the appropriate font.
This is especially the case on OS X where the code makes the assumption in at least two locations that anything that isn't "Normal" is "Bold". In other places, including generic code, parsers apply overly course numberic weight classifications or fail to consider weights like "Medium", "Semibold", "Regular", "Roman" etc. (and return a fall-back weight: Normal).
Among the font families that are affected there are als common fonts like Segoe UI and Helvetica Neue (UI fonts on MS Windows and OS X 10.10+). NB: medium/semi-/demi-bold weights are perfect in UIs on high-resolution screens.

The proposed patch improves the code by adding additional checks against style names and weights. The changes are not only to Mac-specific files so Linux benefits from this too (and other platforms ought to, as well).

I'm putting it up for review on here mainly for lack of time to figure out why I failed to get in onto Qt's own code review site. It may appear there too, but if not:

I herewith put the attached code changes in the public domain, for possible inclusion into the Qt 4.x codebase under the license that governs that software.

Diffs (updated)

  src/gui/dialogs/qfontdialog.cpp d791462 
  src/gui/dialogs/ d557a7a 
  src/gui/kernel/qt_mac.cpp fb241ce 
  src/gui/text/qfontdatabase.cpp 4c2ace4 
  src/gui/text/qfontdatabase_mac.cpp 816a7bd 
  src/gui/text/ 204d685 
  src/plugins/platforms/fontdatabases/coretext/ 312015f 
  tools/qtconfig/mainwindow.cpp 1bb6e4e 



On OS X 10.9.5 and Kubuntu 14.04.2 against Qt 4.8.7 with the qtconfig utility and the attached test application

File Attachments

fontweight issue test application
fontweight issue test application
fontweight issue test application
fontweight issue test application
fontweight issue test application


René J.V. Bertin

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>
-------------- next part --------------
kde-mac at
List Information:
KDE/Mac Information:

More information about the kde-core-devel mailing list