src/gui/text/qfont.cpp
changeset 3 41300fa6a67c
parent 0 1918ee327afb
child 4 3b1da2848fc7
equal deleted inserted replaced
2:56cd8111b7f7 3:41300fa6a67c
  1611             || (f.d->request   == d->request
  1611             || (f.d->request   == d->request
  1612                 && f.d->request.pointSize == d->request.pointSize
  1612                 && f.d->request.pointSize == d->request.pointSize
  1613                 && f.d->underline == d->underline
  1613                 && f.d->underline == d->underline
  1614                 && f.d->overline  == d->overline
  1614                 && f.d->overline  == d->overline
  1615                 && f.d->strikeOut == d->strikeOut
  1615                 && f.d->strikeOut == d->strikeOut
  1616                 && f.d->kerning == d->kerning));
  1616                 && f.d->kerning == d->kerning
       
  1617                 && f.d->capital == d->capital));
  1617 }
  1618 }
  1618 
  1619 
  1619 
  1620 
  1620 /*!
  1621 /*!
  1621     Provides an arbitrary comparison of this font and font \a f.
  1622     Provides an arbitrary comparison of this font and font \a f.
  1643     if (r1.styleStrategy != r2.styleStrategy) return r1.styleStrategy < r2.styleStrategy;
  1644     if (r1.styleStrategy != r2.styleStrategy) return r1.styleStrategy < r2.styleStrategy;
  1644     if (r1.family != r2.family) return r1.family < r2.family;
  1645     if (r1.family != r2.family) return r1.family < r2.family;
  1645 #ifdef Q_WS_X11
  1646 #ifdef Q_WS_X11
  1646     if (r1.addStyle != r2.addStyle) return r1.addStyle < r2.addStyle;
  1647     if (r1.addStyle != r2.addStyle) return r1.addStyle < r2.addStyle;
  1647 #endif // Q_WS_X11
  1648 #endif // Q_WS_X11
       
  1649     if (f.d->capital != d->capital) return f.d->capital < d->capital;
  1648 
  1650 
  1649     int f1attrs = (f.d->underline << 3) + (f.d->overline << 2) + (f.d->strikeOut<<1) + f.d->kerning;
  1651     int f1attrs = (f.d->underline << 3) + (f.d->overline << 2) + (f.d->strikeOut<<1) + f.d->kerning;
  1650     int f2attrs = (d->underline << 3) + (d->overline << 2) + (d->strikeOut<<1) + d->kerning;
  1652     int f2attrs = (d->underline << 3) + (d->overline << 2) + (d->strikeOut<<1) + d->kerning;
  1651     return f1attrs < f2attrs;
  1653     return f1attrs < f2attrs;
  1652 }
  1654 }
  2322     This will give correct results also when painting on paint device
  2324     This will give correct results also when painting on paint device
  2323     that is not screen-compatible.
  2325     that is not screen-compatible.
  2324 */
  2326 */
  2325 QFontInfo::QFontInfo(const QFont &font)
  2327 QFontInfo::QFontInfo(const QFont &font)
  2326     : d(font.d.data())
  2328     : d(font.d.data())
  2327 { d->ref.ref(); }
  2329 {
       
  2330 }
  2328 
  2331 
  2329 /*!
  2332 /*!
  2330     Constructs a copy of \a fi.
  2333     Constructs a copy of \a fi.
  2331 */
  2334 */
  2332 QFontInfo::QFontInfo(const QFontInfo &fi)
  2335 QFontInfo::QFontInfo(const QFontInfo &fi)
  2333     : d(fi.d)
  2336     : d(fi.d.data())
  2334 { d->ref.ref(); }
  2337 {
       
  2338 }
  2335 
  2339 
  2336 /*!
  2340 /*!
  2337     Destroys the font info object.
  2341     Destroys the font info object.
  2338 */
  2342 */
  2339 QFontInfo::~QFontInfo()
  2343 QFontInfo::~QFontInfo()
  2340 {
  2344 {
  2341     if (!d->ref.deref())
       
  2342         delete d;
       
  2343 }
  2345 }
  2344 
  2346 
  2345 /*!
  2347 /*!
  2346     Assigns the font info in \a fi.
  2348     Assigns the font info in \a fi.
  2347 */
  2349 */
  2348 QFontInfo &QFontInfo::operator=(const QFontInfo &fi)
  2350 QFontInfo &QFontInfo::operator=(const QFontInfo &fi)
  2349 {
  2351 {
  2350     qAtomicAssign(d, fi.d);
  2352     d = fi.d.data();
  2351     return *this;
  2353     return *this;
  2352 }
  2354 }
  2353 
  2355 
  2354 /*!
  2356 /*!
  2355     Returns the family name of the matched window system font.
  2357     Returns the family name of the matched window system font.
  2630     EngineCache::ConstIterator it = engineCache.constBegin(),
  2632     EngineCache::ConstIterator it = engineCache.constBegin(),
  2631                          end = engineCache.constEnd();
  2633                          end = engineCache.constEnd();
  2632     while (it != end) {
  2634     while (it != end) {
  2633         if (--it.value().data->cache_count == 0) {
  2635         if (--it.value().data->cache_count == 0) {
  2634             if (it.value().data->ref == 0) {
  2636             if (it.value().data->ref == 0) {
  2635                 FC_DEBUG("QFontCache::~QFontCache: deleting engine %p key=(%d / %g %d %d %d %d)",
  2637                 FC_DEBUG("QFontCache::~QFontCache: deleting engine %p key=(%d / %g %g %d %d %d)",
  2636                          it.value().data, it.key().script, it.key().def.pointSize,
  2638                          it.value().data, it.key().script, it.key().def.pointSize,
  2637                          it.key().def.pixelSize, it.key().def.weight, it.key().def.style,
  2639                          it.key().def.pixelSize, it.key().def.weight, it.key().def.style,
  2638                          it.key().def.fixedPitch);
  2640                          it.key().def.fixedPitch);
  2639 
  2641 
  2640                 delete it.value().data;
  2642                 delete it.value().data;