43 #include <QtCore/qsettings.h> 46 #include "qplatformdefs.h" 48 #include <QtGui/private/qapplication_p.h> 49 #include <QtGui/qplatformfontdatabase_qpa.h> 51 #include <QtCore/qmath.h> 62 styleKey.
style = style;
80 size->handle = handle;
85 QStringList retList = QApplicationPrivate::platformIntegration()->fontDatabase()->fallbacksForFamily(family,style,styleHint,script);
89 for (i = retList.
begin(); i != retList.
end(); ++i) {
90 bool contains =
false;
91 for (
int j = 0; j < db->
count; j++) {
114 QApplicationPrivate::platformIntegration()->fontDatabase()->populateFontDatabase();
125 #ifndef QT_NO_SETTINGS 131 for (
int i = 0; i < db->
count; ++i) {
140 #endif // QT_NO_SETTINGS 145 if (!privateDb()->count)
189 if (family && !family->askedForFallback) {
196 family->askedForFallback =
true;
199 QStringList fallbacks = privateDb()->fallbackFamilies;
213 fnt->
families = QApplicationPrivate::platformIntegration()->fontDatabase()->addApplicationFont(fnt->
data,fnt->
fileName);
260 const int force_encoding_id = -1;
262 if (!privateDb()->count)
269 qDebug() <<
"Cache hit level 1";
273 QString family_name, foundry_name;
283 match(script, request, family_name, foundry_name, force_encoding_id, &desc);
291 initFontDef(desc, request, &engine->
fontDef);
305 for (
int i = 0; i < fallbacks.
size(); i++) {
318 initFontDef(desc, def, &engine->
fontDef);
331 if (fp && fp->
dpi > 0) {
374 if (! family_list.
contains(defaultFamily))
375 family_list << defaultFamily;
383 for (; !fe && it !=
end; ++
it) {
static bool removeAllApplicationFonts()
Removes all application-local fonts previously added using addApplicationFont() and addApplicationFon...
QVariant value(const QString &key, const QVariant &defaultValue=QVariant()) const
Returns the value for setting key.
#define QT_END_NAMESPACE
This macro expands to.
static void initializeDb()
QtFontStyle * style(const QtFontStyle::Key &, const QString &=QString(), bool=false)
#define it(className, varName)
The QSettings class provides persistent platform-independent application settings.
iterator begin()
Returns an STL-style iterator pointing to the first item in the list.
void insertEngine(const Key &key, QFontEngine *engine)
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.
QStringList fallbackFamilies
bool ref()
Atomically increments the value of this QAtomicInt.
static void parseFontName(const QString &name, QString &foundry, QString &family)
The QString class provides a Unicode character string.
static void load(const QFontPrivate *d, int script)
Loads a QFontEngine for the specified script that matches the QFontDef request member variable...
virtual Type type() const =0
bool supported(QFontDatabase::WritingSystem) const
Returns true if the writing system given by writingSystem is supported; otherwise returns false...
bool isEmpty() const
Returns true if the list contains no items; otherwise returns false.
static QFontCache * instance()
static QFont font()
Returns the default application font.
Q_GUI_EXPORT void qt_registerFont(const QString &familyName, const QString &foundryname, int weight, QFont::Style style, int stretch, bool antialiased, bool scalable, int pixelSize, const QSupportedWritingSystems &writingSystems, void *handle)
Q_CORE_EXPORT void qDebug(const char *,...)
QStringList toStringList() const
Returns the variant as a QStringList if the variant has type() StringList, String ...
static void getEngineData(const QFontPrivate *d, const QFontCache::Key &key)
#define QT_BEGIN_NAMESPACE
This macro expands to.
QStringList fallbackFamilies
static QStringList familyList(const QFontDef &req)
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.
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
iterator end()
Returns an STL-style iterator pointing to the imaginary item after the last item in the list...
const T & at(int i) const
Returns the item at index position i in the list.
static QFontEngine * loadEngine(int script, const QFontDef &request, QtFontFamily *family, QtFontFoundry *foundry, QtFontStyle *style, QtFontSize *size)
The QStringList class provides a list of strings.
The QSupportedWritingSystems class is used when registering fonts with the internal Qt fontdatabase...
const char * styleHint(const QFontDef &request)
int indexOf(QChar c, int from=0, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
static bool supportsThreadedFontRendering()
Returns true if font rendering is supported outside the GUI thread, false otherwise.
The QLatin1String class provides a thin wrapper around an US-ASCII/Latin-1 encoded string literal...
QBool contains(const QString &str, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the list contains the string str; otherwise returns false.
static QFontEngine * loadSingleEngine(int script, const QFontDef &request, QtFontFoundry *foundry, QtFontStyle *style, QtFontSize *size)
void qt_applyFontDatabaseSettings(const QSettings &settings)
Style
This enum describes the different styles of glyphs that are used to display text. ...
static bool removeApplicationFont(int id)
Removes the previously loaded application font identified by id.
Q_CORE_EXPORT int QT_FASTCALL script(uint ucs4)
QtFontFamily * family(const QString &f, bool=false)
iterator erase(iterator pos)
Removes the item associated with the iterator pos from the list, and returns an iterator to the next ...
The QMutexLocker class is a convenience class that simplifies locking and unlocking mutexes...
static void load(const QString &=QString(), int=-1)
StyleHint
Style hints are used by the font matching algorithm to find an appropriate default family if a select...
unsigned char writingSystems[QFontDatabase::WritingSystemsCount]
QtFontSize * pixelSize(unsigned short size, bool=false)
QString family() const
Returns the requested font family name, i.e.
const_iterator ConstIterator
Qt-style synonym for QList::const_iterator.
int size() const
Returns the number of items in the list.
bool contains(const QString &key) const
Returns true if there exists a setting called key; returns false otherwise.
static void registerFont(QFontDatabasePrivate::ApplicationFont *fnt)
QFontEngine * findEngine(const Key &key)
QVector< ApplicationFont > applicationFonts
QtFontFoundry * foundry(const QString &f, bool=false)
static const KeyPair *const end
QFontEngineData * engineData
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
Q_DECL_CONSTEXPR int qRound(qreal d)
QFontEngine * engine(int at) const
const_iterator constEnd() const
Returns a const STL-style iterator pointing to the imaginary item after the last item in the list...
static QStringList fallbackFamilies(const QString &family, const QFont::Style &style, const QFont::StyleHint &styleHint, const QUnicodeTables::Script &script)
static QFontEngine * findFont(int script, const QFontPrivate *fp, const QFontDef &request)