7#include <QtGui/qtguiglobal.h>
8#include <QtCore/qstring.h>
9#include <QtCore/qiodevice.h>
10#include <QtCore/qglobal.h>
11#include <QtCore/qobject.h>
12#include <QtCore/qpoint.h>
13#include <QtGui/qfont.h>
14#include <QtGui/qtransform.h>
15#include <QtGui/qfontdatabase.h>
17#if !defined(QT_NO_RAWFONT)
26 enum AntialiasingType {
36 Q_DECLARE_FLAGS(LayoutFlags, LayoutFlag)
39 QRawFont(
const QString &fileName,
41 QFont::HintingPreference hintingPreference = QFont::PreferDefaultHinting);
42 QRawFont(
const QByteArray &fontData,
44 QFont::HintingPreference hintingPreference = QFont::PreferDefaultHinting);
45 QRawFont(
const QRawFont &other);
46 QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QRawFont)
47 QRawFont &operator=(
const QRawFont &other);
50 void swap(QRawFont &other)
noexcept { d.swap(other.d); }
54 bool operator==(
const QRawFont &other)
const;
55 inline bool operator!=(
const QRawFont &other)
const
56 {
return !operator==(other); }
58 int glyphCount()
const;
60 QString familyName()
const;
61 QString styleName()
const;
63 QFont::Style style()
const;
66 QList<quint32> glyphIndexesForString(
const QString &text)
const;
67 inline QList<QPointF> advancesForGlyphIndexes(
const QList<quint32> &glyphIndexes)
const;
68 inline QList<QPointF> advancesForGlyphIndexes(
const QList<quint32> &glyphIndexes,
69 LayoutFlags layoutFlags)
const;
70 bool glyphIndexesForChars(
const QChar *chars,
int numChars, quint32 *glyphIndexes,
int *numGlyphs)
const;
71 bool advancesForGlyphIndexes(
const quint32 *glyphIndexes, QPointF *advances,
int numGlyphs)
const;
72 bool advancesForGlyphIndexes(
const quint32 *glyphIndexes, QPointF *advances,
int numGlyphs, LayoutFlags layoutFlags)
const;
74 QImage alphaMapForGlyph(quint32 glyphIndex,
75 AntialiasingType antialiasingType = SubPixelAntialiasing,
76 const QTransform &transform = QTransform())
const;
77 QPainterPath pathForGlyph(quint32 glyphIndex)
const;
78 QRectF boundingRect(quint32 glyphIndex)
const;
80 void setPixelSize(qreal pixelSize);
81 qreal pixelSize()
const;
83 QFont::HintingPreference hintingPreference()
const;
86 qreal capHeight()
const;
87 qreal descent()
const;
88 qreal leading()
const;
89 qreal xHeight()
const;
90 qreal averageCharWidth()
const;
91 qreal maxCharWidth()
const;
92 qreal lineThickness()
const;
93 qreal underlinePosition()
const;
95 qreal unitsPerEm()
const;
97 QString glyphName(quint32 glyphIndex)
const;
99 void loadFromFile(
const QString &fileName,
101 QFont::HintingPreference hintingPreference);
103 void loadFromData(
const QByteArray &fontData,
105 QFont::HintingPreference hintingPreference);
107 bool supportsCharacter(uint ucs4)
const;
108 bool supportsCharacter(QChar character)
const;
109 QList<QFontDatabase::WritingSystem> supportedWritingSystems()
const;
111 QByteArray fontTable(
const char *tagName)
const;
112 QByteArray fontTable(QFont::Tag tag)
const;
114 static QRawFont fromFont(
const QFont &font,
115 QFontDatabase::WritingSystem writingSystem = QFontDatabase::Any);
118 friend class QRawFontPrivate;
119 friend class QTextLayout;
120 friend class QTextEngine;
122 QExplicitlySharedDataPointer<QRawFontPrivate> d;
127Q_DECLARE_OPERATORS_FOR_FLAGS(QRawFont::LayoutFlags)
129Q_GUI_EXPORT size_t qHash(
const QRawFont &font, size_t seed = 0)
noexcept;
131inline QList<QPointF> QRawFont::advancesForGlyphIndexes(
const QList<quint32> &glyphIndexes,
132 QRawFont::LayoutFlags layoutFlags)
const
134 QList<QPointF> advances(glyphIndexes.size());
135 if (advancesForGlyphIndexes(glyphIndexes.constData(), advances.data(),
int(glyphIndexes.size()), layoutFlags))
137 return QList<QPointF>();
140inline QList<QPointF> QRawFont::advancesForGlyphIndexes(
const QList<quint32> &glyphIndexes)
const
142 return advancesForGlyphIndexes(glyphIndexes, QRawFont::SeparateAdvances);
The QRawFont class provides access to a single physical instance of a font.
Q_STATIC_LOGGING_CATEGORY(lcAccessibilityCore, "qt.accessibility.core")
static void makeDistanceField(QDistanceFieldData *data, const QPainterPath &path, int dfScale, int offs)
int QT_DISTANCEFIELD_HIGHGLYPHCOUNT()
bool qt_fontHasNarrowOutlines(const QRawFont &f)
void fillLines(qint32 *bits, int width, int height, int upperY, int lowerY, int &lx, int ldx, int &rx, int rdx, qint32 &d, qint32 ddy, qint32 ddx)
static int QT_DISTANCEFIELD_DEFAULT_BASEFONTSIZE
static void drawPolygons(qint32 *bits, int width, int height, const QPoint *vertices, const quint32 *indices, int indexCount, qint32 value)
static int QT_DISTANCEFIELD_DEFAULT_HIGHGLYPHCOUNT
void drawRectangle(qint32 *bits, int width, int height, const QPoint *int1, const QPoint *center1, const QPoint *ext1, const QPoint *int2, const QPoint *center2, const QPoint *ext2, qint32 extValue)
void fillLine(qint32 *, int, int, int, qint32, qint32)
static int QT_DISTANCEFIELD_DEFAULT_RADIUS
bool qt_fontHasNarrowOutlines(QFontEngine *fontEngine)
int QT_DISTANCEFIELD_RADIUS(bool narrowOutlineFont)
int QT_DISTANCEFIELD_SCALE(bool narrowOutlineFont)
static int QT_DISTANCEFIELD_DEFAULT_SCALE
void fillLine< Clip, LeftToRight >(qint32 *line, int width, int lx, int rx, qint32 d, qint32 dd)
static void initialDistanceFieldFactor()
void drawTriangle(qint32 *bits, int width, int height, const QPoint *center, const QPoint *v1, const QPoint *v2, qint32 value)
int QT_DISTANCEFIELD_BASEFONTSIZE(bool narrowOutlineFont)
static bool imageHasNarrowOutlines(const QImage &im)
void fillLine< Clip, RightToLeft >(qint32 *line, int width, int lx, int rx, qint32 d, qint32 dd)
QDebug Q_GUI_EXPORT & operator<<(QDebug &s, const QVectorPath &path)