Changeset 228 for trunk/src


Ignore:
Timestamp:
Oct 15, 2009, 2:04:41 AM (16 years ago)
Author:
Dmitry A. Kuminov
Message:

gui: Enabled full font hinting and using bitmap stripes by default.

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

Legend:

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

    r227 r228  
    5050#include FT_TYPES_H
    5151#include FT_TRUETYPE_TABLES_H
     52#include FT_LCD_FILTER_H
    5253
    5354QT_BEGIN_NAMESPACE
     
    195196            family->fixedPitch = face->face_flags & FT_FACE_FLAG_FIXED_WIDTH;
    196197
    197             if (systems.isEmpty() || familyName == "Workplace Sans") {
     198            if (systems.isEmpty() || familyName.compare("Workplace Sans")) {
    198199                // it was hard or impossible to determine the actual writing system
    199200                // of the font (as in case of OS/2 bitmap and PFB fonts for which it is
     
    347348static QFontEngine *loadEngine(const QFontDef &req, const QtFontDesc &desc)
    348349{
    349     QFontEngineFT *fe = new QFontEnginePMFT(fontDescToFontDef(req, desc));
     350    // @todo all these fixed so far; make configurable through the Registry
     351    // on per-family basis
     352    QFontEnginePMFT::HintStyle hintStyle = QFontEnginePMFT::HintFull;
     353    bool autoHint = true;
     354    QFontEngineFT::SubpixelAntialiasingType subPixel = QFontEngineFT::Subpixel_None;
     355    int lcdFilter = FT_LCD_FILTER_DEFAULT;
     356    bool useEmbeddedBitmap = true;
     357
     358    QFontEngine::FaceId faceId;
     359    faceId.filename = desc.size->fileName;
     360    faceId.index = desc.size->fileIndex;
     361
     362    QFontEngineFT *fe = new QFontEnginePMFT(fontDescToFontDef(req, desc), faceId,
     363                                            desc.style->antialiased, hintStyle,
     364                                            autoHint, subPixel, lcdFilter,
     365                                            useEmbeddedBitmap);
    350366    Q_ASSERT(fe);
    351     if (fe) {
    352         QFontEngine::FaceId faceId;
    353         faceId.filename = desc.size->fileName;
    354         faceId.index = desc.size->fileIndex;
    355         fe->init(faceId, desc.style->antialiased);
    356         if (fe->invalid()) {
    357             FM_DEBUG("   --> invalid!\n");
    358             delete fe;
    359             fe = 0;
    360         }
     367    if (fe && fe->invalid()) {
     368        FM_DEBUG("   --> invalid!\n");
     369        delete fe;
     370        fe = 0;
    361371    }
    362372    return fe;
  • trunk/src/gui/text/qfontengine_pm.cpp

    r222 r228  
    5555// ------------------------------------------------------------------
    5656
    57 QFontEnginePMFT::QFontEnginePMFT(const QFontDef &fd)
     57QFontEnginePMFT::QFontEnginePMFT(const QFontDef &fd, const FaceId &faceId,
     58                                 bool antialias, HintStyle hintStyle,
     59                                 bool autoHint, SubpixelAntialiasingType subPixel,
     60                                 int lcdFilter, bool useEmbeddedBitmap)
    5861    : QFontEngineFT(fd)
    5962{
     63    subpixelType = subPixel;
     64
     65    default_hint_style = (QFontEngineFT::HintStyle)hintStyle;
     66
     67#if defined(FT_LOAD_FORCE_AUTOHINT)
     68    if (autoHint)
     69        default_load_flags |= FT_LOAD_FORCE_AUTOHINT;
     70#endif
     71
     72    lcdFilterType = lcdFilter;
     73    embeddedbitmap = useEmbeddedBitmap;
     74
     75    GlyphFormat defaultFormat = Format_None;
     76    if (subpixelType != QFontEngineFT::Subpixel_None)
     77        defaultFormat = Format_A32;
     78    else if (antialias)
     79        defaultFormat = Format_A8;
     80    else
     81        defaultFormat = Format_Mono;
     82
     83    init(faceId, antialias, defaultFormat);
    6084}
    6185
  • trunk/src/gui/text/qfontengine_pm_p.h

    r222 r228  
    7171{
    7272public:
    73     explicit QFontEnginePMFT(const QFontDef &fd);
     73    enum HintStyle {
     74        HintNone = QFontEngineFT::HintNone,
     75        HintLight = QFontEngineFT::HintLight,
     76        HintMedium = QFontEngineFT::HintMedium,
     77        HintFull = QFontEngineFT::HintFull
     78    };
     79
     80    explicit QFontEnginePMFT(const QFontDef &fd, const FaceId &faceId,
     81                             bool antialias, HintStyle hintStyle,
     82                             bool autoHint, SubpixelAntialiasingType subPixel,
     83                             int lcdFilter, bool useEmbeddedBitmap);
    7484    ~QFontEnginePMFT();
    7585};
Note: See TracChangeset for help on using the changeset viewer.