Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qfont.cpp File Reference

(9928ebd26a3240c8fce6abc1bd339a6381af5e45)

#include "qfont.h"
#include "qdebug.h"
#include "qpaintdevice.h"
#include "qfontdatabase.h"
#include "qfontmetrics.h"
#include "qfontinfo.h"
#include "qpainter.h"
#include "qhash.h"
#include "qdatastream.h"
#include "qguiapplication.h"
#include "qstringlist.h"
#include "qscreen.h"
#include "qthread.h"
#include "qthreadstorage.h"
#include "qfont_p.h"
#include <private/qfontengine_p.h>
#include <private/qpainter_p.h>
#include <private/qtextengine_p.h>
#include <limits.h>
#include <qpa/qplatformscreen.h>
#include <qpa/qplatformintegration.h>
#include <qpa/qplatformfontdatabase.h>
#include <QtGui/private/qguiapplication_p.h>
#include <QtCore/QMutexLocker>
#include <QtCore/QMutex>
#include <array>
#include "moc_qfont.cpp"
+ Include dependency graph for qfont.cpp:

Go to the source code of this file.

Macros

#define FC_DEBUG   if (false) qDebug
 
#define QFONTCACHE_DECREASE_TRIGGER_LIMIT   256
 
#define QT_FONT_ENGINE_FROM_DATA(data, script)   data->engines[script]
 
#define QFONTCACHE_MIN_COST   4*1024
 
#define QFONT_DEBUG_SKIP_DEFAULT(prop)
 

Typedefs

typedef QHash< QString, QStringListQFontSubst
 

Functions

Q_GUI_EXPORT int qt_defaultDpiX ()
 
Q_GUI_EXPORT int qt_defaultDpiY ()
 
Q_GUI_EXPORT int qt_defaultDpi ()
 
static int convertWeights (int weight, bool inverted)
 
static QStringList splitIntoFamilies (const QString &family)
 
Q_GUI_EXPORT int qt_legacyToOpenTypeWeight (int weight)
 
Q_GUI_EXPORT int qt_openTypeToLegacyWeight (int weight)
 
QRecursiveMutexqt_fontdatabase_mutex ()
 
static quint8 get_font_bits (int version, const QFontPrivate *f)
 
static quint8 get_extended_font_bits (const QFontPrivate *f)
 
static void set_font_bits (int version, quint8 bits, QFontPrivate *f)
 
static void set_extended_font_bits (quint8 bits, QFontPrivate *f)
 
QStringList qt_fallbacksForFamily (const QString &family, QFont::Style style, QFont::StyleHint styleHint, QChar::Script script)
 
QDataStreamoperator<< (QDataStream &stream, QFont::Tag tag)
 
QDataStreamoperator>> (QDataStream &stream, QFont::Tag &tag)
 
QDebug operator<< (QDebug stream, const QFont &font)
 
QDebug operator<< (QDebug debug, QFont::Tag tag)
 

Variables

bool qt_is_tty_app
 
static constexpr auto fast_timeout = 10s
 
static constexpr auto slow_timeout = 5min
 
static Q_CONSTINIT QBasicAtomicInt font_cache_id = Q_BASIC_ATOMIC_INITIALIZER(0)
 

Macro Definition Documentation

◆ FC_DEBUG

◆ QFONT_DEBUG_SKIP_DEFAULT

#define QFONT_DEBUG_SKIP_DEFAULT ( prop)
Value:
if ((font.prop() == defaultFont.prop()) && stream.verbosity() == 1) \
continue;
EGLStreamKHR stream

◆ QFONTCACHE_DECREASE_TRIGGER_LIMIT

#define QFONTCACHE_DECREASE_TRIGGER_LIMIT   256

Definition at line 46 of file qfont.cpp.

Referenced by QFontCache::insertEngine(), and QFontCache::insertEngineData().

◆ QFONTCACHE_MIN_COST

#define QFONTCACHE_MIN_COST   4*1024

Definition at line 3331 of file qfont.cpp.

◆ QT_FONT_ENGINE_FROM_DATA

#define QT_FONT_ENGINE_FROM_DATA ( data,
script )   data->engines[script]

Definition at line 239 of file qfont.cpp.

Referenced by QFontPrivate::engineForScript().

Typedef Documentation

◆ QFontSubst

Definition at line 1923 of file qfont.cpp.

Function Documentation

◆ convertWeights()

static int convertWeights ( int weight,
bool inverted )
static

Definition at line 146 of file qfont.cpp.

References QFont::Black, QFont::Bold, QFont::DemiBold, dist(), QFont::ExtraBold, QFont::ExtraLight, QFont::Light, QFont::Medium, QFont::Normal, qAbs(), and QFont::Thin.

Referenced by qt_legacyToOpenTypeWeight(), and qt_openTypeToLegacyWeight().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_extended_font_bits()

static quint8 get_extended_font_bits ( const QFontPrivate * f)
static

Definition at line 2068 of file qfont.cpp.

References Q_ASSERT.

◆ get_font_bits()

static quint8 get_font_bits ( int version,
const QFontPrivate * f )
static

Definition at line 2043 of file qfont.cpp.

References Q_ASSERT, and QFont::StyleOblique.

◆ operator<<() [1/3]

QDataStream & operator<< ( QDataStream & stream,
QFont::Tag tag )

Definition at line 2935 of file qfont.cpp.

◆ operator<<() [2/3]

QDebug operator<< ( QDebug debug,
QFont::Tag tag )

Definition at line 3829 of file qfont.cpp.

◆ operator<<() [3/3]

QDebug operator<< ( QDebug stream,
const QFont & font )

Definition at line 3730 of file qfont.cpp.

References QMap< Key, T >::contains(), QFontPrivate::request, tag, QMap< Key, T >::value(), and QFontDef::variableAxisValues.

+ Here is the call graph for this function:

◆ operator>>()

QDataStream & operator>> ( QDataStream & stream,
QFont::Tag & tag )
related

Definition at line 2941 of file qfont.cpp.

◆ qt_defaultDpi()

Q_GUI_EXPORT int qt_defaultDpi ( )

◆ qt_defaultDpiX()

Q_GUI_EXPORT int qt_defaultDpiX ( )

Definition at line 110 of file qfont.cpp.

References Qt::AA_Use96Dpi, QCoreApplication::instance(), QScreen::logicalDotsPerInchX, QGuiApplication::primaryScreen, qRound(), qt_is_tty_app, and screen.

Referenced by QFakeDevice::QFakeDevice(), QStyleHelper::dpi(), QAlphaPaintEngine::flushAndInit(), QPicture::metric(), QBlittablePlatformPixmap::metric(), QRasterPlatformPixmap::metric(), QOpenGLWidget::metric(), QTextDocument::print(), and QQuickLayoutStyleInfo::spacing().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ qt_defaultDpiY()

Q_GUI_EXPORT int qt_defaultDpiY ( )

Definition at line 125 of file qfont.cpp.

References Qt::AA_Use96Dpi, QCoreApplication::instance(), QScreen::logicalDotsPerInchY, QGuiApplication::primaryScreen, qRound(), qt_is_tty_app, and screen.

Referenced by QFakeDevice::QFakeDevice(), QTextEngine::calculateTabWidth(), QAlphaPaintEngine::flushAndInit(), QPicture::metric(), QBlittablePlatformPixmap::metric(), QRasterPlatformPixmap::metric(), QOpenGLWidget::metric(), QFontDatabase::pointSizes(), QTextDocument::print(), qt_defaultDpi(), and QFontDatabase::smoothSizes().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ qt_fallbacksForFamily()

QStringList qt_fallbacksForFamily ( const QString & family,
QFont::Style style,
QFont::StyleHint styleHint,
QChar::Script script )
extern

Definition at line 696 of file qfontdatabase.cpp.

References fallbacksForFamily().

Referenced by QFont::defaultFamily(), and QFontEngineMulti::ensureFallbackFamiliesQueried().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ qt_fontdatabase_mutex()

QRecursiveMutex * qt_fontdatabase_mutex ( )
extern

Definition at line 526 of file qfontdatabase.cpp.

Referenced by QFontPrivate::engineForScript().

+ Here is the caller graph for this function:

◆ qt_legacyToOpenTypeWeight()

Q_GUI_EXPORT int qt_legacyToOpenTypeWeight ( int weight)

Definition at line 195 of file qfont.cpp.

References convertWeights().

Referenced by QFont::fromString().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ qt_openTypeToLegacyWeight()

Q_GUI_EXPORT int qt_openTypeToLegacyWeight ( int weight)

Definition at line 201 of file qfont.cpp.

References convertWeights().

+ Here is the call graph for this function:

◆ set_extended_font_bits()

static void set_extended_font_bits ( quint8 bits,
QFontPrivate * f )
static

Definition at line 2098 of file qfont.cpp.

References Q_ASSERT.

◆ set_font_bits()

static void set_font_bits ( int version,
quint8 bits,
QFontPrivate * f )
static

Definition at line 2083 of file qfont.cpp.

References Q_ASSERT, QFont::StyleItalic, QFont::StyleNormal, and QFont::StyleOblique.

◆ splitIntoFamilies()

static QStringList splitIntoFamilies ( const QString & family)
static

Definition at line 175 of file qfont.cpp.

References QList< T >::at(), QString::endsWith(), familyList(), i, QString::isEmpty(), list, QString::mid(), QString::size(), QList< T >::size(), QString::split(), QString::startsWith(), and str.

Referenced by QFont::QFont().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ fast_timeout

constexpr auto fast_timeout = 10s
staticconstexpr

Definition at line 3326 of file qfont.cpp.

◆ font_cache_id

Q_CONSTINIT QBasicAtomicInt font_cache_id = Q_BASIC_ATOMIC_INITIALIZER(0)
static

Definition at line 3356 of file qfont.cpp.

◆ qt_is_tty_app

bool qt_is_tty_app
extern

Definition at line 122 of file qguiapplication.cpp.

Referenced by qt_defaultDpiX(), and qt_defaultDpiY().

◆ slow_timeout

constexpr auto slow_timeout = 5min
staticconstexpr

Definition at line 3327 of file qfont.cpp.