src/gui/text/qfont.cpp
changeset 7 f7bc934e204c
parent 3 41300fa6a67c
child 22 79de32ba3296
equal deleted inserted replaced
3:41300fa6a67c 7:f7bc934e204c
     1 /****************************************************************************
     1 /****************************************************************************
     2 **
     2 **
     3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
     3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     4 ** All rights reserved.
     4 ** All rights reserved.
     5 ** Contact: Nokia Corporation (qt-info@nokia.com)
     5 ** Contact: Nokia Corporation (qt-info@nokia.com)
     6 **
     6 **
     7 ** This file is part of the QtGui module of the Qt Toolkit.
     7 ** This file is part of the QtGui module of the Qt Toolkit.
     8 **
     8 **
   627 /*!
   627 /*!
   628     \fn QString QFont::rawName() const
   628     \fn QString QFont::rawName() const
   629 
   629 
   630     Returns the name of the font within the underlying window system.
   630     Returns the name of the font within the underlying window system.
   631 
   631 
   632     Only on X11 when Qt was built without FontConfig support the XLFD (X Logical Font Description)
   632     On X11, this function will return an empty string if Qt is built with
   633     is returned; otherwise an empty string.
   633     FontConfig support; otherwise the XLFD (X Logical Font Description) is
       
   634     returned.
   634 
   635 
   635     Using the return value of this function is usually \e not \e
   636     Using the return value of this function is usually \e not \e
   636     portable.
   637     portable.
   637 
   638 
   638     \sa setRawName()
   639     \sa setRawName()
  1612                 && f.d->request.pointSize == d->request.pointSize
  1613                 && f.d->request.pointSize == d->request.pointSize
  1613                 && f.d->underline == d->underline
  1614                 && f.d->underline == d->underline
  1614                 && f.d->overline  == d->overline
  1615                 && f.d->overline  == d->overline
  1615                 && f.d->strikeOut == d->strikeOut
  1616                 && f.d->strikeOut == d->strikeOut
  1616                 && f.d->kerning == d->kerning
  1617                 && f.d->kerning == d->kerning
  1617                 && f.d->capital == d->capital));
  1618                 && f.d->capital == d->capital
       
  1619                 && f.d->letterSpacingIsAbsolute == d->letterSpacingIsAbsolute
       
  1620                 && f.d->letterSpacing == d->letterSpacing
       
  1621                 && f.d->wordSpacing == d->wordSpacing
       
  1622             ));
  1618 }
  1623 }
  1619 
  1624 
  1620 
  1625 
  1621 /*!
  1626 /*!
  1622     Provides an arbitrary comparison of this font and font \a f.
  1627     Provides an arbitrary comparison of this font and font \a f.
  1646 #ifdef Q_WS_X11
  1651 #ifdef Q_WS_X11
  1647     if (r1.addStyle != r2.addStyle) return r1.addStyle < r2.addStyle;
  1652     if (r1.addStyle != r2.addStyle) return r1.addStyle < r2.addStyle;
  1648 #endif // Q_WS_X11
  1653 #endif // Q_WS_X11
  1649     if (f.d->capital != d->capital) return f.d->capital < d->capital;
  1654     if (f.d->capital != d->capital) return f.d->capital < d->capital;
  1650 
  1655 
       
  1656     if (f.d->letterSpacingIsAbsolute != d->letterSpacingIsAbsolute) return f.d->letterSpacingIsAbsolute < d->letterSpacingIsAbsolute;
       
  1657     if (f.d->letterSpacing != d->letterSpacing) return f.d->letterSpacing < d->letterSpacing;
       
  1658     if (f.d->wordSpacing != d->wordSpacing) return f.d->wordSpacing < d->wordSpacing;
       
  1659 
  1651     int f1attrs = (f.d->underline << 3) + (f.d->overline << 2) + (f.d->strikeOut<<1) + f.d->kerning;
  1660     int f1attrs = (f.d->underline << 3) + (f.d->overline << 2) + (f.d->strikeOut<<1) + f.d->kerning;
  1652     int f2attrs = (d->underline << 3) + (d->overline << 2) + (d->strikeOut<<1) + d->kerning;
  1661     int f2attrs = (d->underline << 3) + (d->overline << 2) + (d->strikeOut<<1) + d->kerning;
  1653     return f1attrs < f2attrs;
  1662     return f1attrs < f2attrs;
  1654 }
  1663 }
  1655 
  1664 
  1778 
  1787 
  1779 // create substitution dict
  1788 // create substitution dict
  1780 static void initFontSubst()
  1789 static void initFontSubst()
  1781 {
  1790 {
  1782     // default substitutions
  1791     // default substitutions
  1783     static const char *initTbl[] = {
  1792     static const char * const initTbl[] = {
  1784 
  1793 
  1785 #if defined(Q_WS_X11)
  1794 #if defined(Q_WS_X11)
  1786         "arial",        "helvetica",
  1795         "arial",        "helvetica",
  1787         "times new roman", "times",
  1796         "times new roman", "times",
  1788         "courier new",  "courier",
  1797         "courier new",  "courier",
  1809     for (int i=0; initTbl[i] != 0; i += 2) {
  1818     for (int i=0; initTbl[i] != 0; i += 2) {
  1810         QStringList &list = (*fontSubst)[QString::fromLatin1(initTbl[i])];
  1819         QStringList &list = (*fontSubst)[QString::fromLatin1(initTbl[i])];
  1811         list.append(QString::fromLatin1(initTbl[i+1]));
  1820         list.append(QString::fromLatin1(initTbl[i+1]));
  1812     }
  1821     }
  1813 }
  1822 }
  1814 
       
  1815 
  1823 
  1816 /*!
  1824 /*!
  1817     Returns the first family name to be used whenever \a familyName is
  1825     Returns the first family name to be used whenever \a familyName is
  1818     specified. The lookup is case insensitive.
  1826     specified. The lookup is case insensitive.
  1819 
  1827