Ignore:
Timestamp:
Oct 14, 2009, 11:07:33 PM (16 years ago)
Author:
Dmitry A. Kuminov
Message:

gui: Use single source for mapping font style hints to default family names.

File:
1 edited

Legend:

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

    r95 r226  
    5151QT_BEGIN_NAMESPACE
    5252
     53Q_GUI_EXPORT const char *qt_fontFamilyFromStyleHint(const QFontDef &request)
     54{
     55    const char *family = 0;
     56    switch (request.styleHint) {
     57    case QFont::Helvetica:
     58        family = "Helvetica";
     59        break;
     60    case QFont::Times:
     61    case QFont::OldEnglish:
     62        family = "Times New Roman";
     63        break;
     64    case QFont::Courier:
     65        family = "Courier";
     66        break;
     67    case QFont::System:
     68        family = "WarpSans";
     69        break;
     70    case QFont::AnyStyle:
     71        if (request.fixedPitch)
     72            family = "Courier";
     73        else
     74            family = "Helvetica";
     75        break;
     76    }
     77    return family;
     78}
     79
    5380/*****************************************************************************
    5481  QFont member functions
     
    76103QString QFont::defaultFamily() const
    77104{
    78     switch(d->request.styleHint) {
    79         case QFont::Times:
    80             return QString::fromLatin1("Times New Roman");
    81         case QFont::Courier:
    82             return QString::fromLatin1("Courier New");
    83         case QFont::Decorative:
    84             return QString::fromLatin1("Bookman Old Style");
    85         case QFont::Helvetica:
    86             return QString::fromLatin1("Arial");
    87         case QFont::System:
    88         default:
    89             return QString::fromLatin1("MS Sans Serif");
    90     }
     105    return QLatin1String(qt_fontFamilyFromStyleHint(d->request));
    91106}
    92107
    93108QString QFont::lastResortFamily() const
    94109{
    95     return QString::fromLatin1("helvetica");
     110    return QString::fromLatin1("Helvetica");
    96111}
    97112
    98113QString QFont::lastResortFont() const
    99114{
    100     return QString::fromLatin1("arial");
     115    return QString::fromLatin1("Helvetica");
    101116}
    102117
Note: See TracChangeset for help on using the changeset viewer.