Font Problems in Qt3 on Windows

Last edited on

On MS-Windows and Qt 3, fonts are too big or too small in menus

This was a reported problem in Qt 3.3.6 and MSVC9. This is a Qt bug, and there is a patch:

--- qapplication_win.cpp.orig   2008-05-22 12:59:44.000000000 +0200
+++ qapplication_win.cpp        2008-05-22 13:00:15.000000000 +0200
@@ -548,7 +548,7 @@

     QT_WA( {
        NONCLIENTMETRICS ncm;
-       ncm.cbSize = sizeof( ncm );
+       ncm.cbSize = FIELD_OFFSET(NONCLIENTMETRICS, lfMessageFont) + sizeof(LOGFONTW);
        SystemParametersInfo( SPI_GETNONCLIENTMETRICS, sizeof(ncm), &ncm, 0 );
        menuFont = qt_LOGFONTtoQFont(ncm.lfMenuFont,TRUE);
        messageFont = qt_LOGFONTtoQFont(ncm.lfMessageFont,TRUE);
@@ -558,7 +558,7 @@
     } , {
        // A version
        NONCLIENTMETRICSA ncm;
-       ncm.cbSize = sizeof( ncm );
+        ncm.cbSize = FIELD_OFFSET(NONCLIENTMETRICSA, lfMessageFont) +
sizeof(LOGFONTA);
        SystemParametersInfoA( SPI_GETNONCLIENTMETRICS, sizeof(ncm), &ncm, 0);
        menuFont = qt_LOGFONTtoQFont((LOGFONT&)ncm.lfMenuFont,TRUE);
        messageFont = qt_LOGFONTtoQFont((LOGFONT&)ncm.lfMessageFont,TRUE);

Originally taken from the mail "Font problems with Qt 3.3 and MSVC9" sent to the qt-interest mailinglist.