/src/qtbase/src/gui/text/qrawfont.h
Line | Count | Source |
1 | | // Copyright (C) 2016 The Qt Company Ltd. |
2 | | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
3 | | |
4 | | #ifndef QRAWFONT_H |
5 | | #define QRAWFONT_H |
6 | | |
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> |
16 | | |
17 | | #if !defined(QT_NO_RAWFONT) |
18 | | |
19 | | QT_BEGIN_NAMESPACE |
20 | | |
21 | | |
22 | | class QRawFontPrivate; |
23 | | class Q_GUI_EXPORT QRawFont |
24 | | { |
25 | | public: |
26 | | enum AntialiasingType { |
27 | | PixelAntialiasing, |
28 | | SubPixelAntialiasing |
29 | | }; |
30 | | |
31 | | enum LayoutFlag { |
32 | | SeparateAdvances = 0, |
33 | | KernedAdvances = 1, |
34 | | UseDesignMetrics = 2 |
35 | | }; |
36 | | Q_DECLARE_FLAGS(LayoutFlags, LayoutFlag) |
37 | | |
38 | | QRawFont(); |
39 | | QRawFont(const QString &fileName, |
40 | | qreal pixelSize, |
41 | | QFont::HintingPreference hintingPreference = QFont::PreferDefaultHinting); |
42 | | QRawFont(const QByteArray &fontData, |
43 | | qreal pixelSize, |
44 | | QFont::HintingPreference hintingPreference = QFont::PreferDefaultHinting); |
45 | | QRawFont(const QRawFont &other); |
46 | 0 | QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QRawFont) |
47 | 0 | QRawFont &operator=(const QRawFont &other); |
48 | 0 | ~QRawFont(); |
49 | 0 |
|
50 | 0 | void swap(QRawFont &other) noexcept { d.swap(other.d); } |
51 | | |
52 | | bool isValid() const; |
53 | | |
54 | | bool operator==(const QRawFont &other) const; |
55 | | inline bool operator!=(const QRawFont &other) const |
56 | 0 | { return !operator==(other); } |
57 | | |
58 | | quint32 glyphCount() const; |
59 | | |
60 | | QString familyName() const; |
61 | | QString styleName() const; |
62 | | |
63 | | QFont::Style style() const; |
64 | | int weight() const; |
65 | | |
66 | | QList<quint32> glyphIndexesForString(const QString &text) const; |
67 | | inline QList<QPointF> advancesForGlyphIndexes(const QList<quint32> &glyphIndexes) const; |
68 | | 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; |
73 | | |
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; |
79 | | |
80 | | void setPixelSize(qreal pixelSize); |
81 | | qreal pixelSize() const; |
82 | | |
83 | | QFont::HintingPreference hintingPreference() const; |
84 | | |
85 | | qreal ascent() 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; |
94 | | |
95 | | qreal unitsPerEm() const; |
96 | | |
97 | | QString glyphName(quint32 glyphIndex) const; |
98 | | |
99 | | void loadFromFile(const QString &fileName, |
100 | | qreal pixelSize, |
101 | | QFont::HintingPreference hintingPreference); |
102 | | |
103 | | void loadFromData(const QByteArray &fontData, |
104 | | qreal pixelSize, |
105 | | QFont::HintingPreference hintingPreference); |
106 | | |
107 | | bool supportsCharacter(uint ucs4) const; |
108 | | bool supportsCharacter(QChar character) const; |
109 | | QList<QFontDatabase::WritingSystem> supportedWritingSystems() const; |
110 | | |
111 | | QByteArray fontTable(const char *tagName) const; |
112 | | QByteArray fontTable(QFont::Tag tag) const; |
113 | | |
114 | | static QRawFont fromFont(const QFont &font, |
115 | | QFontDatabase::WritingSystem writingSystem = QFontDatabase::Any); |
116 | | |
117 | | private: |
118 | | friend class QRawFontPrivate; |
119 | | friend class QTextLayout; |
120 | | friend class QTextEngine; |
121 | | |
122 | | QExplicitlySharedDataPointer<QRawFontPrivate> d; |
123 | | }; |
124 | | |
125 | 0 | Q_DECLARE_SHARED(QRawFont) |
126 | 0 |
|
127 | 0 | Q_DECLARE_OPERATORS_FOR_FLAGS(QRawFont::LayoutFlags) Unexecuted instantiation: operator|(QRawFont::LayoutFlag, QRawFont::LayoutFlag) Unexecuted instantiation: operator|(QRawFont::LayoutFlag, QFlags<QRawFont::LayoutFlag>) Unexecuted instantiation: operator&(QRawFont::LayoutFlag, QRawFont::LayoutFlag) Unexecuted instantiation: operator&(QRawFont::LayoutFlag, QFlags<QRawFont::LayoutFlag>) Unexecuted instantiation: operator^(QRawFont::LayoutFlag, QRawFont::LayoutFlag) Unexecuted instantiation: operator^(QRawFont::LayoutFlag, QFlags<QRawFont::LayoutFlag>) Unexecuted instantiation: operator|(QRawFont::LayoutFlag, int) |
128 | 0 |
|
129 | 0 | Q_GUI_EXPORT size_t qHash(const QRawFont &font, size_t seed = 0) noexcept; |
130 | 0 |
|
131 | 0 |
|
132 | 0 |
|
133 | 0 | inline QList<QPointF> QRawFont::advancesForGlyphIndexes(const QList<quint32> &glyphIndexes) const |
134 | 0 | { |
135 | 0 | return advancesForGlyphIndexes(glyphIndexes, QRawFont::SeparateAdvances); |
136 | 0 | } |
137 | | |
138 | | QT_END_NAMESPACE |
139 | | |
140 | | #endif // QT_NO_RAWFONT |
141 | | |
142 | | #endif // QRAWFONT_H |