Changeset 226


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.

Location:
trunk/src/gui/text
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/gui/text/qfont_p.h

    r2 r226  
    274274};
    275275
     276
     277
     278
     279
    276280QT_END_NAMESPACE
    277281
  • trunk/src/gui/text/qfont_pm.cpp

    r95 r226  
    5151QT_BEGIN_NAMESPACE
    5252
     53
     54
     55
     56
     57
     58
     59
     60
     61
     62
     63
     64
     65
     66
     67
     68
     69
     70
     71
     72
     73
     74
     75
     76
     77
     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("elvetica");
    96111}
    97112
    98113QString QFont::lastResortFont() const
    99114{
    100     return QString::fromLatin1("arial");
     115    return QString::fromLatin1("");
    101116}
    102117
  • trunk/src/gui/text/qfontdatabase_pm.cpp

    r223 r226  
    302302}
    303303
    304 static const char *styleHint(const QFontDef &request)
    305 {
    306     const char *stylehint = 0;
    307     switch (request.styleHint) {
    308     case QFont::SansSerif:
    309         stylehint = "Helvetica";
    310         break;
    311     case QFont::Serif:
    312         stylehint = "Roman";
    313         break;
    314     case QFont::TypeWriter:
    315         stylehint = "Courier";
    316         break;
    317     default:
    318         if (request.fixedPitch)
    319             stylehint = "Courier";
    320         else
    321             stylehint = "Helvetica";
    322         break;
    323     }
    324     return stylehint;
    325 }
    326 
    327304static QFontDef fontDescToFontDef(const QFontDef &req, const QtFontDesc &desc)
    328305{
     
    387364    QStringList families = familyList(req);
    388365
    389     const char *stylehint = styleHint(d->request);
    390     if (stylehint)
    391         families << QLatin1String(stylehint);
     366    const char *styletyleHint(d->request);
     367    if (styleint)
     368        families << QLatin1String(styleint);
    392369
    393370    // add the default family
Note: See TracChangeset for help on using the changeset viewer.