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

René J.V. Bertin rjvbertin at gmail.com
Tue Apr 21 23:01:38 BST 2015


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/123458/
-----------------------------------------------------------

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


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


Repository: qt


Description
-------

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/qfontdialog_mac.mm d557a7a 
  src/gui/kernel/qt_mac.cpp fb241ce 
  src/gui/text/qfontdatabase.cpp 4c2ace4 
  src/gui/text/qfontdatabase_mac.cpp 816a7bd 
  src/gui/text/qfontengine_coretext.mm 204d685 
  src/plugins/platforms/fontdatabases/coretext/qcoretextfontdatabase.mm 312015f 
  tools/qtconfig/mainwindow.cpp 1bb6e4e 

Diff: https://git.reviewboard.kde.org/r/123458/diff/


Testing
-------

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
  https://git.reviewboard.kde.org/media/uploaded/files/2015/04/21/bbebc0af-e457-4fdf-965c-3918d8e871d0__fontweightissue.pro
fontweight issue test application
  https://git.reviewboard.kde.org/media/uploaded/files/2015/04/21/cfdcbf23-406a-4abf-b0cb-5fdc1957dfe9__main.cpp
fontweight issue test application
  https://git.reviewboard.kde.org/media/uploaded/files/2015/04/21/9898afae-82ca-4c92-b7d9-5607d0dd8e24__dialog.h
fontweight issue test application
  https://git.reviewboard.kde.org/media/uploaded/files/2015/04/21/8ad258bf-7f82-4db4-a344-ce81d75e8c50__dialog.cpp
fontweight issue test application
  https://git.reviewboard.kde.org/media/uploaded/files/2015/04/21/2f0a7c6e-4601-406e-b703-603a36bff62b__fontweightissue.desktop


Thanks,

René J.V. Bertin

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20150421/29c21a00/attachment.htm>


More information about the kde-core-devel mailing list