Ignore:
Timestamp:
Dec 2, 2009, 2:27:41 AM (16 years ago)
Author:
Dmitry A. Kuminov
Message:

gui: Improved font handling (patch by komh):

  • Read national face names from font files instead of always taking the Latin name.
  • Use the PM_AssociateFont registry key to select a fallback font for missing glyphs (important on DBCS systems).
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/gui/text/qfont_pm.cpp

    r226 r371  
    4242****************************************************************************/
    4343
     44#include "qt_os2.h"
    4445#include "qfont.h"
    4546#include "qfont_p.h"
     
    6970        break;
    7071    case QFont::AnyStyle:
    71         if (request.fixedPitch)
     72    default:
     73        static char szFontName[FACESIZE + 1] = {0,};
     74
     75        // already queried ?
     76        if (szFontName[0] != ';') {
     77            szFontName[0] = ';';
     78            // query the associated font
     79            if (PrfQueryProfileString(HINI_USERPROFILE,
     80                                      "PM_SystemFonts", "PM_AssociateFont", 0,
     81                                      szFontName, sizeof(szFontName))) {
     82                szFontName[FACESIZE] = '\0';
     83
     84                // the format of the associated font is face_name;point_size
     85                // so remove ';' and later
     86                for (PSZ pch = szFontName; *pch; pch++)
     87                    if (*pch == ';') {
     88                        *pch = '\0';
     89                        break;
     90                    }
     91            }
     92        }
     93
     94        // is the associated font available ?
     95        if (szFontName[0] != '\0' && szFontName[0] != ';')
     96            family = szFontName;
     97        else if (request.fixedPitch)
    7298            family = "Courier";
    7399        else
     
    103129QString QFont::defaultFamily() const
    104130{
    105     return QLatin1String(qt_fontFamilyFromStyleHint(d->request));
     131    return QString::fromLocal8Bit(qt_fontFamilyFromStyleHint(d->request));
    106132}
    107133
Note: See TracChangeset for help on using the changeset viewer.