Changeset 561 for trunk/src/gui/text/qfontdatabase.cpp
- Timestamp:
- Feb 11, 2010, 11:19:06 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
-
Property svn:mergeinfo
set to (toggle deleted branches)
/branches/vendor/nokia/qt/4.6.1 merged eligible /branches/vendor/nokia/qt/current merged eligible /branches/vendor/trolltech/qt/current 3-149
-
Property svn:mergeinfo
set to (toggle deleted branches)
-
trunk/src/gui/text/qfontdatabase.cpp
r500 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information (qt-info@nokia.com) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation (qt-info@nokia.com) 5 6 ** 6 7 ** This file is part of the QtGui module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you have questions regarding the use of this file, please contact 37 ** Nokia at qt-info@nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 58 58 #include <limits.h> 59 59 60 #if (defined(Q_WS_QWS) || defined(Q_OS_SYMBIAN)) && !defined(QT_NO_FREETYPE) 61 # include <ft2build.h> 62 # include FT_TRUETYPE_TABLES_H 63 #endif 64 60 65 // #define QFONTDATABASE_DEBUG 61 66 #ifdef QFONTDATABASE_DEBUG … … 80 85 QT_BEGIN_NAMESPACE 81 86 87 #define SMOOTH_SCALABLE 0xffff 88 82 89 extern int qt_defaultDpiY(); // in qfont.cpp 83 90 84 Q_GUI_EXPORT bool qt_enable_test_font = false; 91 bool qt_enable_test_font = false; 92 93 Q_AUTOTEST_EXPORT void qt_setQtEnableTestFont(bool value) 94 { 95 qt_enable_test_font = value; 96 } 85 97 86 98 static int getFontWeight(const QString &weightString) … … 91 103 if (s == QLatin1String("medium") || 92 104 s == QLatin1String("normal") 93 || s.compare( qApp->translate("QFontDatabase", "Normal"), Qt::CaseInsensitive) == 0)105 || s.compare(QApplication::translate("QFontDatabase", "Normal"), Qt::CaseInsensitive) == 0) 94 106 return QFont::Normal; 95 107 if (s == QLatin1String("bold") 96 || s.compare( qApp->translate("QFontDatabase", "Bold"), Qt::CaseInsensitive) == 0)108 || s.compare(QApplication::translate("QFontDatabase", "Bold"), Qt::CaseInsensitive) == 0) 97 109 return QFont::Bold; 98 110 if (s == QLatin1String("demibold") || s == QLatin1String("demi bold") 99 || s.compare( qApp->translate("QFontDatabase", "Demi Bold"), Qt::CaseInsensitive) == 0)111 || s.compare(QApplication::translate("QFontDatabase", "Demi Bold"), Qt::CaseInsensitive) == 0) 100 112 return QFont::DemiBold; 101 113 if (s == QLatin1String("black") 102 || s.compare( qApp->translate("QFontDatabase", "Black"), Qt::CaseInsensitive) == 0)114 || s.compare(QApplication::translate("QFontDatabase", "Black"), Qt::CaseInsensitive) == 0) 103 115 return QFont::Black; 104 116 if (s == QLatin1String("light")) … … 106 118 107 119 if (s.contains(QLatin1String("bold")) 108 || s.contains( qApp->translate("QFontDatabase", "Bold"), Qt::CaseInsensitive)) {120 || s.contains(QApplication::translate("QFontDatabase", "Bold"), Qt::CaseInsensitive)) { 109 121 if (s.contains(QLatin1String("demi")) 110 || s.compare( qApp->translate("QFontDatabase", "Demi"), Qt::CaseInsensitive) == 0)122 || s.compare(QApplication::translate("QFontDatabase", "Demi"), Qt::CaseInsensitive) == 0) 111 123 return (int) QFont::DemiBold; 112 124 return (int) QFont::Bold; … … 114 126 115 127 if (s.contains(QLatin1String("light")) 116 || s.compare( qApp->translate("QFontDatabase", "Light"), Qt::CaseInsensitive) == 0)128 || s.compare(QApplication::translate("QFontDatabase", "Light"), Qt::CaseInsensitive) == 0) 117 129 return (int) QFont::Light; 118 130 119 131 if (s.contains(QLatin1String("black")) 120 || s.compare( qApp->translate("QFontDatabase", "Black"), Qt::CaseInsensitive) == 0)132 || s.compare(QApplication::translate("QFontDatabase", "Black"), Qt::CaseInsensitive) == 0) 121 133 return (int) QFont::Black; 122 134 … … 148 160 QList<QFontDatabase::WritingSystem> systems; 149 161 #endif 150 #if defined(Q_WS_QWS) || defined(Q_ WS_PM)162 #if defined(Q_WS_QWS) || defined(Q_OS_SYMBIAN) || defined(Q_WS_PM) 151 163 QByteArray fileName; 152 164 int fileIndex; 153 #endif 165 #endif // defined(Q_WS_QWS) || defined(Q_OS_SYMBIAN) 154 166 }; 155 167 … … 167 179 if (!add) return 0; 168 180 169 if (!(count % 4)) 170 encodings = (QtFontEncoding *)181 if (!(count % 4)) { 182 QtFontEncoding *newEncodings = (QtFontEncoding *) 171 183 realloc(encodings, 172 184 (((count+4) >> 2) << 2) * sizeof(QtFontEncoding)); 185 Q_CHECK_PTR(newEncodings); 186 encodings = newEncodings; 187 } 173 188 encodings[count].encoding = id; 174 189 encodings[count].xpoint = xpoint; … … 222 237 delete [] setwidthName; 223 238 #endif 224 #if defined(Q_WS_X11) || defined(Q_WS_QWS) 225 while (count--) { 239 #if defined(Q_WS_X11) || defined(Q_WS_QWS) || defined(Q_OS_SYMBIAN) 240 while (count) { 241 // bitfield count-- in while condition does not work correctly in mwccsym2 242 count--; 226 243 #ifdef Q_WS_X11 227 244 free(pixelSizes[count].encodings); … … 230 247 pixelSizes[count].systems.~QList<QFontDatabase::WritingSystem>(); 231 248 #endif 232 #if defined(Q_WS_QWS) || defined(Q_ WS_PM)249 #if defined(Q_WS_QWS) || defined(Q_OS_SYMBIAN) || defined(Q_WS_PM) 233 250 pixelSizes[count].fileName.~QByteArray(); 234 251 #endif … … 248 265 const char *setwidthName; 249 266 #endif // Q_WS_X11 250 #if defined(Q_WS_QWS) || defined(Q_ WS_PM)267 #if defined(Q_WS_QWS) || defined(Q_OS_SYMBIAN) || defined(Q_WS_PM) 251 268 bool antialiased; 252 269 #endif … … 261 278 262 279 if (styleString.contains(QLatin1String("Italic")) 263 || styleString.contains( qApp->translate("QFontDatabase", "Italic")))280 || styleString.contains(QApplication::translate("QFontDatabase", "Italic"))) 264 281 style = QFont::StyleItalic; 265 282 else if (styleString.contains(QLatin1String("Oblique")) 266 || styleString.contains( qApp->translate("QFontDatabase", "Oblique")))283 || styleString.contains(QApplication::translate("QFontDatabase", "Oblique"))) 267 284 style = QFont::StyleOblique; 268 285 } … … 277 294 return 0; 278 295 279 if (!(count % 8)) 280 pixelSizes = (QtFontSize *)296 if (!(count % 8)) { 297 QtFontSize *newPixelSizes = (QtFontSize *) 281 298 realloc(pixelSizes, 282 299 (((count+8) >> 3) << 3) * sizeof(QtFontSize)); 300 Q_CHECK_PTR(newPixelSizes); 301 pixelSizes = newPixelSizes; 302 } 283 303 pixelSizes[count].pixelSize = size; 284 304 #ifdef Q_WS_X11 … … 289 309 new (&pixelSizes[count].systems) QList<QFontDatabase::WritingSystem>; 290 310 #endif 291 #if defined(Q_WS_QWS) || defined(Q_ WS_PM)311 #if defined(Q_WS_QWS) || defined(Q_OS_SYMBIAN) || defined(Q_WS_PM) 292 312 new (&pixelSizes[count].fileName) QByteArray; 293 313 pixelSizes[count].fileIndex = 0; … … 327 347 high = pos; 328 348 pos = (high + low) / 2; 329 } ;349 } 330 350 pos = low; 331 351 } … … 334 354 335 355 // qDebug("adding key (weight=%d, style=%d, oblique=%d stretch=%d) at %d", key.weight, key.style, key.oblique, key.stretch, pos); 336 if (!(count % 8)) 337 styles = (QtFontStyle **)356 if (!(count % 8)) { 357 QtFontStyle **newStyles = (QtFontStyle **) 338 358 realloc(styles, (((count+8) >> 3) << 3) * sizeof(QtFontStyle *)); 339 359 Q_CHECK_PTR(newStyles); 360 styles = newStyles; 361 } 362 363 QtFontStyle *style = new QtFontStyle(key); 340 364 memmove(styles + pos + 1, styles + pos, (count-pos)*sizeof(QtFontStyle *)); 341 styles[pos] = new QtFontStyle(key);365 styles[pos] = style; 342 366 count++; 343 367 return styles[pos]; … … 371 395 #endif 372 396 name(n), count(0), foundries(0) 373 #if defined(Q_WS_QWS) 397 #if defined(Q_WS_QWS) || defined(Q_OS_SYMBIAN) && !defined(QT_NO_FREETYPE) 374 398 , bogusWritingSystems(false) 375 399 #endif … … 401 425 402 426 QString name; 403 #if def Q_WS_X11427 #if defined(Q_WS_X11) || defined(Q_OS_SYMBIAN) && !defined(QT_NO_FREETYPE) 404 428 QByteArray fontFilename; 405 429 int fontFileIndex; … … 411 435 QtFontFoundry **foundries; 412 436 413 #if def Q_WS_QWS437 #if defined(Q_WS_QWS) || defined(Q_OS_SYMBIAN) && !defined(QT_NO_FREETYPE) 414 438 bool bogusWritingSystems; 415 439 QStringList fallbackFamilies; … … 444 468 return 0; 445 469 446 if (!(count % 8)) 447 foundries = (QtFontFoundry **)470 if (!(count % 8)) { 471 QtFontFoundry **newFoundries = (QtFontFoundry **) 448 472 realloc(foundries, 449 473 (((count+8) >> 3) << 3) * sizeof(QtFontFoundry *)); 474 Q_CHECK_PTR(newFoundries); 475 foundries = newFoundries; 476 } 450 477 451 478 foundries[count] = new QtFontFoundry(f); … … 455 482 // ### copied to tools/makeqpf/qpf2.cpp 456 483 457 #if ((defined(Q_WS_QWS) || defined(Q_WS_PM)) && !defined(QT_NO_FREETYPE)) || defined(Q_WS_WIN) || defined(Q_WS_MAC)484 #if ((defined(Q_WS_QWS) || defined(Q_WS_PM)) && !defined(QT_NO_FREETYPE)) || defined(Q_WS_WIN) || defined(Q_OS_SYMBIAN) || (defined(Q_WS_MAC) && !defined(QT_MAC_USE_COCOA)) 458 485 // see the Unicode subset bitfields in the MSDN docs 459 486 static int requiredUnicodeBits[QFontDatabase::WritingSystemsCount][2] = { … … 519 546 { 0, 127 }, // same as latin1 520 547 // Other, 521 { 126, 127 } 548 { 126, 127 }, 549 // Ogham, 550 { 78, 127 }, 551 // Runic, 552 { 79, 127 }, 553 // Nko, 554 { 14, 127 }, 522 555 }; 523 556 … … 576 609 #endif 577 610 611 #if defined(Q_OS_SYMBIAN) && defined(QT_NO_FREETYPE) 612 // class with virtual destructor, derived in qfontdatabase_s60.cpp 613 class QFontDatabaseS60Store 614 { 615 public: 616 virtual ~QFontDatabaseS60Store() {} 617 }; 618 #endif 619 578 620 class QFontDatabasePrivate 579 621 { … … 586 628 #if defined(Q_WS_PM) 587 629 , valid(false) 630 #endif 631 #if defined(Q_OS_SYMBIAN) && defined(QT_NO_FREETYPE) 632 , s60Store(0) 588 633 #endif 589 634 { } … … 598 643 families = 0; 599 644 count = 0; 645 #if defined(Q_OS_SYMBIAN) && defined(QT_NO_FREETYPE) 646 if (s60Store) { 647 delete s60Store; 648 s60Store = 0; 649 } 650 #endif 600 651 // don't clear the memory fonts! 601 652 } … … 625 676 #if defined(Q_WS_QWS) 626 677 bool loadFromCache(const QString &fontPath); 678 void addQPF2File(const QByteArray &file); 679 #endif // Q_WS_QWS 680 #if defined(Q_WS_QWS) || defined(Q_OS_SYMBIAN) && !defined(QT_NO_FREETYPE) 627 681 void addFont(const QString &familyname, const char *foundryname, int weight, 628 682 bool italic, int pixelSize, const QByteArray &file, int fileIndex, 629 683 bool antialiased, 630 684 const QList<QFontDatabase::WritingSystem> &writingSystems = QList<QFontDatabase::WritingSystem>()); 631 void addQPF2File(const QByteArray &file);632 685 #ifndef QT_NO_FREETYPE 633 686 QStringList addTTFile(const QByteArray &file, const QByteArray &fontData = QByteArray()); 634 #endif 635 687 #endif // QT_NO_FREETYPE 688 #endif 689 #if defined(Q_WS_QWS) 636 690 QDataStream *stream; 637 691 QStringList fallbackFamilies; 692 #elif defined(Q_OS_SYMBIAN) && defined(QT_NO_FREETYPE) 693 const QFontDatabaseS60Store *s60Store; 638 694 #endif 639 695 … … 666 722 low = pos; 667 723 pos = (high + low) / 2; 668 } ;724 } 669 725 if (!res) 670 726 return families[pos]; … … 677 733 678 734 // qDebug("adding family %s at %d total=%d", f.latin1(), pos, count); 679 if (!(count % 8)) 680 families = (QtFontFamily **)735 if (!(count % 8)) { 736 QtFontFamily **newFamilies = (QtFontFamily **) 681 737 realloc(families, 682 738 (((count+8) >> 3) << 3) * sizeof(QtFontFamily *)); 683 739 Q_CHECK_PTR(newFamilies); 740 families = newFamilies; 741 } 742 743 QtFontFamily *family = new QtFontFamily(f); 684 744 memmove(families + pos + 1, families + pos, (count-pos)*sizeof(QtFontFamily *)); 685 families[pos] = new QtFontFamily(f);745 families[pos] = family; 686 746 count++; 687 747 return families[pos]; 688 748 } 689 749 750 #if defined(Q_WS_QWS) || defined(Q_OS_SYMBIAN) && !defined(QT_NO_FREETYPE) 751 void QFontDatabasePrivate::addFont(const QString &familyname, const char *foundryname, int weight, bool italic, int pixelSize, 752 const QByteArray &file, int fileIndex, bool antialiased, 753 const QList<QFontDatabase::WritingSystem> &writingSystems) 754 { 755 // qDebug() << "Adding font" << familyname << weight << italic << pixelSize << file << fileIndex << antialiased; 756 QtFontStyle::Key styleKey; 757 styleKey.style = italic ? QFont::StyleItalic : QFont::StyleNormal; 758 styleKey.weight = weight; 759 styleKey.stretch = 100; 760 QtFontFamily *f = family(familyname, true); 761 762 if (writingSystems.isEmpty()) { 763 for (int ws = 1; ws < QFontDatabase::WritingSystemsCount; ++ws) { 764 f->writingSystems[ws] = QtFontFamily::Supported; 765 } 766 f->bogusWritingSystems = true; 767 } else { 768 for (int i = 0; i < writingSystems.count(); ++i) { 769 f->writingSystems[writingSystems.at(i)] = QtFontFamily::Supported; 770 } 771 } 772 773 QtFontFoundry *foundry = f->foundry(QString::fromLatin1(foundryname), true); 774 QtFontStyle *style = foundry->style(styleKey, true); 775 style->smoothScalable = (pixelSize == 0); 776 style->antialiased = antialiased; 777 QtFontSize *size = style->pixelSize(pixelSize?pixelSize:SMOOTH_SCALABLE, true); 778 size->fileName = file; 779 size->fileIndex = fileIndex; 780 781 #if defined(Q_WS_QWS) 782 if (stream) { 783 *stream << familyname << foundry->name << weight << quint8(italic) << pixelSize 784 << file << fileIndex << quint8(antialiased); 785 *stream << quint8(writingSystems.count()); 786 for (int i = 0; i < writingSystems.count(); ++i) 787 *stream << quint8(writingSystems.at(i)); 788 } 789 #else // ..in case of defined(Q_OS_SYMBIAN) && !defined(QT_NO_FREETYPE) 790 f->fontFilename = file; 791 f->fontFileIndex = fileIndex; 792 #endif 793 } 794 #endif 795 796 #if (defined(Q_WS_QWS) || defined(Q_OS_SYMBIAN)) && !defined(QT_NO_FREETYPE) 797 QStringList QFontDatabasePrivate::addTTFile(const QByteArray &file, const QByteArray &fontData) 798 { 799 QStringList families; 800 extern FT_Library qt_getFreetype(); 801 FT_Library library = qt_getFreetype(); 802 803 int index = 0; 804 int numFaces = 0; 805 do { 806 FT_Face face; 807 FT_Error error; 808 if (!fontData.isEmpty()) { 809 error = FT_New_Memory_Face(library, (const FT_Byte *)fontData.constData(), fontData.size(), index, &face); 810 } else { 811 error = FT_New_Face(library, file, index, &face); 812 } 813 if (error != FT_Err_Ok) { 814 qDebug() << "FT_New_Face failed with index" << index << ":" << hex << error; 815 break; 816 } 817 numFaces = face->num_faces; 818 819 int weight = QFont::Normal; 820 bool italic = face->style_flags & FT_STYLE_FLAG_ITALIC; 821 822 if (face->style_flags & FT_STYLE_FLAG_BOLD) 823 weight = QFont::Bold; 824 825 QList<QFontDatabase::WritingSystem> writingSystems; 826 // detect symbol fonts 827 for (int i = 0; i < face->num_charmaps; ++i) { 828 FT_CharMap cm = face->charmaps[i]; 829 if (cm->encoding == ft_encoding_adobe_custom 830 || cm->encoding == ft_encoding_symbol) { 831 writingSystems.append(QFontDatabase::Symbol); 832 break; 833 } 834 } 835 if (writingSystems.isEmpty()) { 836 TT_OS2 *os2 = (TT_OS2 *)FT_Get_Sfnt_Table(face, ft_sfnt_os2); 837 if (os2) { 838 quint32 unicodeRange[4] = { 839 os2->ulUnicodeRange1, os2->ulUnicodeRange2, os2->ulUnicodeRange3, os2->ulUnicodeRange4 840 }; 841 quint32 codePageRange[2] = { 842 os2->ulCodePageRange1, os2->ulCodePageRange2 843 }; 844 845 writingSystems = determineWritingSystemsFromTrueTypeBits(unicodeRange, codePageRange); 846 //for (int i = 0; i < writingSystems.count(); ++i) 847 // qDebug() << QFontDatabase::writingSystemName(writingSystems.at(i)); 848 } 849 } 850 851 QString family = QString::fromAscii(face->family_name); 852 families.append(family); 853 addFont(family, /*foundry*/ "", weight, italic, 854 /*pixelsize*/ 0, file, index, /*antialias*/ true, writingSystems); 855 856 FT_Done_Face(face); 857 ++index; 858 } while (index < numFaces); 859 return families; 860 } 861 #endif 690 862 691 863 static const int scriptForWritingSystem[] = { … … 730 902 QUnicodeTables::Common, // Symbol 731 903 QUnicodeTables::Ogham, // Ogham 732 QUnicodeTables::Runic // Runic 904 QUnicodeTables::Runic, // Runic 905 QUnicodeTables::Nko // Nko 733 906 }; 734 907 … … 738 911 { 739 912 return ((writingSystem >= QFontDatabase::Syriac && writingSystem <= QFontDatabase::Sinhala) 740 || writingSystem == QFontDatabase::Khmer );913 || writingSystem == QFontDatabase::Khmer || writingSystem == QFontDatabase::Nko); 741 914 } 742 915 static inline bool scriptRequiresOpenType(int script) 743 916 { 744 917 return ((script >= QUnicodeTables::Syriac && script <= QUnicodeTables::Sinhala) 745 || script == QUnicodeTables::Khmer );918 || script == QUnicodeTables::Khmer || script == QUnicodeTables::Nko); 746 919 } 747 920 #endif … … 806 979 static void match(int script, const QFontDef &request, 807 980 const QString &family_name, const QString &foundry_name, int force_encoding_id, 808 QtFontDesc *desc, const QList<int> &blacklistedFamilies = QList<int>() );981 QtFontDesc *desc, const QList<int> &blacklistedFamilies = QList<int>(), bool forceXLFD=false); 809 982 810 983 #if defined(Q_WS_X11) || defined(Q_WS_QWS) … … 815 988 fontDef->family += QString::fromLatin1(" ["); 816 989 fontDef->family += desc.foundry->name; 817 fontDef->family += Q String::fromLatin1("]");990 fontDef->family += QLatin1Char(']'); 818 991 } 819 992 … … 837 1010 #endif 838 1011 839 #if defined(Q_WS_X11) || defined(Q_WS_WIN) || defined(Q_ WS_PM)1012 #if defined(Q_WS_X11) || defined(Q_WS_WIN) || defined(Q_OS_SYMBIAN) || defined(Q_WS_PM) 840 1013 static void getEngineData(const QFontPrivate *d, const QFontCache::Key &key) 841 1014 { … … 850 1023 } 851 1024 } 1025 #endif 852 1026 853 1027 static QStringList familyList(const QFontDef &req) … … 878 1052 return family_list; 879 1053 } 880 #endif881 1054 882 1055 Q_GLOBAL_STATIC(QFontDatabasePrivate, privateDb) … … 900 1073 #elif defined(Q_WS_QWS) 901 1074 # include "qfontdatabase_qws.cpp" 1075 #elif defined(Q_OS_SYMBIAN) 1076 # include "qfontdatabase_s60.cpp" 902 1077 #endif 903 1078 QT_END_INCLUDE_NAMESPACE … … 1204 1379 static void match(int script, const QFontDef &request, 1205 1380 const QString &family_name, const QString &foundry_name, int force_encoding_id, 1206 QtFontDesc *desc, const QList<int> &blacklistedFamilies )1381 QtFontDesc *desc, const QList<int> &blacklistedFamilies, bool forceXLFD) 1207 1382 { 1208 1383 Q_UNUSED(force_encoding_id); … … 1219 1394 " weight: %d, style: %d\n" 1220 1395 " stretch: %d\n" 1221 " pixelSize: % d\n"1396 " pixelSize: %g\n" 1222 1397 " pitch: %c", 1223 1398 family_name.isEmpty() ? "-- first in script --" : family_name.toLatin1().constData(), … … 1239 1414 unsigned int score = ~0u; 1240 1415 1416 #ifdef Q_WS_X11 1417 load(family_name, script, forceXLFD); 1418 #else 1419 Q_UNUSED(forceXLFD); 1241 1420 load(family_name, script); 1421 #endif 1242 1422 1243 1423 QFontDatabasePrivate *db = privateDb(); … … 1303 1483 QString result; 1304 1484 if (weight >= QFont::Black) 1305 result = qApp->translate("QFontDatabase", "Black");1485 result = QApplication::translate("QFontDatabase", "Black"); 1306 1486 else if (weight >= QFont::Bold) 1307 result = qApp->translate("QFontDatabase", "Bold");1487 result = QApplication::translate("QFontDatabase", "Bold"); 1308 1488 else if (weight >= QFont::DemiBold) 1309 result = qApp->translate("QFontDatabase", "Demi Bold");1489 result = QApplication::translate("QFontDatabase", "Demi Bold"); 1310 1490 else if (weight < QFont::Normal) 1311 result = qApp->translate("QFontDatabase", "Light");1491 result = QApplication::translate("QFontDatabase", "Light"); 1312 1492 1313 1493 if (style == QFont::StyleItalic) 1314 result += QLatin1Char(' ') + qApp->translate("QFontDatabase", "Italic");1494 result += QLatin1Char(' ') + QApplication::translate("QFontDatabase", "Italic"); 1315 1495 else if (style == QFont::StyleOblique) 1316 result += QLatin1Char(' ') + qApp->translate("QFontDatabase", "Oblique");1496 result += QLatin1Char(' ') + QApplication::translate("QFontDatabase", "Oblique"); 1317 1497 1318 1498 if (result.isEmpty()) 1319 result = qApp->translate("QFontDatabase", "Normal");1499 result = QApplication::translate("QFontDatabase", "Normal"); 1320 1500 1321 1501 return result.simplified(); … … 1349 1529 \brief The QFontDatabase class provides information about the fonts available in the underlying window system. 1350 1530 1351 \ingroup environment 1352 \ingroup multimedia 1353 \ingroup text 1531 \ingroup appearance 1354 1532 1355 1533 The most common uses of this class are to query the database for … … 1360 1538 1361 1539 If the font family is available from two or more foundries the 1362 foundry name is included in the family name , e.g. "Helvetica1363 [Adobe]" and "Helvetica [Cronyx]". When you specify a family you1364 can either use the old hyphenated Qt 2.x "foundry-family" format,1365 e.g. "Cronyx-Helvetica", or the new bracketed Qt 3.x "family1366 [foundry]" format e.g."Helvetica [Cronyx]". If the family has a1367 foundry it is always returned , e.g. by families(), using the1368 bracketed format.1540 foundry name is included in the family name; for example: 1541 "Helvetica [Adobe]" and "Helvetica [Cronyx]". When you specify a 1542 family, you can either use the old hyphenated "foundry-family" 1543 format or the bracketed "family [foundry]" format; for example: 1544 "Cronyx-Helvetica" or "Helvetica [Cronyx]". If the family has a 1545 foundry it is always returned using the bracketed format, as is 1546 the case with the value returned by families(). 1369 1547 1370 1548 The font() function returns a QFont given a family, style and … … 1443 1621 \value Ogham 1444 1622 \value Runic 1623 \value Nko 1445 1624 1446 1625 \omitvalue WritingSystemsCount … … 1549 1728 str += QLatin1String(" ["); 1550 1729 str += foundry; 1551 str += QLatin1 String("]");1730 str += QLatin1Char(']'); 1552 1731 } 1553 1732 flist.append(str); … … 2117 2296 name = QT_TRANSLATE_NOOP("QFontDatabase", "Runic"); 2118 2297 break; 2298 case Nko: 2299 name = QT_TRANSLATE_NOOP("QFontDatabase", "N'Ko"); 2300 break; 2119 2301 default: 2120 2302 Q_ASSERT_X(false, "QFontDatabase::writingSystemName", "invalid 'writingSystem' parameter"); 2121 2303 break; 2122 2304 } 2123 return qApp ? qApp->translate("QFontDatabase", name) : QString::fromLatin1(name);2305 return QApplication::translate("QFontDatabase", name); 2124 2306 } 2125 2307 … … 2308 2490 break; 2309 2491 case Vietnamese: 2310 break; 2492 { 2493 static const char vietnameseUtf8[] = { 2494 char(0xef), char(0xbb), char(0xbf), char(0xe1), char(0xbb), char(0x97), 2495 char(0xe1), char(0xbb), char(0x99), 2496 char(0xe1), char(0xbb), char(0x91), 2497 char(0xe1), char(0xbb), char(0x93), 2498 }; 2499 sample += QString::fromUtf8(vietnameseUtf8, sizeof(vietnameseUtf8)); 2500 break; 2501 } 2311 2502 case Ogham: 2312 2503 sample += QChar(0x1681); … … 2320 2511 sample += QChar(0x16a2); 2321 2512 sample += QChar(0x16a3); 2513 break; 2514 case Nko: 2515 sample += QChar(0x7ca); 2516 sample += QChar(0x7cb); 2517 sample += QChar(0x7cc); 2518 sample += QChar(0x7cd); 2322 2519 break; 2323 2520 default: … … 2481 2678 will not produce readable output. 2482 2679 2483 \sa threads.html#painting-in-threads2680 \sa {Thread-Support in Qt Modules#Painting In Threads}{Painting In Threads} 2484 2681 */ 2485 2682
Note:
See TracChangeset
for help on using the changeset viewer.