| 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 QGLYPHRUN_H |
| 5 | #define QGLYPHRUN_H |
| 6 | |
| 7 | #include <QtGui/qtguiglobal.h> |
| 8 | #include <QtCore/qlist.h> |
| 9 | #include <QtCore/qpoint.h> |
| 10 | #include <QtGui/qrawfont.h> |
| 11 | #include <QtCore/qshareddata.h> |
| 12 | |
| 13 | #if !defined(QT_NO_RAWFONT) |
| 14 | |
| 15 | QT_BEGIN_NAMESPACE |
| 16 | |
| 17 | |
| 18 | class QGlyphRunPrivate; |
| 19 | class Q_GUI_EXPORT QGlyphRun |
| 20 | { |
| 21 | public: |
| 22 | enum GlyphRunFlag { |
| 23 | Overline = 0x01, |
| 24 | Underline = 0x02, |
| 25 | StrikeOut = 0x04, |
| 26 | RightToLeft = 0x08, |
| 27 | SplitLigature = 0x10 |
| 28 | }; |
| 29 | Q_DECLARE_FLAGS(GlyphRunFlags, GlyphRunFlag) |
| 30 | |
| 31 | QGlyphRun(); |
| 32 | QGlyphRun(const QGlyphRun &other); |
| 33 | QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QGlyphRun) |
| 34 | QGlyphRun &operator=(const QGlyphRun &other); |
| 35 | ~QGlyphRun(); |
| 36 | |
| 37 | void swap(QGlyphRun &other) noexcept { d.swap(other&: other.d); } |
| 38 | |
| 39 | QRawFont rawFont() const; |
| 40 | void setRawFont(const QRawFont &rawFont); |
| 41 | |
| 42 | void setRawData(const quint32 *glyphIndexArray, |
| 43 | const QPointF *glyphPositionArray, |
| 44 | int size); |
| 45 | |
| 46 | QList<quint32> glyphIndexes() const; |
| 47 | void setGlyphIndexes(const QList<quint32> &glyphIndexes); |
| 48 | |
| 49 | QList<QPointF> positions() const; |
| 50 | void setPositions(const QList<QPointF> &positions); |
| 51 | |
| 52 | void clear(); |
| 53 | |
| 54 | bool operator==(const QGlyphRun &other) const; |
| 55 | inline bool operator!=(const QGlyphRun &other) const |
| 56 | { return !operator==(other); } |
| 57 | |
| 58 | void setOverline(bool overline); |
| 59 | bool overline() const; |
| 60 | |
| 61 | void setUnderline(bool underline); |
| 62 | bool underline() const; |
| 63 | |
| 64 | void setStrikeOut(bool strikeOut); |
| 65 | bool strikeOut() const; |
| 66 | |
| 67 | void setRightToLeft(bool on); |
| 68 | bool isRightToLeft() const; |
| 69 | |
| 70 | void setFlag(GlyphRunFlag flag, bool enabled = true); |
| 71 | void setFlags(GlyphRunFlags flags); |
| 72 | GlyphRunFlags flags() const; |
| 73 | |
| 74 | void setBoundingRect(const QRectF &boundingRect); |
| 75 | QRectF boundingRect() const; |
| 76 | |
| 77 | QList<qsizetype> stringIndexes() const; |
| 78 | void setStringIndexes(const QList<qsizetype> &stringIndexes); |
| 79 | |
| 80 | void setSourceString(const QString &sourceString); |
| 81 | QString sourceString() const; |
| 82 | |
| 83 | bool isEmpty() const; |
| 84 | |
| 85 | private: |
| 86 | friend class QGlyphRunPrivate; |
| 87 | friend class QTextLine; |
| 88 | |
| 89 | QGlyphRun operator+(const QGlyphRun &other) const; |
| 90 | QGlyphRun &operator+=(const QGlyphRun &other); |
| 91 | |
| 92 | void detach(); |
| 93 | QExplicitlySharedDataPointer<QGlyphRunPrivate> d; |
| 94 | }; |
| 95 | |
| 96 | Q_DECLARE_SHARED(QGlyphRun) |
| 97 | |
| 98 | QT_END_NAMESPACE |
| 99 | |
| 100 | #endif // QT_NO_RAWFONT |
| 101 | |
| 102 | #endif // QGLYPHRUN_H |
| 103 | |