src/gui/text/qfont.cpp
branchGCC_SURGE
changeset 31 5daf16870df6
parent 30 5dc02b23752f
child 33 3e2da88830cd
equal deleted inserted replaced
27:93b982ccede2 31:5daf16870df6
    71 #include <qfile.h>
    71 #include <qfile.h>
    72 #include "qfontengine_qpf_p.h"
    72 #include "qfontengine_qpf_p.h"
    73 #endif
    73 #endif
    74 #endif
    74 #endif
    75 #ifdef Q_OS_SYMBIAN
    75 #ifdef Q_OS_SYMBIAN
    76 #include "qt_s60_p.h"
    76 #include <private/qt_s60_p.h>
    77 #endif
    77 #endif
    78 
    78 
    79 #include <QMutexLocker>
    79 #include <QMutexLocker>
    80 
    80 
    81 // #define QFONTCACHE_DEBUG
    81 // #define QFONTCACHE_DEBUG
   803         weight = Normal;
   803         weight = Normal;
   804     } else {
   804     } else {
   805         resolve_mask |= QFont::WeightResolved | QFont::StyleResolved;
   805         resolve_mask |= QFont::WeightResolved | QFont::StyleResolved;
   806     }
   806     }
   807 
   807 
       
   808     if (italic)
       
   809         resolve_mask |= QFont::StyleResolved;
       
   810 
   808     d->request.family = family;
   811     d->request.family = family;
   809     d->request.pointSize = qreal(pointSize);
   812     d->request.pointSize = qreal(pointSize);
   810     d->request.pixelSize = -1;
   813     d->request.pixelSize = -1;
   811     d->request.weight = weight;
   814     d->request.weight = weight;
   812     d->request.style = italic ? QFont::StyleItalic : QFont::StyleNormal;
   815     d->request.style = italic ? QFont::StyleItalic : QFont::StyleNormal;
  1284     \value ForceOutline forces the use of outline fonts.
  1287     \value ForceOutline forces the use of outline fonts.
  1285     \value NoAntialias don't antialias the fonts.
  1288     \value NoAntialias don't antialias the fonts.
  1286     \value PreferAntialias antialias if possible.
  1289     \value PreferAntialias antialias if possible.
  1287     \value OpenGLCompatible forces the use of OpenGL compatible
  1290     \value OpenGLCompatible forces the use of OpenGL compatible
  1288            fonts.
  1291            fonts.
  1289     \value NoFontMerging If a font does not contain a character requested
  1292     \value NoFontMerging If the font selected for a certain writing system
  1290            to draw then Qt automatically chooses a similar looking for that contains
  1293            does not contain a character requested to draw, then Qt automatically chooses a similar
  1291            the character. This flag disables this feature.
  1294            looking font that contains the character. The NoFontMerging flag disables this feature.
       
  1295            Please note that enabling this flag will not prevent Qt from automatically picking a
       
  1296            suitable font when the selected font does not support the writing system of the text.
  1292 
  1297 
  1293     Any of these may be OR-ed with one of these flags:
  1298     Any of these may be OR-ed with one of these flags:
  1294 
  1299 
  1295     \value PreferMatch prefer an exact match. The font matcher will try to
  1300     \value PreferMatch prefer an exact match. The font matcher will try to
  1296            use the exact font size that has been specified.
  1301            use the exact font size that has been specified.
  1297     \value PreferQuality prefer the best quality font. The font matcher
  1302     \value PreferQuality prefer the best quality font. The font matcher
  1298            will use the nearest standard point size that the font
  1303            will use the nearest standard point size that the font
  1299            supports.
  1304            supports.
       
  1305     \value ForceIntegerMetrics forces the use of integer values in font engines that support fractional
       
  1306            font metrics.
  1300 */
  1307 */
  1301 
  1308 
  1302 /*!
  1309 /*!
  1303     Sets the style hint and strategy to \a hint and \a strategy,
  1310     Sets the style hint and strategy to \a hint and \a strategy,
  1304     respectively.
  1311     respectively.
  2610     QT_TRY {
  2617     QT_TRY {
  2611         cache = theFontCache();
  2618         cache = theFontCache();
  2612     } QT_CATCH (const std::bad_alloc &) {
  2619     } QT_CATCH (const std::bad_alloc &) {
  2613         // no cache - just ignore
  2620         // no cache - just ignore
  2614     }
  2621     }
  2615     if (cache && cache->hasLocalData()) {
  2622     if (cache && cache->hasLocalData())
  2616         cache->localData()->clear();
       
  2617         cache->setLocalData(0);
  2623         cache->setLocalData(0);
  2618         }
       
  2619 }
  2624 }
  2620 #endif // QT_NO_THREAD
  2625 #endif // QT_NO_THREAD
  2621 
  2626 
  2622 QFontCache::QFontCache()
  2627 QFontCache::QFontCache()
  2623     : QObject(), total_cost(0), max_cost(min_cost),
  2628     : QObject(), total_cost(0), max_cost(min_cost),
  2625 {
  2630 {
  2626 }
  2631 }
  2627 
  2632 
  2628 QFontCache::~QFontCache()
  2633 QFontCache::~QFontCache()
  2629 {
  2634 {
       
  2635     clear();
  2630     {
  2636     {
  2631         EngineDataCache::ConstIterator it = engineDataCache.constBegin(),
  2637         EngineDataCache::ConstIterator it = engineDataCache.constBegin(),
  2632                                  end = engineDataCache.constEnd();
  2638                                  end = engineDataCache.constEnd();
  2633         while (it != end) {
  2639         while (it != end) {
  2634             if (it.value()->ref == 0)
  2640             if (it.value()->ref == 0)