50 #include "private/qunicodetables_p.h" 54 #include <QtGui/private/qapplication_p.h> 55 #include <QtGui/qplatformfontdatabase_qpa.h> 65 #if (defined(Q_WS_QWS)|| defined(Q_OS_SYMBIAN)) && !defined(QT_NO_FREETYPE) 66 # include <ft2build.h> 67 # include FT_TRUETYPE_TABLES_H 71 #ifdef QFONTDATABASE_DEBUG 72 # define FD_DEBUG qDebug 74 # define FD_DEBUG if (false) qDebug 78 #ifdef FONT_MATCH_DEBUG 79 # define FM_DEBUG qDebug 81 # define FM_DEBUG if (false) qDebug 84 #if defined(Q_WS_WIN) && !defined(QT_NO_DIRECTWRITE) 90 #define SMOOTH_SCALABLE 0xffff 146 else if (weight < 600)
148 else if (weight < 700)
150 else if (weight < 800)
176 #if defined(Q_WS_QWS) || defined(Q_OS_SYMBIAN) 179 #endif // defined(Q_WS_QWS) || defined(Q_WS_QPA) || defined(Q_OS_SYMBIAN) 180 #if defined(Q_WS_QPA) 193 for (
int i = 0; i < count; ++i) {
195 return encodings + i;
205 encodings = newEncodings;
208 encodings[count].xpoint =
xpoint;
209 encodings[count].xres =
xres;
210 encodings[count].yres =
yres;
211 encodings[count].avgwidth =
avgwidth;
212 encodings[count].pitch =
'*';
213 return encodings + count++;
222 weight(
QFont::Normal), stretch(0) { }
223 Key(
const Key &o) : style(o.style), weight(o.weight), stretch(o.stretch) { }
229 return (style == other.
style && weight == other.
weight &&
230 (stretch == 0 || other.
stretch == 0 || stretch == other.
stretch));
236 int x = (style << 12) + (weight << 14) + stretch;
243 :
key(k), bitmapScalable(false), smoothScalable(false),
244 count(0), pixelSizes(0)
246 #if defined(Q_WS_X11) 247 weightName = setwidthName = 0;
253 delete [] weightName;
254 delete [] setwidthName;
256 #if defined(Q_WS_X11) || defined(Q_WS_QWS) || defined(Q_WS_QPA) || defined(Q_OS_SYMBIAN) 261 free(pixelSizes[count].encodings);
263 #if defined(Q_WS_QWS) || defined(Q_OS_SYMBIAN) 264 pixelSizes[count].fileName.~QByteArray();
266 #if defined (Q_WS_QPA) 288 #if defined(Q_WS_QWS) || defined(Q_WS_QPA) || defined(Q_OS_SYMBIAN) 296 : style(
QFont::StyleNormal), weight(
QFont::Normal), stretch(0)
310 for (
int i = 0; i <
count; i++) {
322 }
else if (!(count % 8) || count == 1) {
325 (((count+8) >> 3) << 3) *
sizeof(
QtFontSize));
334 #if defined(Q_WS_QWS) || defined(Q_OS_SYMBIAN) 338 #if defined(Q_WS_QPA) 349 delete styles[
count];
363 for (; pos <
count; pos++) {
364 bool hasStyleName = !styleName.
isEmpty();
365 if (hasStyleName && !styles[pos]->styleName.
isEmpty()) {
366 if (styles[pos]->styleName == styleName)
369 if (styles[pos]->key == key)
379 realloc(styles, (((count+8) >> 3) << 3) *
sizeof(
QtFontStyle *));
398 Unsupported = UnsupportedFT | UnsupportedXLFD
404 fixedPitch(true), ftWritingSystemCheck(false),
405 xlfdLoaded(false), synthetic(false), symbol_checked(false),
410 writingSystemCheck(false),
414 fixedPitchComputed(false),
416 name(n), count(0), foundries(0)
417 #
if defined(Q_WS_QWS) || defined(Q_WS_QPA) || defined(Q_OS_SYMBIAN) && !defined(
QT_NO_FREETYPE)
418 , bogusWritingSystems(false)
420 #
if defined(Q_WS_QPA)
421 , askedForFallback(false)
424 memset(writingSystems, 0,
sizeof(writingSystems));
428 delete foundries[
count];
442 #if !defined(QWS) && defined(Q_OS_MAC) 450 #if defined(Q_WS_X11) || defined(Q_OS_SYMBIAN) && !defined(QT_NO_FREETYPE) 460 #if defined(Q_WS_QWS) || defined(Q_WS_QPA) || defined(Q_OS_SYMBIAN) && !defined(QT_NO_FREETYPE) 464 #if defined (Q_WS_QPA) 465 bool askedForFallback;
472 #if !defined(QWS) && defined(Q_OS_MAC) 486 if (f.
isNull() && count == 1)
489 for (
int i = 0; i <
count; i++) {
501 foundries = newFoundries;
505 return foundries[count++];
582 #define SimplifiedChineseCsbBit 18 583 #define TraditionalChineseCsbBit 20 584 #define JapaneseCsbBit 17 585 #define KoreanCsbBit 21 590 bool hasScript =
false;
594 int bit = requiredUnicodeBits[i][0];
596 int flag = 1 << (bit&31);
597 if (bit != 126 && unicodeRange[index] & flag) {
598 bit = requiredUnicodeBits[i][1];
601 flag = 1 << (bit&31);
602 if (bit == 127 || unicodeRange[index] & flag) {
632 return writingSystems;
635 #if defined(Q_OS_SYMBIAN) && defined(QT_NO_FREETYPE) 637 class QSymbianFontDatabaseExtras
640 virtual ~QSymbianFontDatabaseExtras() {}
648 : count(0), families(0), reregisterAppFonts(false)
649 #
if defined(Q_WS_QWS)
655 #
if defined(
Q_WS_WIN) && !defined(QT_NO_DIRECTWRITE)
656 , directWriteFactory(0)
657 , directWriteGdiInterop(0)
663 #if defined(Q_OS_SYMBIAN) && defined(QT_NO_FREETYPE) 665 delete symbianExtras;
667 #if defined(Q_WS_WIN) && !defined(QT_NO_DIRECTWRITE) 668 if (directWriteGdiInterop)
669 directWriteGdiInterop->Release();
670 if (directWriteFactory != 0)
671 directWriteFactory->Release();
677 delete families[
count];
685 #if defined(Q_WS_X11) && !defined(QT_NO_FONTCONFIG) 690 #if defined(Q_WS_WIN) && !defined(QT_NO_DIRECTWRITE) 699 #if defined(Q_OS_WIN) 703 #elif defined(Q_WS_MAC) 704 ATSFontContainerRef handle;
705 #elif defined(Q_OS_SYMBIAN) && defined(QT_NO_FREETYPE) 707 TInt screenDeviceFontFileId;
708 TUid fontStoreFontFileUid;
719 #if defined(Q_WS_QWS) 723 #if defined(Q_WS_QWS) || defined(Q_OS_SYMBIAN) && !defined(QT_NO_FREETYPE) 724 void addFont(
const QString &familyname,
const char *foundryname,
int weight,
728 #ifndef QT_NO_FREETYPE 730 #endif // QT_NO_FREETYPE 732 #if defined(Q_WS_QWS) 734 #elif defined(Q_OS_SYMBIAN) && defined(QT_NO_FREETYPE) 735 QSymbianFontDatabaseExtras *symbianExtras;
737 #if defined(Q_WS_QWS) || defined(Q_WS_QPA) 761 pos = (high + low) / 2;
764 return families[pos];
778 families = newFamilies;
782 memmove(families + pos + 1, families + pos, (count-pos)*
sizeof(
QtFontFamily *));
783 families[pos] = family;
785 return families[pos];
788 #if defined(Q_WS_QWS) || defined(Q_OS_SYMBIAN) && !defined(QT_NO_FREETYPE) 790 const QByteArray &file,
int fileIndex,
bool antialiased,
800 if (writingSystems.
isEmpty()) {
806 for (
int i = 0; i < writingSystems.
count(); ++i) {
819 #if defined(Q_WS_QWS) 821 *
stream << familyname << foundry->
name << weight <<
quint8(italic) << pixelSize
822 << file << fileIndex <<
quint8(antialiased);
824 for (
int i = 0; i < writingSystems.
count(); ++i)
827 #else // ..in case of defined(Q_OS_SYMBIAN) && !defined(QT_NO_FREETYPE) 834 #if (defined(Q_WS_QWS) || defined(Q_OS_SYMBIAN)) && !defined(QT_NO_FREETYPE) 847 error = FT_New_Memory_Face(library, (
const FT_Byte *)fontData.
constData(), fontData.
size(),
index, &face);
849 error = FT_New_Face(library, file, index, &face);
851 if (error != FT_Err_Ok) {
852 qDebug() <<
"FT_New_Face failed with index" << index <<
":" <<
hex <<
error;
855 numFaces = face->num_faces;
858 bool italic = face->style_flags & FT_STYLE_FLAG_ITALIC;
860 if (face->style_flags & FT_STYLE_FLAG_BOLD)
865 for (
int i = 0; i < face->num_charmaps; ++i) {
866 FT_CharMap cm = face->charmaps[i];
867 if (cm->encoding == ft_encoding_adobe_custom
868 || cm->encoding == ft_encoding_symbol) {
873 if (writingSystems.
isEmpty()) {
874 TT_OS2 *os2 = (TT_OS2 *)FT_Get_Sfnt_Table(face, ft_sfnt_os2);
877 static_cast<quint32>(os2->ulUnicodeRange1), static_cast<quint32>(os2->ulUnicodeRange2),
static_cast<quint32>(os2->ulUnicodeRange3), static_cast<quint32>(os2->ulUnicodeRange4)
880 static_cast<quint32>(os2->ulCodePageRange1), static_cast<quint32>(os2->ulCodePageRange2)
891 addFont(family,
"", weight, italic,
892 0, file, index,
true, writingSystems);
896 }
while (index < numFaces);
940 return scriptForWritingSystem[writingSystem];
944 #if defined Q_WS_QWS || (defined(Q_WS_X11) && !defined(QT_NO_FONTCONFIG)) || defined(Q_WS_WIN) 974 if (i >= 0 && li >= 0 && i < li) {
975 foundry = name.
mid(i + 1, li - i - 1);
978 family = name.
left(i);
987 int len = family.
length();
1007 inline QtFontDesc() : family(0), foundry(0),
style(0), size(0), encoding(0), familyIndex(-1) {}
1016 #if !defined(Q_WS_MAC) 1018 const QString &family_name,
const QString &foundry_name,
int force_encoding_id,
1021 #if defined(Q_WS_X11) || defined(Q_WS_QWS) || defined(Q_WS_QPA) 1050 #if defined(Q_WS_X11) || defined(Q_WS_WIN) || defined(Q_OS_SYMBIAN) || defined(Q_WS_QPA) 1073 for (
int i = 0; i < list.
size(); ++i) {
1084 for (; it !=
end; ++
it)
1088 family_list += subs_list;
1099 return fontDatabaseMutex();
1103 #if defined(Q_WS_X11) 1105 #elif defined(Q_WS_MAC) 1107 #elif defined(Q_WS_WIN) 1109 #elif defined(Q_WS_QWS) 1111 #elif defined(Q_WS_QPA) 1113 #elif defined(Q_OS_SYMBIAN) 1114 # include "qfontdatabase_s60.cpp" 1118 #if !defined(Q_WS_X11) && !defined(Q_WS_MAC) 1131 for (
int i = 0; i < foundry->
count; i++ ) {
1160 FM_DEBUG(
" best style has distance 0x%x", dist );
1161 return foundry->
styles[best];
1164 #if defined(Q_WS_X11) 1170 if (force_encoding_id >= 0) {
1171 encoding = size->
encodingID(force_encoding_id);
1173 FM_DEBUG(
" required encoding_id not available");
1178 FM_DEBUG(
" PreferBitmap and/or OpenGL set, skipping Freetype");
1189 bool supportsScript =
false;
1191 if (scriptForWritingSystem[
ws] != script)
1195 if (!supportsScript)
1200 if (scriptForWritingSystem[
ws] != script)
1202 for (
int x = 0; !encoding && x < size->
count; ++x) {
1213 #if !defined(Q_WS_MAC) 1215 unsigned int bestFoundry(
int script,
unsigned int score,
int styleStrategy,
1232 for (
int x = 0; x < family->
count; ++x) {
1237 FM_DEBUG(
" looking for matching style in foundry '%s' %d",
1243 FM_DEBUG(
" ForceOutline set, but not smoothly scalable");
1251 if (!(styleStrategy & QFont::ForceOutline)) {
1263 FM_DEBUG(
" found smoothly scalable font (%d pixels)", pixelSize);
1272 FM_DEBUG(
" found bitmap scalable font (%d pixels)", pixelSize);
1284 for (
int x = 0; x < style->count; ++x) {
1287 findEncoding(script, styleStrategy, style->pixelSizes + x, force_encoding_id);
1289 FM_DEBUG(
" size %3d does not support the script we want",
1290 style->pixelSizes[x].pixelSize);
1296 if (style->pixelSizes[x].pixelSize < pixelSize) {
1300 d = pixelSize - style->pixelSizes[x].pixelSize + 1;
1302 d = style->pixelSizes[x].pixelSize -
pixelSize;
1307 size = style->pixelSizes + x;
1313 FM_DEBUG(
" no size supports the script we want");
1318 (distance * 10 / pixelSize) >= 2) {
1330 encoding =
findEncoding(script, styleStrategy, size, force_encoding_id);
1331 if (!encoding) size = 0;
1334 FM_DEBUG(
" foundry doesn't support the script we want");
1339 unsigned int this_score = 0x0000;
1341 PitchMismatch = 0x4000,
1342 StyleMismatch = 0x2000,
1343 BitmapScaledPenalty = 0x1000,
1344 EncodingMismatch = 0x0002,
1345 XLFDPenalty = 0x0001
1349 this_score += XLFDPenalty;
1351 this_score += EncodingMismatch;
1354 if (!(pitch ==
'm' && encoding->
pitch ==
'c') && pitch != encoding->
pitch)
1355 this_score += PitchMismatch;
1359 #if !defined(QWS) && defined(Q_OS_MAC) 1364 this_score += PitchMismatch;
1367 if (styleKey != style->key)
1368 this_score += StyleMismatch;
1369 if (!style->smoothScalable && px != size->
pixelSize)
1370 this_score += BitmapScaledPenalty;
1371 if (px != pixelSize)
1372 this_score +=
qAbs(px - pixelSize);
1374 if (this_score < score) {
1375 FM_DEBUG(
" found a match: score %x best score so far %x",
1386 FM_DEBUG(
" score %x no better than best %x", this_score, score);
1394 #if !defined(Q_WS_MAC) 1401 const QString &family_name,
const QString &foundry_name,
int force_encoding_id,
1415 " family: %s [%s], script: %d\n" 1416 " weight: %d, style: %d\n" 1423 #if defined(FONT_MATCH_DEBUG) && defined(Q_WS_X11) 1424 if (force_encoding_id >= 0) {
1425 FM_DEBUG(
" required encoding: %d", force_encoding_id);
1436 unsigned int score = ~0
u;
1439 load(family_name, script, forceXLFD);
1442 load(family_name, script);
1446 for (
int x = 0; x < db->
count; ++x) {
1447 if (blacklistedFamilies.
contains(x))
1464 uint score_adjust = 0;
1468 if (scriptForWritingSystem[
ws] != script)
1480 unsigned int newscore =
1483 &test, force_encoding_id);
1489 pitch, &test, force_encoding_id);
1491 newscore += score_adjust;
1493 if (newscore < score) {
1672 for (
int i = 0; i <
d->count; ++i) {
1674 if (family->
count == 0)
1676 for (
int x =
Latin; x < WritingSystemsCount; ++x) {
1681 list.
append(writingSystem);
1697 QString familyName, foundryName;
1709 if (!f || f->
count == 0)
1712 for (
int x =
Latin; x < WritingSystemsCount; ++x) {
1715 list.
append(writingSystem);
1737 if (writingSystem != Any)
1742 for (
int i = 0; i <
d->count; i++) {
1748 if (f->
count == 1) {
1751 for (
int j = 0; j < f->
count; j++) {
1775 QString familyName, foundryName;
1788 for (
int j = 0; j < f->
count; j++) {
1791 for (
int k = 0; k < foundry->
count; k++) {
1799 for (
int i = 0; i < allStyles.
count; i++) {
1818 QString familyName, foundryName;
1826 #if !defined(QWS) && defined(Q_OS_MAC) 1846 QString familyName, foundryName;
1858 for (
int j = 0; j < f->
count; j++) {
1861 for (
int k = 0; k < foundry->
count; k++)
1866 bitmapScalable =
true;
1887 QString familyName, foundryName;
1899 for (
int j = 0; j < f->
count; j++) {
1902 for (
int k = 0; k < foundry->
count; k++)
1906 smoothScalable =
true;
1927 return isBitmapScalable(family, style);
1944 #if defined(Q_WS_WIN) 1948 return standardSizes();
1951 QString familyName, foundryName;
1963 if (!fam)
return sizes;
1972 for (
int j = 0; j < fam->
count; j++) {
1976 if (!style)
continue;
1979 smoothScalable =
true;
1982 for (
int l = 0;
l < style->
count;
l++) {
1995 return standardSizes();
2011 QString familyName, foundryName;
2022 for (
int j = 0; j < f->
count; j++) {
2025 for (
int k = 0; k < foundry->
count; k++)
2065 QString familyName, foundryName;
2086 for (
int j = 0; j < fam->
count; j++) {
2090 if (!style)
continue;
2093 smoothScalable =
true;
2096 for (
int l = 0;
l < style->
count;
l++) {
2125 static const unsigned short standard[] =
2126 { 6, 7, 8, 9, 10, 11, 12, 14, 16, 18, 20, 22, 24, 26, 28, 36, 48, 72, 0 };
2127 const unsigned short *sizes = standard;
2128 while (*sizes) ret << *sizes++;
2141 QString familyName, foundryName;
2150 if (!f)
return false;
2152 for (
int j = 0; j < f->
count; j++) {
2155 for (
int k = 0; k < foundry->
count; k++)
2175 QString familyName, foundryName;
2184 if (!f)
return false;
2186 for (
int j = 0; j < f->
count; j++) {
2190 for (
int k = 0; k < foundry->
count; k++)
2211 QString familyName, foundryName;
2222 for (
int j = 0; j < f->
count; j++) {
2226 for (
int k = 0; k < foundry->
count; k++)
2240 QString parsedFamily, foundry;
2242 const QString familyAlias = resolveFontFamilyAlias(parsedFamily);
2253 const char *name = 0;
2254 switch (writingSystem) {
2330 case SimplifiedChinese:
2333 case TraditionalChinese:
2358 Q_ASSERT_X(
false,
"QFontDatabase::writingSystemName",
"invalid 'writingSystem' parameter");
2371 switch (writingSystem) {
2381 sample +=
QChar(0x00C3);
2382 sample +=
QChar(0x00E1);
2386 sample +=
QChar(0x0393);
2387 sample +=
QChar(0x03B1);
2388 sample +=
QChar(0x03A9);
2389 sample +=
QChar(0x03C9);
2392 sample +=
QChar(0x0414);
2393 sample +=
QChar(0x0434);
2394 sample +=
QChar(0x0436);
2395 sample +=
QChar(0x044f);
2398 sample +=
QChar(0x053f);
2399 sample +=
QChar(0x054f);
2400 sample +=
QChar(0x056f);
2401 sample +=
QChar(0x057f);
2404 sample +=
QChar(0x05D0);
2405 sample +=
QChar(0x05D1);
2406 sample +=
QChar(0x05D2);
2407 sample +=
QChar(0x05D3);
2410 sample +=
QChar(0x0628);
2411 sample +=
QChar(0x0629);
2412 sample +=
QChar(0x062A);
2413 sample +=
QChar(0x063A);
2416 sample +=
QChar(0x0715);
2417 sample +=
QChar(0x0725);
2418 sample +=
QChar(0x0716);
2419 sample +=
QChar(0x0726);
2422 sample +=
QChar(0x0784);
2423 sample +=
QChar(0x0794);
2424 sample +=
QChar(0x078c);
2425 sample +=
QChar(0x078d);
2428 sample +=
QChar(0x0905);
2429 sample +=
QChar(0x0915);
2430 sample +=
QChar(0x0925);
2431 sample +=
QChar(0x0935);
2434 sample +=
QChar(0x0986);
2435 sample +=
QChar(0x0996);
2436 sample +=
QChar(0x09a6);
2437 sample +=
QChar(0x09b6);
2440 sample +=
QChar(0x0a05);
2441 sample +=
QChar(0x0a15);
2442 sample +=
QChar(0x0a25);
2443 sample +=
QChar(0x0a35);
2446 sample +=
QChar(0x0a85);
2447 sample +=
QChar(0x0a95);
2448 sample +=
QChar(0x0aa5);
2449 sample +=
QChar(0x0ab5);
2452 sample +=
QChar(0x0b06);
2453 sample +=
QChar(0x0b16);
2454 sample +=
QChar(0x0b2b);
2455 sample +=
QChar(0x0b36);
2458 sample +=
QChar(0x0b89);
2459 sample +=
QChar(0x0b99);
2460 sample +=
QChar(0x0ba9);
2461 sample +=
QChar(0x0bb9);
2464 sample +=
QChar(0x0c05);
2465 sample +=
QChar(0x0c15);
2466 sample +=
QChar(0x0c25);
2467 sample +=
QChar(0x0c35);
2470 sample +=
QChar(0x0c85);
2471 sample +=
QChar(0x0c95);
2472 sample +=
QChar(0x0ca5);
2473 sample +=
QChar(0x0cb5);
2476 sample +=
QChar(0x0d05);
2477 sample +=
QChar(0x0d15);
2478 sample +=
QChar(0x0d25);
2479 sample +=
QChar(0x0d35);
2482 sample +=
QChar(0x0d90);
2483 sample +=
QChar(0x0da0);
2484 sample +=
QChar(0x0db0);
2485 sample +=
QChar(0x0dc0);
2488 sample +=
QChar(0x0e02);
2489 sample +=
QChar(0x0e12);
2490 sample +=
QChar(0x0e22);
2491 sample +=
QChar(0x0e32);
2494 sample +=
QChar(0x0e8d);
2495 sample +=
QChar(0x0e9d);
2496 sample +=
QChar(0x0ead);
2497 sample +=
QChar(0x0ebd);
2500 sample +=
QChar(0x0f00);
2501 sample +=
QChar(0x0f01);
2502 sample +=
QChar(0x0f02);
2503 sample +=
QChar(0x0f03);
2506 sample +=
QChar(0x1000);
2507 sample +=
QChar(0x1001);
2508 sample +=
QChar(0x1002);
2509 sample +=
QChar(0x1003);
2512 sample +=
QChar(0x10a0);
2513 sample +=
QChar(0x10b0);
2514 sample +=
QChar(0x10c0);
2515 sample +=
QChar(0x10d0);
2518 sample +=
QChar(0x1780);
2519 sample +=
QChar(0x1790);
2520 sample +=
QChar(0x17b0);
2521 sample +=
QChar(0x17c0);
2523 case SimplifiedChinese:
2524 sample +=
QChar(0x4e2d);
2525 sample +=
QChar(0x6587);
2526 sample +=
QChar(0x8303);
2527 sample +=
QChar(0x4f8b);
2529 case TraditionalChinese:
2530 sample +=
QChar(0x4e2d);
2531 sample +=
QChar(0x6587);
2532 sample +=
QChar(0x7bc4);
2533 sample +=
QChar(0x4f8b);
2536 sample +=
QChar(0x30b5);
2537 sample +=
QChar(0x30f3);
2538 sample +=
QChar(0x30d7);
2539 sample +=
QChar(0x30eb);
2540 sample +=
QChar(0x3067);
2541 sample +=
QChar(0x3059);
2544 sample +=
QChar(0xac00);
2545 sample +=
QChar(0xac11);
2546 sample +=
QChar(0xac1a);
2547 sample +=
QChar(0xac2f);
2551 static const char vietnameseUtf8[] = {
2552 char(0xef), char(0xbb), char(0xbf), char(0xe1), char(0xbb), char(0x97),
2553 char(0xe1), char(0xbb), char(0x99),
2554 char(0xe1), char(0xbb), char(0x91),
2555 char(0xe1), char(0xbb), char(0x93),
2561 sample +=
QChar(0x1681);
2562 sample +=
QChar(0x1682);
2563 sample +=
QChar(0x1683);
2564 sample +=
QChar(0x1684);
2567 sample +=
QChar(0x16a0);
2568 sample +=
QChar(0x16a1);
2569 sample +=
QChar(0x16a2);
2570 sample +=
QChar(0x16a3);
2573 sample +=
QChar(0x7ca);
2574 sample +=
QChar(0x7cb);
2575 sample +=
QChar(0x7cc);
2576 sample +=
QChar(0x7cd);
2597 return privateDb()->applicationFonts.value(index).data;
2603 font.
data = fontData;
2607 for (i = 0; i < applicationFonts.
count(); ++i)
2608 if (applicationFonts.
at(i).families.isEmpty())
2610 if (i >= applicationFonts.
count()) {
2612 i = applicationFonts.
count() - 1;
2622 applicationFonts[i] = font;
2630 for (
int i = 0; i < applicationFonts.
count(); ++i)
2631 if (applicationFonts.
at(i).fileName ==
fileName)
2669 return privateDb()->addAppFont(data, fileName);
2697 return privateDb()->addAppFont(fontData,
QString() );
2714 return privateDb()->applicationFonts.value(
id).families;
static QString number(int, int base=10)
This is an overloaded member function, provided for convenience. It differs from the above function o...
QBool contains(QChar c, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
virtual FileFlags fileFlags(FileFlags type=FileInfoAll) const
This function should return the set of OR'd flags that are true for the file engine's file...
static QList< int > standardSizes()
Returns a list of standard font sizes.
QtFontFamily(const QString &n)
The QApplication class manages the GUI application's control flow and main settings.
int width(const QString &, int len=-1) const
Returns the width in pixels of the first len characters of text.
bool operator==(const Key &other)
QFont font(const QString &family, const QString &style, int pointSize) const
Returns a QFont object that has family family, style style and point size pointSize.
Q_GUI_EXPORT QByteArray qt_fontdata_from_index(int index)
The QFontMetrics class provides font metrics information.
#define QT_END_NAMESPACE
This macro expands to.
The QMutex class provides access serialization between threads.
Q_CORE_EXPORT QTextStream & ws(QTextStream &s)
QStringList styles(const QString &family) const
Returns a list of the styles available for the font family family.
static QString fromAscii(const char *, int size=-1)
Returns a QString initialized with the first size characters from the string str. ...
static bool requiresOpenType(int writingSystem)
QtFontStyle * style(const QtFontStyle::Key &, const QString &=QString(), bool=false)
#define it(className, varName)
static int addApplicationFont(const QString &fileName)
Loads the font from the file specified by fileName and makes it available to the application.
bool open(OpenMode flags)
Opens the file using OpenMode mode, returning true if successful; otherwise false.
int count(const T &t) const
Returns the number of occurrences of value in the vector.
int weight() const
Returns the weight of the matched window system font.
Q_GUI_EXPORT int qt_defaultDpiY()
static int requiredUnicodeBits[QFontDatabase::WritingSystemsCount][2]
The QByteArray class provides an array of bytes.
static Expression::Ptr create(Expression *const expr, const YYLTYPE &sourceLocator, const ParserContext *const parseInfo)
int length() const
Returns the number of characters in this string.
static QStringList fontPath()
#define Q_WS_WIN
Defined on Windows.
Style style() const
Returns the style of the font.
virtual QAbstractFileEngine * fileEngine() const
Returns the QIOEngine for this QFile object.
static bool match(const uchar *found, const char *target, uint len)
const_iterator constBegin() const
Returns a const STL-style iterator pointing to the first item in the list.
static int defaultEncodingID
bool startsWith(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the string starts with s; otherwise returns false.
QStringList fallbackFamilies
#define QT_TRANSLATE_NOOP(scope, x)
Marks the string literal sourceText for dynamic translation in the given context; i...
#define QT_END_INCLUDE_NAMESPACE
This macro is equivalent to QT_BEGIN_NAMESPACE.
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
Weight
Qt uses a weighting scale from 0 to 99 similar to, but not the same as, the scales used in Windows or...
int count(const T &t) const
Returns the number of occurrences of value in the list.
bool ref()
Atomically increments the value of this QAtomicInt.
bool isApplicationFont(const QString &fileName)
static void parseFontName(const QString &name, QString &foundry, QString &family)
QList< WritingSystem > writingSystems() const
Returns a sorted list of the available writing systems.
The QString class provides a Unicode character string.
Q_DECL_CONSTEXPR T qAbs(const T &t)
bool operator<(int priority, const QPair< QRunnable *, int > &p)
bool bold(const QString &family, const QString &style) const
Returns true if the font that has family family and style style is bold; otherwise returns false...
QFontDatabase()
Creates a font database object.
The QChar class provides a 16-bit Unicode character.
static void parseFontName(const QString &name, QString &foundry, QString &family)
This makes sense of the font family name:
QChar * data()
Returns a pointer to the data stored in the QString.
int weight(const QString &family, const QString &style) const
Returns the weight of the font that has family family and style style.
QString styleName() const
Returns the requested font style name, it will be used to match the font with irregular styles (that ...
QStringList addTTFile(const QByteArray &file, const QByteArray &fontData=QByteArray())
Q_CORE_EXPORT QTextStream & hex(QTextStream &s)
QString styleName() const
Returns the style name of the matched window system font on system that supports it.
bool isSpace() const
Returns true if the character is a separator character (Separator_* categories); otherwise returns fa...
bool isEmpty() const
Returns true if the list contains no items; otherwise returns false.
static QString translate(const char *context, const char *key, const char *disambiguation=0, Encoding encoding=CodecForTr)
static QFontCache * instance()
static QFont font()
Returns the default application font.
Q_CORE_EXPORT void qDebug(const char *,...)
#define Q_OS_MAC
Defined on MAC OS (synonym for Darwin).
Q_AUTOTEST_EXPORT void qt_setQtEnableTestFont(bool value)
void append(const T &t)
Inserts value at the end of the list.
static void getEngineData(const QFontPrivate *d, const QFontCache::Key &key)
#define QT_BEGIN_NAMESPACE
This macro expands to.
QStringList fallbackFamilies
QBool contains(const T &t) const
Returns true if the list contains an occurrence of value; otherwise returns false.
struct FT_FaceRec_ * FT_Face
static QStringList familyList(const QFontDef &req)
QStringList families(WritingSystem writingSystem=Any) const
Returns a sorted list of the available font families which support the writingSystem.
QMutex * qt_fontdatabase_mutex()
QtFontEncoding * encoding
static float pixelSize(const QFontDef &request, int dpi)
QString left(int n) const Q_REQUIRED_RESULT
Returns a substring that contains the n leftmost characters of the string.
QString trimmed() const Q_REQUIRED_RESULT
Returns a string that has whitespace removed from the start and the end.
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
int addAppFont(const QByteArray &fontData, const QString &fileName)
bool italic(const QString &family, const QString &style) const
Returns true if the font that has family family and style style is italic; otherwise returns false...
#define Q_GLOBAL_STATIC(TYPE, NAME)
Declares a global static variable with the given type and name.
void insertEngineData(const Key &key, QFontEngineData *engineData)
const T & at(int i) const
Returns the item at index position i in the list.
const char * setwidthName
The QStringList class provides a list of strings.
static void registerFont(QFontDatabasePrivate::ApplicationFont *fnt)
#define QT_PREPEND_NAMESPACE(name)
This macro qualifies identifier with the full namespace.
static QString fromUtf8(const char *, int size=-1)
Returns a QString initialized with the first size bytes of the UTF-8 string str.
void append(const T &t)
Inserts value at the end of the vector.
QList< int > pointSizes(const QString &family, const QString &style=QString())
Returns a list of the point sizes available for the font with the given family and style...
static void qt_mac_get_fixed_pitch(QtFontFamily *f)
static QtFontEncoding * findEncoding(int script, int styleStrategy, QtFontSize *size, int force_encoding_id)
static const char * data(const QByteArray &arr)
int indexOf(QChar c, int from=0, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
static void initializeDb()
The QLatin1String class provides a thin wrapper around an US-ASCII/Latin-1 encoded string literal...
QChar toUpper() const
Returns the uppercase equivalent if the character is lowercase or titlecase; otherwise returns the ch...
static QString resolveFontFamilyAlias(const QString &family)
bool hasFamily(const QString &family) const
QtFontStyle(const Key &k)
QByteArray toLatin1() const Q_REQUIRED_RESULT
Returns a Latin-1 representation of the string as a QByteArray.
QtFontFoundry(const QString &n)
static QtFontStyle * bestStyle(QtFontFoundry *foundry, const QtFontStyle::Key &styleKey, const QString &styleName=QString())
QtFontFoundry ** foundries
The QFontInfo class provides general information about fonts.
Style
This enum describes the different styles of glyphs that are used to display text. ...
bool isBitmapScalable(const QString &family, const QString &style=QString()) const
Returns true if the font that has family family and style style is a scalable bitmap font; otherwise ...
QFont::Style style() const
Returns the style value of the matched window system font.
void qSort(RandomAccessIterator start, RandomAccessIterator end)
Q_CORE_EXPORT int QT_FASTCALL script(uint ucs4)
const T & at(int i) const
Returns the item at index position i in the vector.
QtFontFamily * family(const QString &f, bool=false)
static QString writingSystemSample(WritingSystem writingSystem)
Returns a string with sample characters from writingSystem.
static int getFontWeight(const QString &weightString)
const char * constData() const
Returns a pointer to the data stored in the byte array.
bool isNull() const
Returns true if this string is null; otherwise returns false.
QString mid(int position, int n=-1) const Q_REQUIRED_RESULT
Returns a string that contains n characters of this string, starting at the specified position index...
void addFont(const QString &familyname, const char *foundryname, int weight, bool italic, int pixelSize, const QByteArray &file, int fileIndex, bool antialiased, const QList< QFontDatabase::WritingSystem > &writingSystems=QList< QFontDatabase::WritingSystem >())
static void checkSymbolFonts(const QString &family=QString())
#define Q_ASSERT_X(cond, where, what)
The QMutexLocker class is a convenience class that simplifies locking and unlocking mutexes...
static QStringList substitutes(const QString &)
Returns a list of family names to be used whenever familyName is specified.
int compare(const QString &s) const
The QFile class provides an interface for reading from and writing to files.
static bool isSmoothlyScalable(char **tokens)
static bool scriptRequiresOpenType(int script)
unsigned char writingSystems[QFontDatabase::WritingSystemsCount]
QtFontSize * pixelSize(unsigned short size, bool=false)
The QFont class specifies a font used for drawing text.
static QCoreApplication * instance()
Returns a pointer to the application's QCoreApplication (or QApplication) instance.
QString simplified() const Q_REQUIRED_RESULT
Returns a string that has whitespace removed from the start and the end, and that has each sequence o...
void clear()
Clears the contents of the string and makes it empty.
#define SimplifiedChineseCsbBit
int lastIndexOf(QChar c, int from=-1, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
static QString fromLatin1(const char *, int size=-1)
Returns a QString initialized with the first size characters of the Latin-1 string str...
static int addApplicationFontFromData(const QByteArray &fontData)
Loads the font from binary data specified by fontData and makes it available to the application...
QVector< FONTSIGNATURE > signatures
static QStringList applicationFontFamilies(int id)
Returns a list of font families for the given application font identified by id.
const_iterator ConstIterator
Qt-style synonym for QList::const_iterator.
QString toLower() const Q_REQUIRED_RESULT
Returns a lowercase copy of the string.
int size() const
Returns the number of items in the list.
bool isScalable(const QString &family, const QString &style=QString()) const
Returns true if the font that has family family and style style is scalable; otherwise returns false...
void setStyleName(const QString &)
Sets the style name of the font to the given styleName.
QString styleString(const QFont &font)
Returns a string that describes the style of the font.
if(void) toggleToolbarShown
#define Q_AUTOTEST_EXPORT
int weight() const
Returns the weight of the font which is one of the enumerated values from QFont::Weight.
QByteArray readAll()
Reads all available data from the device, and returns it as a QByteArray.
int size() const
Returns the number of bytes in this byte array.
bool operator!=(const Key &other)
int qt_script_for_writing_system(QFontDatabase::WritingSystem writingSystem)
QtFontEncoding * encodingID(int id, uint xpoint=0, uint xres=0, uint yres=0, uint avgwidth=0, bool add=false)
static QString styleStringHelper(int weight, QFont::Style style)
bool isFixedPitch(const QString &family, const QString &style=QString()) const
Returns true if the font that has family family and style style is fixed pitch; otherwise returns fal...
#define QT_BEGIN_INCLUDE_NAMESPACE
This macro is equivalent to QT_END_NAMESPACE.
QList< int > smoothSizes(const QString &family, const QString &style)
Returns the point sizes of a font with the given family and style that will look attractive.
bool isEmpty() const
Returns true if the byte array has size 0; otherwise returns false.
QStringList split(const QString &sep, SplitBehavior behavior=KeepEmptyParts, Qt::CaseSensitivity cs=Qt::CaseSensitive) const Q_REQUIRED_RESULT
Splits the string into substrings wherever sep occurs, and returns the list of those strings...
QFontEngineData * findEngineData(const Key &key) const
The QDataStream class provides serialization of binary data to a QIODevice.
static const char writingSystems_for_xlfd_encoding[sizeof(xlfd_encoding)][QFontDatabase::WritingSystemsCount]
FT_Library qt_getFreetype()
QFont::Weight weightFromInteger(int weight)
QtFontEncoding * encodings
static const int scriptForWritingSystem[]
QVector< ApplicationFont > applicationFonts
QtFontFoundry * foundry(const QString &f, bool=false)
static QString writingSystemName(WritingSystem writingSystem)
Returns the names the writingSystem (e.g.
IDWriteGdiInterop * directWriteGdiInterop
bool endsWith(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the string ends with s; otherwise returns false.
static void createDatabase()
static const KeyPair *const end
QFontEngineData * engineData
bool isSmoothlyScalable(const QString &family, const QString &style=QString()) const
Returns true if the font that has family family and style style is smoothly scalable; otherwise retur...
IDWriteFactory * directWriteFactory
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
static QString fileName(const QString &fileUrl)
bool operator==(QBool b1, bool b2)
#define Q_GLOBAL_STATIC_WITH_ARGS(TYPE, NAME, ARGS)
Declares a global static variable with the specified type and name.
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
static float pointSize(const QFontDef &fd, int dpi)
#define TraditionalChineseCsbBit
void setStyle(Style style)
Sets the style of the font to style.
Q_DECL_CONSTEXPR int qRound(qreal d)
QList< QFontDatabase::WritingSystem > qt_determine_writing_systems_from_truetype_bits(quint32 unicodeRange[4], quint32 codePageRange[2])
const_iterator constEnd() const
Returns a const STL-style iterator pointing to the imaginary item after the last item in the list...
static int appDpiY(int screen=-1)
Returns the vertical resolution of the given screen in terms of the number of dots per inch...
bool ftWritingSystemCheck