1
/****************************************************************************
3
** Copyright (C) 1992-2005 Trolltech AS. All rights reserved.
5
** This file is part of the text module of the Qt Toolkit.
7
** This file may be distributed under the terms of the Q Public License
8
** as defined by Trolltech AS of Norway and appearing in the file
9
** LICENSE.QPL included in the packaging of this file.
11
** This file may be distributed and/or modified under the terms of the
12
** GNU General Public License version 2 as published by the Free Software
13
** Foundation and appearing in the file LICENSE.GPL included in the
14
** packaging of this file.
16
** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
17
** information about Qt Commercial License Agreements.
18
** See http://www.trolltech.com/qpl/ for QPL licensing information.
19
** See http://www.trolltech.com/gpl/ for GPL licensing information.
21
** Contact info@trolltech.com if any conditions of this licensing are
24
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
25
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
27
****************************************************************************/
29
#include "qfontdatabase.h"
31
#ifndef QT_NO_FONTDATABASE
33
#include <qalgorithms.h>
34
#include <qapplication.h>
36
#include <private/qunicodetables_p.h>
37
#include "qfontengine_p.h"
38
#include "qopentype_p.h"
46
// #define QFONTDATABASE_DEBUG
47
#ifdef QFONTDATABASE_DEBUG
48
# define FD_DEBUG qDebug
50
# define FD_DEBUG if (false) qDebug
53
// #define FONT_MATCH_DEBUG
54
#ifdef FONT_MATCH_DEBUG
55
# define FM_DEBUG qDebug
57
# define FM_DEBUG if (false) qDebug
60
#if defined(Q_CC_MSVC) && !defined(Q_CC_MSVC_NET)
61
# define for if(0){}else for
65
Q_GUI_EXPORT bool qt_enable_test_font = false;
67
static int ucstricmp(const QString &as, const QString &bs)
69
const QChar *a = as.unicode();
70
const QChar *b = bs.unicode();
77
int l=qMin(as.length(),bs.length());
78
while (l-- && ::lower(*a) == ::lower(*b))
81
return (as.length()-bs.length());
82
return ::lower(*a).unicode() - ::lower(*b).unicode();
85
static int getFontWeight(const QString &weightString)
87
QString s = weightString.toLower();
89
// Test in decreasing order of commonness
95
if (s == "demibold" || s == "demi bold")
96
return QFont::DemiBold;
102
if (s.contains("bold")) {
103
if (s.contains("demi"))
104
return (int) QFont::DemiBold;
105
return (int) QFont::Bold;
108
if (s.contains("light"))
109
return (int) QFont::Light;
111
if (s.contains("black"))
112
return (int) QFont::Black;
114
return (int) QFont::Normal;
118
struct QtFontEncoding
120
signed int encoding : 16;
132
unsigned short pixelSize;
136
QtFontEncoding *encodings;
137
QtFontEncoding *encodingID(int id, uint xpoint = 0, uint xres = 0,
138
uint yres = 0, uint avgwidth = 0, bool add = false);
147
QtFontEncoding *QtFontSize::encodingID(int id, uint xpoint, uint xres,
148
uint yres, uint avgwidth, bool add)
150
// we don't match using the xpoint, xres and yres parameters, only the id
151
for (int i = 0; i < count; ++i) {
152
if (encodings[i].encoding == id)
153
return encodings + i;
159
encodings = (QtFontEncoding *)
161
(((count+4) >> 2) << 2) * sizeof(QtFontEncoding));
162
encodings[count].encoding = id;
163
encodings[count].xpoint = xpoint;
164
encodings[count].xres = xres;
165
encodings[count].yres = yres;
166
encodings[count].avgwidth = avgwidth;
167
encodings[count].pitch = '*';
168
return encodings + count++;
175
Key(const QString &styleString);
176
Key() : style(QFont::StyleNormal),
177
weight(QFont::Normal), stretch(0) { }
178
Key(const Key &o) : style(o.style),
179
weight(o.weight), stretch(o.stretch) { }
181
signed int weight : 8;
182
signed int stretch : 12;
184
bool operator==(const Key & other) {
185
return (style == other.style &&
186
weight == other.weight &&
187
(stretch == 0 || other.stretch == 0 || stretch == other.stretch));
189
bool operator!=(const Key &other) {
190
return !operator==(other);
192
bool operator <(const Key &o) {
193
int x = (style << 12) + (weight << 14) + stretch;
194
int y = (o.style << 12) + (o.weight << 14) + o.stretch;
199
QtFontStyle(const Key &k)
200
: key(k), bitmapScalable(false), smoothScalable(false),
201
fakeOblique(false), count(0), pixelSizes(0)
203
#if defined(Q_WS_X11)
204
weightName = setwidthName = 0;
210
delete [] weightName;
211
delete [] setwidthName;
213
free(pixelSizes[count].encodings);
219
bool bitmapScalable : 1;
220
bool smoothScalable : 1;
221
bool fakeOblique : 1;
222
signed int count : 29;
223
QtFontSize *pixelSizes;
226
const char *weightName;
227
const char *setwidthName;
230
QtFontSize *pixelSize(unsigned short size, bool = false);
233
QtFontStyle::Key::Key(const QString &styleString)
234
: style(QFont::StyleNormal), weight(QFont::Normal), stretch(0)
236
weight = getFontWeight(styleString);
238
if (styleString.contains("Italic"))
239
style = QFont::StyleItalic;
240
else if (styleString.contains("Oblique"))
241
style = QFont::StyleOblique;
244
QtFontSize *QtFontStyle::pixelSize(unsigned short size, bool add)
246
for (int i = 0; i < count; i++) {
247
if (pixelSizes[i].pixelSize == size)
248
return pixelSizes + i;
254
pixelSizes = (QtFontSize *)
256
(((count+8) >> 3) << 3) * sizeof(QtFontSize));
257
pixelSizes[count].pixelSize = size;
259
pixelSizes[count].count = 0;
260
pixelSizes[count].encodings = 0;
263
new (&pixelSizes[count].fileName) QByteArray;
265
return pixelSizes + (count++);
270
QtFontFoundry(const QString &n) : name(n), count(0), styles(0) {}
273
delete styles[count];
280
QtFontStyle **styles;
281
QtFontStyle *style(const QtFontStyle::Key &, bool = false);
284
QtFontStyle *QtFontFoundry::style(const QtFontStyle::Key &key, bool create)
292
if (styles[pos]->key == key)
294
if (styles[pos]->key < key)
298
pos = (high + low) / 2;
305
// qDebug("adding key (weight=%d, style=%d, oblique=%d stretch=%d) at %d", key.weight, key.style, key.oblique, key.stretch, pos);
307
styles = (QtFontStyle **)
308
realloc(styles, (((count+8) >> 3) << 3) * sizeof(QtFontStyle *));
310
memmove(styles + pos + 1, styles + pos, (count-pos)*sizeof(QtFontStyle *));
311
styles[pos] = new QtFontStyle(key);
319
enum WritingSystemStatus {
324
Unsupported = UnsupportedFT | UnsupportedXLFD
327
QtFontFamily(const QString &n)
330
fixedPitch(true), hasFT(false), ftWritingSystemCheck(false),
331
xlfdLoaded(false), synthetic(false),
336
writingSystemCheck(false),
338
#if defined(Q_OS_MAC) && !defined(QWS)
339
fixedPitchComputed(false),
341
name(n), count(0), foundries(0) {
342
memset(writingSystems, 0, sizeof(writingSystems));
346
delete foundries[count];
353
bool ftWritingSystemCheck : 1;
358
bool writingSystemCheck : 1;
360
#if defined(Q_OS_MAC) && !defined(QWS)
361
bool fixedPitchComputed : 1;
366
QByteArray fontFilename;
370
QString english_name;
373
QtFontFoundry **foundries;
375
unsigned char writingSystems[QFontDatabase::WritingSystemsCount];
377
QtFontFoundry *foundry(const QString &f, bool = false);
380
#if defined(Q_OS_MAC) && !defined(QWS)
381
inline static void qt_mac_get_fixed_pitch(QtFontFamily *f)
383
if(f && !f->fixedPitchComputed) {
384
QFontMetrics fm(f->name);
385
f->fixedPitch = fm.width('i') == fm.width('m');
386
f->fixedPitchComputed = true;
392
QtFontFoundry *QtFontFamily::foundry(const QString &f, bool create)
394
if (f.isNull() && count == 1)
397
for (int i = 0; i < count; i++) {
398
if (ucstricmp(foundries[i]->name, f) == 0)
405
foundries = (QtFontFoundry **)
407
(((count+8) >> 3) << 3) * sizeof(QtFontFoundry *));
409
foundries[count] = new QtFontFoundry(f);
410
return foundries[count++];
413
class QFontDatabasePrivate
416
QFontDatabasePrivate() : count(0), families(0) { }
417
~QFontDatabasePrivate() {
419
delete families[count];
422
QtFontFamily *family(const QString &f, bool = false);
425
QtFontFamily **families;
428
QtFontFamily *QFontDatabasePrivate::family(const QString &f, bool create)
435
while ((res = ucstricmp(families[pos]->name, f)) && pos != low) {
440
pos = (high + low) / 2;
443
return families[pos];
451
// qDebug("adding family %s at %d total=%d", f.latin1(), pos, count);
453
families = (QtFontFamily **)
455
(((count+8) >> 3) << 3) * sizeof(QtFontFamily *));
457
memmove(families + pos + 1, families + pos, (count-pos)*sizeof(QtFontFamily *));
458
families[pos] = new QtFontFamily(f);
460
return families[pos];
464
static const int scriptForWritingSystem[] = {
465
QUnicodeTables::Common, // Any
466
QUnicodeTables::Common, // Latin
467
QUnicodeTables::Common, // Greek
468
QUnicodeTables::Common, // Cyrillic
469
QUnicodeTables::Common, // Armenian
470
QUnicodeTables::Hebrew, // Hebrew
471
QUnicodeTables::Arabic, // Arabic
472
QUnicodeTables::Syriac, // Syriac
473
QUnicodeTables::Thaana, // Thaana
474
QUnicodeTables::Devanagari, // Devanagari
475
QUnicodeTables::Bengali, // Bengali
476
QUnicodeTables::Gurmukhi, // Gurmukhi
477
QUnicodeTables::Gujarati, // Gujarati
478
QUnicodeTables::Oriya, // Oriya
479
QUnicodeTables::Tamil, // Tamil
480
QUnicodeTables::Telugu, // Telugu
481
QUnicodeTables::Kannada, // Kannada
482
QUnicodeTables::Malayalam, // Malayalam
483
QUnicodeTables::Sinhala, // Sinhala
484
QUnicodeTables::Thai, // Thai
485
QUnicodeTables::Lao, // Lao
486
QUnicodeTables::Tibetan, // Tibetan
487
QUnicodeTables::Myanmar, // Myanmar
488
QUnicodeTables::Common, // Georgian
489
QUnicodeTables::Khmer, // Khmer
490
QUnicodeTables::Common, // SimplifiedChinese
491
QUnicodeTables::Common, // TraditionalChinese
492
QUnicodeTables::Common, // Japanese
493
QUnicodeTables::Hangul, // Korean
494
QUnicodeTables::Common, // Vietnamese
495
QUnicodeTables::Common, // Yi
496
QUnicodeTables::Common, // Tagalog
497
QUnicodeTables::Common, // Hanunoo
498
QUnicodeTables::Common, // Buhid
499
QUnicodeTables::Common, // Tagbanwa
500
QUnicodeTables::Common, // Limbu
501
QUnicodeTables::Common, // TaiLe
502
QUnicodeTables::Common, // Braille
503
QUnicodeTables::Common // Other
507
#if defined Q_WS_QWS || (defined(Q_WS_X11) && !defined(QT_NO_FONTCONFIG))
508
static inline bool requiresOpenType(int writingSystem)
510
return ((writingSystem >= QFontDatabase::Syriac && writingSystem <= QFontDatabase::Sinhala)
511
|| writingSystem == QFontDatabase::Myanmar
512
|| writingSystem == QFontDatabase::Khmer);
514
static inline bool scriptRequiresOpenType(int script)
516
return ((script >= QUnicodeTables::Syriac && script <= QUnicodeTables::Sinhala)
517
|| script == QUnicodeTables::Myanmar
518
|| script == QUnicodeTables::Khmer);
522
Q_GLOBAL_STATIC(QFontDatabasePrivate, privateDb);
524
#define SMOOTH_SCALABLE 0xffff
526
#if defined(Q_WS_X11)
527
# include "qfontdatabase_x11.cpp"
528
#elif defined(Q_WS_MAC)
529
# include "qfontdatabase_mac.cpp"
530
#elif defined(Q_WS_WIN)
531
# include "qfontdatabase_win.cpp"
532
#elif defined(Q_WS_QWS)
533
# include "qfontdatabase_qws.cpp"
536
static QtFontStyle *bestStyle(QtFontFoundry *foundry, const QtFontStyle::Key &styleKey)
541
for ( int i = 0; i < foundry->count; i++ ) {
542
QtFontStyle *style = foundry->styles[i];
544
int d = qAbs( styleKey.weight - style->key.weight );
546
if ( styleKey.stretch != 0 && style->key.stretch != 0 ) {
547
d += qAbs( styleKey.stretch - style->key.stretch );
550
if (styleKey.style != style->key.style) {
551
if (styleKey.style != QFont::StyleNormal && style->key.style != QFont::StyleNormal)
552
// one is italic, the other oblique
564
FM_DEBUG( " best style has distance 0x%x", dist );
565
return foundry->styles[best];
568
#if defined(Q_WS_X11)
569
static QtFontEncoding *findEncoding(int script, int styleStrategy,
570
QtFontSize *size, int force_encoding_id)
572
QtFontEncoding *encoding = 0;
574
if (force_encoding_id >= 0) {
575
encoding = size->encodingID(force_encoding_id);
577
FM_DEBUG(" required encoding_id not available");
581
if (styleStrategy & (QFont::OpenGLCompatible | QFont::PreferBitmap)) {
582
FM_DEBUG(" PreferBitmap and/or OpenGL set, skipping Freetype");
584
encoding = size->encodingID(-1); // -1 == prefer Freetype
589
// FT not available, find an XLFD font, trying the default encoding first
590
encoding = size->encodingID(QFontPrivate::defaultEncodingID);
592
// does it support the requested script?
593
bool supportsScript = false;
594
for (int ws = 1; !supportsScript && ws < QFontDatabase::WritingSystemsCount; ++ws) {
595
if (scriptForWritingSystem[ws] != script)
597
supportsScript = writingSystems_for_xlfd_encoding[encoding->encoding][ws];
602
// find the first encoding that supports the requested script
603
for (int ws = 1; !encoding && ws < QFontDatabase::WritingSystemsCount; ++ws) {
604
if (scriptForWritingSystem[ws] != script)
606
for (int x = 0; !encoding && x < size->count; ++x) {
607
const int enc = size->encodings[x].encoding;
608
if (writingSystems_for_xlfd_encoding[enc][ws])
609
encoding = size->encodings + x;
618
unsigned int bestFoundry(int script, unsigned int score, int styleStrategy,
619
const QtFontFamily *family, const QString &foundry_name,
620
QtFontStyle::Key styleKey, int pixelSize, char pitch,
621
QtFontFoundry **best_foundry, QtFontStyle **best_style,
622
QtFontSize **best_size
624
, QtFontEncoding **best_encoding, int force_encoding_id
631
FM_DEBUG(" REMARK: looking for best foundry for family '%s' [%d]", family->name.toLatin1().constData(), family->count);
633
for (int x = 0; x < family->count; ++x) {
634
QtFontFoundry *foundry = family->foundries[x];
635
if (! foundry_name.isEmpty() &&
636
ucstricmp(foundry->name, foundry_name) != 0)
639
FM_DEBUG(" looking for matching style in foundry '%s' %d",
640
foundry->name.isEmpty() ? "-- none --" : foundry->name.toLatin1().constData(), foundry->count);
642
QtFontStyle *style = bestStyle(foundry, styleKey);
644
if (! style->smoothScalable && (styleStrategy & QFont::ForceOutline)) {
645
FM_DEBUG(" ForceOutline set, but not smoothly scalable");
650
QtFontSize *size = 0;
652
// 1. see if we have an exact matching size
653
if (! (styleStrategy & QFont::ForceOutline)) {
654
size = style->pixelSize(pixelSize);
656
FM_DEBUG(" found exact size match (%d pixels)", size->pixelSize);
657
px = size->pixelSize;
661
// 2. see if we have a smoothly scalable font
662
if (! size && style->smoothScalable && ! (styleStrategy & QFont::PreferBitmap)) {
663
size = style->pixelSize(SMOOTH_SCALABLE);
665
FM_DEBUG(" found smoothly scalable font (%d pixels)", pixelSize);
670
// 3. see if we have a bitmap scalable font
671
if (! size && style->bitmapScalable && (styleStrategy & QFont::PreferMatch)) {
672
size = style->pixelSize(0);
674
FM_DEBUG(" found bitmap scalable font (%d pixels)", pixelSize);
680
QtFontEncoding *encoding = 0;
683
// 4. find closest size match
685
unsigned int distance = ~0u;
686
for (int x = 0; x < style->count; ++x) {
689
findEncoding(script, styleStrategy, style->pixelSizes + x, force_encoding_id);
691
FM_DEBUG(" size %3d does not support the script we want",
692
style->pixelSizes[x].pixelSize);
698
if (style->pixelSizes[x].pixelSize < pixelSize) {
699
// penalize sizes that are smaller than the
700
// requested size, due to truncation from floating
701
// point to integer conversions
702
d = pixelSize - style->pixelSizes[x].pixelSize + 1;
704
d = style->pixelSizes[x].pixelSize - pixelSize;
709
size = style->pixelSizes + x;
710
FM_DEBUG(" best size so far: %3d (%d)", size->pixelSize, pixelSize);
715
FM_DEBUG(" no size supports the script we want");
719
if (style->bitmapScalable && ! (styleStrategy & QFont::PreferQuality) &&
720
(distance * 10 / pixelSize) >= 2) {
721
// the closest size is not close enough, go ahead and
722
// use a bitmap scaled font
723
size = style->pixelSize(0);
726
px = size->pixelSize;
732
encoding = findEncoding(script, styleStrategy, size, force_encoding_id);
733
if (!encoding) size = 0;
736
FM_DEBUG(" foundry doesn't support the script we want");
741
unsigned int this_score = 0x0000;
743
PitchMismatch = 0x4000,
744
StyleMismatch = 0x2000,
745
BitmapScaledPenalty = 0x1000,
746
EncodingMismatch = 0x0002,
750
if (encoding->encoding != -1) {
751
this_score += XLFDPenalty;
752
if (encoding->encoding != QFontPrivate::defaultEncodingID)
753
this_score += EncodingMismatch;
756
if (!(pitch == 'm' && encoding->pitch == 'c') && pitch != encoding->pitch)
757
this_score += PitchMismatch;
761
#if defined(Q_OS_MAC) && !defined(QWS)
762
qt_mac_get_fixed_pitch(const_cast<QtFontFamily*>(family));
764
if ((pitch == 'm' && !family->fixedPitch)
765
|| (pitch == 'p' && family->fixedPitch))
766
this_score += PitchMismatch;
769
if (styleKey != style->key)
770
this_score += StyleMismatch;
771
if (!style->smoothScalable && px != size->pixelSize) // bitmap scaled
772
this_score += BitmapScaledPenalty;
773
if (px != pixelSize) // close, but not exact, size match
774
this_score += qAbs(px - pixelSize);
776
if (this_score < score) {
777
FM_DEBUG(" found a match: score %x best score so far %x",
781
*best_foundry = foundry;
785
*best_encoding = encoding;
788
FM_DEBUG(" score %x no better than best %x", this_score, score);
799
QFontDatabase::findFont(int script, const QFontPrivate *fp,
800
const QFontDef &request, int
807
Q_UNUSED(force_encoding_id);
810
if (!privateDb()->count)
816
fe = loadEngine(script, fp, request, 0, 0, 0
825
// if we fail to load the rawmode font, use a 12pixel box engine instead
826
if (! fe) fe = new QFontEngineBox(12);
830
QFontCache::Key key(request, script
831
#if defined(Q_WS_X11)
835
fe = QFontCache::instance->findEngine(key);
840
QString family_name, foundry_name;
841
QtFontStyle::Key styleKey;
842
styleKey.style = request.style;
843
styleKey.weight = request.weight;
844
styleKey.stretch = request.stretch;
845
char pitch = request.ignorePitch ? '*' : request.fixedPitch ? 'm' : 'p';
847
parseFontName(request.family, foundry_name, family_name);
849
FM_DEBUG("QFontDatabase::findFont\n"
851
" family: %s [%s], script: %d\n"
852
" weight: %d, style: %d\n"
856
family_name.isEmpty() ? "-- first in script --" : family_name.toLatin1().constData(),
857
foundry_name.isEmpty() ? "-- any --" : foundry_name.toLatin1().constData(),
858
script, request.weight, request.style, request.stretch, request.pixelSize, pitch);
859
#if defined(FONT_MATCH_DEBUG) && defined(Q_WS_X11)
860
if (force_encoding_id >= 0) {
861
FM_DEBUG(" required encoding: %d", force_encoding_id);
865
if (qt_enable_test_font && request.family == QLatin1String("__Qt__Box__Engine__")) {
866
fe = new QTestFontEngine(request.pixelSize);
867
fe->fontDef = request;
872
QtFontFamily *best_family = 0;
873
QtFontFoundry *best_foundry = 0;
874
QtFontStyle *best_style = 0;
875
QtFontSize *best_size = 0;
877
QtFontEncoding *best_encoding = 0;
880
unsigned int score = ~0u;
882
load(family_name, script);
884
QFontDatabasePrivate *db = privateDb();
885
for (int x = 0; x < db->count; ++x) {
886
QtFontFamily *try_family = db->families[x];
888
if (!family_name.isEmpty()
889
&& ucstricmp(try_family->name, family_name) != 0
891
&& ucstricmp(try_family->english_name, family_name) != 0
896
if (family_name.isEmpty())
897
load(try_family->name, script);
899
uint score_adjust = 0;
901
bool supported = false;
902
for (int ws = 1; !supported && ws < WritingSystemsCount; ++ws) {
903
if (scriptForWritingSystem[ws] != script)
905
if (try_family->writingSystems[ws] & QtFontFamily::Supported)
909
// family not supported in the script we want
913
QtFontFoundry *try_foundry = 0;
914
QtFontStyle *try_style = 0;
915
QtFontSize *try_size = 0;
917
QtFontEncoding *try_encoding = 0;
920
// as we know the script is supported, we can be sure
921
// to find a matching font here.
922
unsigned int newscore =
923
bestFoundry(script, score, request.styleStrategy,
924
try_family, foundry_name, styleKey, request.pixelSize, pitch,
925
&try_foundry, &try_style, &try_size
927
, &try_encoding, force_encoding_id
930
if (try_foundry == 0) {
931
// the specific foundry was not found, so look for
932
// any foundry matching our requirements
933
newscore = bestFoundry(script, score, request.styleStrategy, try_family,
934
QString(), styleKey, request.pixelSize,
935
pitch, &try_foundry, &try_style, &try_size
937
, &try_encoding, force_encoding_id
941
newscore += score_adjust;
943
if (newscore < score) {
945
best_family = try_family;
946
best_foundry = try_foundry;
947
best_style = try_style;
948
best_size = try_size;
950
best_encoding = try_encoding;
953
if (newscore < 10) // xlfd instead of FT... just accept it
957
if (best_family != 0 && best_foundry != 0 && best_style != 0
959
&& best_size != 0 && best_encoding != 0
964
" weight: %d, style: %d\n"
969
best_family->name.toLatin1().constData(),
970
best_foundry->name.isEmpty() ? "-- none --" : best_foundry->name.toLatin1().constData(),
971
best_style->key.weight, best_style->key.style,
972
best_style->key.stretch, best_size ? best_size->pixelSize : 0xffff,
974
best_encoding->pitch, best_encoding->encoding
980
fe = loadEngine(script, fp, request, best_family, best_foundry, best_style
982
, best_size, best_encoding, (force_encoding_id >= 0)
989
FM_DEBUG(" NO MATCH FOUND\n");
992
fe->fontDef.family = best_family->name;
993
if (! best_foundry->name.isEmpty()) {
994
fe->fontDef.family += QString::fromLatin1(" [");
995
fe->fontDef.family += best_foundry->name;
996
fe->fontDef.family += QString::fromLatin1("]");
999
if (best_style->smoothScalable)
1000
fe->fontDef.pixelSize = request.pixelSize;
1001
else if ((best_style->bitmapScalable && (request.styleStrategy & QFont::PreferMatch)))
1002
fe->fontDef.pixelSize = request.pixelSize;
1004
fe->fontDef.pixelSize = best_size->pixelSize;
1006
fe->fontDef.styleHint = request.styleHint;
1007
fe->fontDef.styleStrategy = request.styleStrategy;
1009
fe->fontDef.weight = best_style->key.weight;
1010
fe->fontDef.style = best_style->key.style;
1011
fe->fontDef.fixedPitch = best_family->fixedPitch;
1012
fe->fontDef.stretch = best_style->key.stretch;
1013
fe->fontDef.ignorePitch = false;
1019
QFontDef def = request;
1020
if (def.family.isEmpty()) {
1021
def.family = fp->request.family;
1022
def.family = def.family.left(def.family.indexOf(','));
1024
QFontCache::Key key(def, script
1025
#if defined(Q_WS_X11)
1029
QFontCache::instance->insertEngine(key, fe);
1032
#if defined(Q_WS_X11) && !defined(QT_NO_FONTCONFIG)
1033
if (scriptRequiresOpenType(script)) {
1034
QOpenType *ot = fe->openType();
1035
if (!ot || !ot->supportsScript(script)) {
1036
FM_DEBUG(" OpenType support missing for script");
1044
if (!request.family.isEmpty())
1047
FM_DEBUG("returning box engine");
1049
fe = new QFontEngineBox(request.pixelSize);
1052
QFontCache::Key key(request, script
1053
#if defined(Q_WS_X11)
1057
QFontCache::instance->insertEngine(key, fe);
1062
#if defined(Q_WS_X11)
1063
fe->fontDef.pointSize = qt_pointSize(fe->fontDef.pixelSize, fp->dpi);
1064
#elif defined(Q_WS_WIN)
1065
fe->fontDef.pointSize = qreal(fe->fontDef.pixelSize) * 72.0
1066
/ GetDeviceCaps(shared_dc,LOGPIXELSY);
1067
#elif defined(Q_WS_MAC)
1068
fe->fontDef.pointSize = qt_mac_pointsize(fe->fontDef, fp->dpi);
1070
fe->fontDef.pointSize = qreal(fe->fontDef.pixelSize); //####int(double(fe->fontDef.pixelSize) * 72.0 / 96.0);
1073
fe->fontDef.pointSize = request.pointSize;
1080
static QString styleString(int weight, QFont::Style style)
1083
if (weight >= QFont::Black)
1085
else if (weight >= QFont::Bold)
1087
else if (weight >= QFont::DemiBold)
1088
result = "Demi Bold";
1089
else if (weight < QFont::Normal)
1092
if (style == QFont::StyleItalic)
1093
result += " Italic";
1094
else if (style == QFont::StyleOblique)
1095
result += " Oblique";
1097
if (result.isEmpty())
1100
return result.simplified();
1104
Returns a string that describes the style of the font \a f. For
1105
example, "Bold Italic", "Bold", "Italic" or "Normal". An empty
1106
string may be returned.
1108
QString QFontDatabase::styleString(const QFont &f)
1110
return ::styleString(f.weight(), f.style());
1115
\class QFontDatabase qfontdatabase.h
1116
\brief The QFontDatabase class provides information about the fonts available in the underlying window system.
1118
\ingroup environment
1121
The most common uses of this class are to query the database for
1122
the list of font families() and for the pointSizes() and styles()
1123
that are available for each family. An alternative to pointSizes()
1124
is smoothSizes() which returns the sizes at which a given family
1125
and style will look attractive.
1127
If the font family is available from two or more foundries the
1128
foundry name is included in the family name, e.g. "Helvetica
1129
[Adobe]" and "Helvetica [Cronyx]". When you specify a family you
1130
can either use the old hyphenated Qt 2.x "foundry-family" format,
1131
e.g. "Cronyx-Helvetica", or the new bracketed Qt 3.x "family
1132
[foundry]" format e.g. "Helvetica [Cronyx]". If the family has a
1133
foundry it is always returned, e.g. by families(), using the
1136
The font() function returns a QFont given a family, style and
1139
A family and style combination can be checked to see if it is
1140
italic() or bold(), and to retrieve its weight(). Similarly we can
1141
call isBitmapScalable(), isSmoothlyScalable(), isScalable() and
1144
Use the styleString() to obtain a text version of a style.
1146
The QFontDatabase class also supports some static functions, for
1147
example, standardSizes(). You can retrieve the description of a
1148
writing system using writingSystemName(), and a sample of
1149
characters in a writing system with writingSystemSample().
1153
#include <qapplication.h>
1154
#include <qfontdatabase.h>
1156
int main(int argc, char **argv)
1158
QApplication app(argc, argv);
1160
QStringList families = fdb.families();
1161
for (QStringList::Iterator f = families.begin(); f != families.end(); ++f) {
1162
QString family = *f;
1164
QStringList styles = fdb.styles(family);
1165
for (QStringList::Iterator s = styles.begin(); s != styles.end(); ++s) {
1167
QString dstyle = "\t" + style + " (";
1168
QList<int> smoothies = fdb.smoothSizes(family, style);
1169
for (QList<int>::Iterator points = smoothies.begin();
1170
points != smoothies.end(); ++points) {
1171
dstyle += QString::number(*points) + " ";
1173
dstyle = dstyle.left(dstyle.length() - 1) + ")";
1180
This example gets the list of font families, then the list of
1181
styles for each family and the point sizes that are available for
1182
each family/style combination.
1186
Creates a font database object.
1188
QFontDatabase::QFontDatabase()
1196
\enum QFontDatabase::WritingSystem
1223
\value SimplifiedChinese
1224
\value TraditionalChinese
1230
\omitvalue WritingSystemsCount
1234
Returns a sorted list of the available writing systems. This is
1235
list generated from information about all installed fonts on the
1240
QList<QFontDatabase::WritingSystem> QFontDatabase::writingSystems() const
1244
QList<WritingSystem> list;
1245
for (int i = 0; i < d->count; ++i) {
1246
QtFontFamily *family = d->families[i];
1247
if (family->count == 0)
1249
for (int x = Latin; x < WritingSystemsCount; ++x) {
1250
const WritingSystem writingSystem = WritingSystem(x);
1251
if (!family->writingSystems[writingSystem])
1253
if (!list.contains(writingSystem))
1254
list.append(writingSystem);
1263
Returns a sorted list of the available font families which support
1264
the \a writingSystem.
1266
If a family exists in several foundries, the returned name for
1267
that font is in the form "family [foundry]". Examples: "Times
1268
[Adobe]", "Times [Cronyx]", "Palatino".
1270
\sa writingSystems()
1272
QStringList QFontDatabase::families(WritingSystem writingSystem) const
1277
for (int i = 0; i < d->count; i++) {
1278
QtFontFamily *f = d->families[i];
1281
if (writingSystem != Any && (f->writingSystems[writingSystem] != QtFontFamily::Supported))
1283
if (f->count == 1) {
1284
flist.append(f->name);
1286
for (int j = 0; j < f->count; j++) {
1287
QString str = f->name;
1288
QString foundry = f->foundries[j]->name;
1289
if (!foundry.isEmpty()) {
1302
Returns a list of the styles available for the font family \a
1303
family. Some example styles: "Light", "Light Italic", "Bold",
1304
"Oblique", "Demi". The list may be empty.
1308
QStringList QFontDatabase::styles(const QString &family) const
1310
QString familyName, foundryName;
1311
parseFontName(family, foundryName, familyName);
1316
QtFontFamily *f = d->family(familyName);
1320
QtFontFoundry allStyles(foundryName);
1321
for (int j = 0; j < f->count; j++) {
1322
QtFontFoundry *foundry = f->foundries[j];
1323
if (foundryName.isEmpty() || ucstricmp(foundry->name, foundryName) == 0) {
1324
for (int k = 0; k < foundry->count; k++) {
1325
QtFontStyle::Key ke(foundry->styles[k]->key);
1327
allStyles.style(ke, true);
1332
for (int i = 0; i < allStyles.count; i++)
1333
l.append(::styleString(allStyles.styles[i]->key.weight, (QFont::Style)allStyles.styles[i]->key.style));
1338
Returns true if the font that has family \a family and style \a
1339
style is fixed pitch; otherwise returns false.
1342
bool QFontDatabase::isFixedPitch(const QString &family,
1343
const QString &style) const
1347
QString familyName, foundryName;
1348
parseFontName(family, foundryName, familyName);
1352
QtFontFamily *f = d->family(familyName);
1353
#if defined(Q_OS_MAC) && !defined(QWS)
1354
qt_mac_get_fixed_pitch(f);
1356
return (f && f->fixedPitch);
1360
Returns true if the font that has family \a family and style \a
1361
style is a scalable bitmap font; otherwise returns false. Scaling
1362
a bitmap font usually produces an unattractive hardly readable
1363
result, because the pixels of the font are scaled. If you need to
1364
scale a bitmap font it is better to scale it to one of the fixed
1365
sizes returned by smoothSizes().
1367
\sa isScalable(), isSmoothlyScalable()
1369
bool QFontDatabase::isBitmapScalable(const QString &family,
1370
const QString &style) const
1372
bool bitmapScalable = false;
1373
QString familyName, foundryName;
1374
parseFontName(family, foundryName, familyName);
1378
QtFontStyle::Key styleKey(style);
1380
QtFontFamily *f = d->family(familyName);
1381
if (!f) return bitmapScalable;
1383
for (int j = 0; j < f->count; j++) {
1384
QtFontFoundry *foundry = f->foundries[j];
1385
if (foundryName.isEmpty() || ucstricmp(foundry->name, foundryName) == 0) {
1386
for (int k = 0; k < foundry->count; k++)
1387
if ((style.isEmpty() || foundry->styles[k]->key == styleKey)
1388
&& foundry->styles[k]->bitmapScalable && !foundry->styles[k]->smoothScalable) {
1389
bitmapScalable = true;
1395
return bitmapScalable;
1400
Returns true if the font that has family \a family and style \a
1401
style is smoothly scalable; otherwise returns false. If this
1402
function returns true, it's safe to scale this font to any size,
1403
and the result will always look attractive.
1405
\sa isScalable(), isBitmapScalable()
1407
bool QFontDatabase::isSmoothlyScalable(const QString &family,
1408
const QString &style) const
1410
bool smoothScalable = false;
1411
QString familyName, foundryName;
1412
parseFontName(family, foundryName, familyName);
1416
QtFontStyle::Key styleKey(style);
1418
QtFontFamily *f = d->family(familyName);
1419
if (!f) return smoothScalable;
1421
for (int j = 0; j < f->count; j++) {
1422
QtFontFoundry *foundry = f->foundries[j];
1423
if (foundryName.isEmpty() || ucstricmp(foundry->name, foundryName) == 0) {
1424
for (int k = 0; k < foundry->count; k++)
1425
if ((style.isEmpty() || foundry->styles[k]->key == styleKey) && foundry->styles[k]->smoothScalable) {
1426
smoothScalable = true;
1432
return smoothScalable;
1436
Returns true if the font that has family \a family and style \a
1437
style is scalable; otherwise returns false.
1439
\sa isBitmapScalable(), isSmoothlyScalable()
1441
bool QFontDatabase::isScalable(const QString &family,
1442
const QString &style) const
1444
if (isSmoothlyScalable(family, style))
1447
return isBitmapScalable(family, style);
1452
Returns a list of the point sizes available for the font that has
1453
family \a family and style \a style. The list may be empty.
1455
\sa smoothSizes(), standardSizes()
1457
QList<int> QFontDatabase::pointSizes(const QString &family,
1458
const QString &style)
1460
#if defined(Q_WS_WIN) || defined(Q_WS_MAC)
1461
// windows and macosx are always smoothly scalable
1464
return standardSizes();
1466
bool smoothScalable = false;
1467
QString familyName, foundryName;
1468
parseFontName(family, foundryName, familyName);
1472
QtFontStyle::Key styleKey(style);
1476
QtFontFamily *fam = d->family(familyName);
1477
if (!fam) return sizes;
1481
int dpi = QX11Info::appDpiY();
1483
const int dpi = 72; // embedded
1486
for (int j = 0; j < fam->count; j++) {
1487
QtFontFoundry *foundry = fam->foundries[j];
1488
if (foundryName.isEmpty() || ucstricmp(foundry->name, foundryName) == 0) {
1489
QtFontStyle *style = foundry->style(styleKey);
1490
if (!style) continue;
1492
if (style->smoothScalable) {
1493
smoothScalable = true;
1496
for (int l = 0; l < style->count; l++) {
1497
const QtFontSize *size = style->pixelSizes + l;
1499
if (size->pixelSize != 0 && size->pixelSize != USHRT_MAX) {
1500
const uint pointSize = qRound(size->pixelSize * dpi / 72.);
1501
if (! sizes.contains(pointSize))
1502
sizes.append(pointSize);
1509
return standardSizes();
1517
Returns a QFont object that has family \a family, style \a style
1518
and point size \a pointSize. If no matching font could be created,
1519
a QFont object that uses the application's default font is
1522
QFont QFontDatabase::font(const QString &family, const QString &style,
1523
int pointSize) const
1525
QString familyName, foundryName;
1526
parseFontName(family, foundryName, familyName);
1530
QtFontFoundry allStyles(foundryName);
1531
QtFontFamily *f = d->family(familyName);
1532
if (!f) return QApplication::font();
1534
for (int j = 0; j < f->count; j++) {
1535
QtFontFoundry *foundry = f->foundries[j];
1536
if (foundryName.isEmpty() || ucstricmp(foundry->name, foundryName) == 0) {
1537
for (int k = 0; k < foundry->count; k++)
1538
allStyles.style(foundry->styles[k]->key, true);
1542
QtFontStyle::Key styleKey(style);
1543
QtFontStyle *s = bestStyle(&allStyles, styleKey);
1545
if (!s) // no styles found?
1546
return QApplication::font();
1547
QFont fnt(family, pointSize, s->key.weight);
1548
fnt.setStyle((QFont::Style)s->key.style);
1554
Returns the point sizes of a font that has family \a family and
1555
style \a style that will look attractive. The list may be empty.
1556
For non-scalable fonts and bitmap scalable fonts, this function
1557
is equivalent to pointSizes().
1559
\sa pointSizes(), standardSizes()
1561
QList<int> QFontDatabase::smoothSizes(const QString &family,
1562
const QString &style)
1567
return QFontDatabase::standardSizes();
1569
bool smoothScalable = false;
1570
QString familyName, foundryName;
1571
parseFontName(family, foundryName, familyName);
1575
QtFontStyle::Key styleKey(style);
1579
QtFontFamily *fam = d->family(familyName);
1584
int dpi = QX11Info::appDpiY();
1586
const int dpi = 72; // embedded
1588
for (int j = 0; j < fam->count; j++) {
1589
QtFontFoundry *foundry = fam->foundries[j];
1590
if (foundryName.isEmpty() ||
1591
ucstricmp(foundry->name, foundryName) == 0) {
1592
QtFontStyle *style = foundry->style(styleKey);
1593
if (!style) continue;
1595
if (style->smoothScalable) {
1596
smoothScalable = true;
1599
for (int l = 0; l < style->count; l++) {
1600
const QtFontSize *size = style->pixelSizes + l;
1602
if (size->pixelSize != 0 && size->pixelSize != USHRT_MAX) {
1603
const uint pointSize = qRound(size->pixelSize * dpi / 72.);
1604
if (! sizes.contains(pointSize))
1605
sizes.append(pointSize);
1612
return QFontDatabase::standardSizes();
1621
Returns a list of standard font sizes.
1623
\sa smoothSizes(), pointSizes()
1625
QList<int> QFontDatabase::standardSizes()
1628
static const unsigned short standard[] =
1629
{ 6, 7, 8, 9, 10, 11, 12, 14, 16, 18, 20, 22, 24, 26, 28, 36, 48, 72, 0 };
1630
const unsigned short *sizes = standard;
1631
while (*sizes) ret << *sizes++;
1637
Returns true if the font that has family \a family and style \a
1638
style is italic; otherwise returns false.
1640
\sa weight(), bold()
1642
bool QFontDatabase::italic(const QString &family, const QString &style) const
1644
QString familyName, foundryName;
1645
parseFontName(family, foundryName, familyName);
1649
QtFontFoundry allStyles(foundryName);
1650
QtFontFamily *f = d->family(familyName);
1651
if (!f) return false;
1653
for (int j = 0; j < f->count; j++) {
1654
QtFontFoundry *foundry = f->foundries[j];
1655
if (foundryName.isEmpty() || ucstricmp(foundry->name, foundryName) == 0) {
1656
for (int k = 0; k < foundry->count; k++)
1657
allStyles.style(foundry->styles[k]->key, true);
1661
QtFontStyle::Key styleKey(style);
1662
QtFontStyle *s = allStyles.style(styleKey);
1663
return s && s->key.style == QFont::StyleItalic;
1668
Returns true if the font that has family \a family and style \a
1669
style is bold; otherwise returns false.
1671
\sa italic(), weight()
1673
bool QFontDatabase::bold(const QString &family,
1674
const QString &style) const
1676
QString familyName, foundryName;
1677
parseFontName(family, foundryName, familyName);
1681
QtFontFoundry allStyles(foundryName);
1682
QtFontFamily *f = d->family(familyName);
1683
if (!f) return false;
1685
for (int j = 0; j < f->count; j++) {
1686
QtFontFoundry *foundry = f->foundries[j];
1687
if (foundryName.isEmpty() ||
1688
ucstricmp(foundry->name, foundryName) == 0) {
1689
for (int k = 0; k < foundry->count; k++)
1690
allStyles.style(foundry->styles[k]->key, true);
1694
QtFontStyle::Key styleKey(style);
1695
QtFontStyle *s = allStyles.style(styleKey);
1696
return s && s->key.weight >= QFont::Bold;
1701
Returns the weight of the font that has family \a family and style
1702
\a style. If there is no such family and style combination,
1705
\sa italic(), bold()
1707
int QFontDatabase::weight(const QString &family,
1708
const QString &style) const
1710
QString familyName, foundryName;
1711
parseFontName(family, foundryName, familyName);
1715
QtFontFoundry allStyles(foundryName);
1716
QtFontFamily *f = d->family(familyName);
1719
for (int j = 0; j < f->count; j++) {
1720
QtFontFoundry *foundry = f->foundries[j];
1721
if (foundryName.isEmpty() ||
1722
ucstricmp(foundry->name, foundryName) == 0) {
1723
for (int k = 0; k < foundry->count; k++)
1724
allStyles.style(foundry->styles[k]->key, true);
1728
QtFontStyle::Key styleKey(style);
1729
QtFontStyle *s = allStyles.style(styleKey);
1730
return s ? s->key.weight : -1;
1735
Returns the names the \a writingSystem (e.g. for displaying to the
1738
QString QFontDatabase::writingSystemName(WritingSystem writingSystem)
1740
const char *name = 0;
1741
switch (writingSystem) {
1770
name = "Devanagari";
1817
case SimplifiedChinese:
1818
name = "Simplified Chinese";
1820
case TraditionalChinese:
1821
name = "Traditional Chinese";
1830
name = "Vietnamese";
1836
Q_ASSERT_X(false, "QFontDatabase::writingSystemName", "invalid 'writingSystem' parameter");
1839
return qApp ? qApp->translate("QFont", name) : QString::fromLatin1(name);
1844
Returns a string with sample characters from \a writingSystem.
1846
QString QFontDatabase::writingSystemSample(WritingSystem writingSystem)
1848
QString sample = QString::fromLatin1("AaBb");
1849
switch (writingSystem) {
1852
// show only ascii characters
1856
// This is cheating... we only show latin-1 characters so that we don't
1857
// end up loading lots of fonts - at least on X11...
1858
sample += QChar(0x00C3);
1859
sample += QChar(0x00E1);
1863
sample += QChar(0x0393);
1864
sample += QChar(0x03B1);
1865
sample += QChar(0x03A9);
1866
sample += QChar(0x03C9);
1869
sample += QChar(0x0414);
1870
sample += QChar(0x0434);
1871
sample += QChar(0x0436);
1872
sample += QChar(0x0402);
1875
sample += QChar(0x053f);
1876
sample += QChar(0x054f);
1877
sample += QChar(0x056f);
1878
sample += QChar(0x057f);
1881
sample += QChar(0x05D0);
1882
sample += QChar(0x05D1);
1883
sample += QChar(0x05D2);
1884
sample += QChar(0x05D3);
1887
sample += QChar(0x0628);
1888
sample += QChar(0x0629);
1889
sample += QChar(0x062A);
1890
sample += QChar(0x063A);
1893
sample += QChar(0x0715);
1894
sample += QChar(0x0725);
1895
sample += QChar(0x0716);
1896
sample += QChar(0x0726);
1899
sample += QChar(0x0784);
1900
sample += QChar(0x0794);
1901
sample += QChar(0x078c);
1902
sample += QChar(0x078d);
1905
sample += QChar(0x0905);
1906
sample += QChar(0x0915);
1907
sample += QChar(0x0925);
1908
sample += QChar(0x0935);
1911
sample += QChar(0x0986);
1912
sample += QChar(0x0996);
1913
sample += QChar(0x09a6);
1914
sample += QChar(0x09b6);
1917
sample += QChar(0x0a05);
1918
sample += QChar(0x0a15);
1919
sample += QChar(0x0a25);
1920
sample += QChar(0x0a35);
1923
sample += QChar(0x0a85);
1924
sample += QChar(0x0a95);
1925
sample += QChar(0x0aa5);
1926
sample += QChar(0x0ab5);
1929
sample += QChar(0x0b06);
1930
sample += QChar(0x0b16);
1931
sample += QChar(0x0b2b);
1932
sample += QChar(0x0b36);
1935
sample += QChar(0x0b89);
1936
sample += QChar(0x0b99);
1937
sample += QChar(0x0ba9);
1938
sample += QChar(0x0bb9);
1941
sample += QChar(0x0c05);
1942
sample += QChar(0x0c15);
1943
sample += QChar(0x0c25);
1944
sample += QChar(0x0c35);
1947
sample += QChar(0x0c85);
1948
sample += QChar(0x0c95);
1949
sample += QChar(0x0ca5);
1950
sample += QChar(0x0cb5);
1953
sample += QChar(0x0d05);
1954
sample += QChar(0x0d15);
1955
sample += QChar(0x0d25);
1956
sample += QChar(0x0d35);
1959
sample += QChar(0x0d90);
1960
sample += QChar(0x0da0);
1961
sample += QChar(0x0db0);
1962
sample += QChar(0x0dc0);
1965
sample += QChar(0x0e02);
1966
sample += QChar(0x0e12);
1967
sample += QChar(0x0e22);
1968
sample += QChar(0x0e32);
1971
sample += QChar(0x0e8d);
1972
sample += QChar(0x0e9d);
1973
sample += QChar(0x0ead);
1974
sample += QChar(0x0ebd);
1977
sample += QChar(0x0f00);
1978
sample += QChar(0x0f01);
1979
sample += QChar(0x0f02);
1980
sample += QChar(0x0f03);
1983
sample += QChar(0x1000);
1984
sample += QChar(0x1001);
1985
sample += QChar(0x1002);
1986
sample += QChar(0x1003);
1989
sample += QChar(0x10a0);
1990
sample += QChar(0x10b0);
1991
sample += QChar(0x10c0);
1992
sample += QChar(0x10d0);
1995
sample += QChar(0x1780);
1996
sample += QChar(0x1790);
1997
sample += QChar(0x17b0);
1998
sample += QChar(0x17c0);
2000
case SimplifiedChinese:
2001
sample += QChar(0x3105);
2002
sample += QChar(0x3115);
2003
sample += QChar(0x3125);
2004
sample += QChar(0x3129);
2006
case TraditionalChinese:
2009
sample += QChar(0x3050);
2010
sample += QChar(0x3060);
2011
sample += QChar(0x30b0);
2012
sample += QChar(0x30c0);
2015
sample += QChar(0xac00);
2016
sample += QChar(0xac11);
2017
sample += QChar(0xac1a);
2018
sample += QChar(0xac2f);
2034
This makes sense of the font family name:
2036
1) if the family name contains a '-' (ie. "Adobe-Courier"), then we
2037
split at the '-', and use the string as the foundry, and the string to
2038
the right as the family
2040
2) if the family name contains a '[' and a ']', then we take the text
2041
between the square brackets as the foundry, and the text before the
2042
square brackets as the family (ie. "Arial [Monotype]")
2044
void QFontDatabase::parseFontName(const QString &name, QString &foundry, QString &family)
2046
if (name.contains('-')) {
2047
int i = name.indexOf('-');
2048
foundry = name.left(i);
2049
family = name.right(name.length() - i - 1);
2050
} else if (name.contains('[') && name.contains(']')) {
2051
int i = name.indexOf('[');
2052
int li = name.lastIndexOf(']');
2055
foundry = name.mid(i + 1, li - i - 1);
2056
if (name[i - 1] == ' ')
2058
family = name.left(i);
2065
// capitalize the family/foundry names
2067
QChar *s = family.data();
2068
int len = family.length();
2070
if (space) *s = s->toUpper();
2071
space = s->isSpace();
2076
len = foundry.length();
2078
if (space) *s = s->toUpper();
2079
space = s->isSpace();
2084
void QFontDatabase::createDatabase()
2087
#endif // QT_NO_FONTDATABASE