| 1 | // Copyright (C) 2023 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 QSGCURVEGLYPHNODE_P_H |
| 5 | #define QSGCURVEGLYPHNODE_P_H |
| 6 | |
| 7 | // |
| 8 | // W A R N I N G |
| 9 | // ------------- |
| 10 | // |
| 11 | // This file is not part of the Qt API. It exists purely as an |
| 12 | // implementation detail. This header file may change from version to |
| 13 | // version without notice, or even be removed. |
| 14 | // |
| 15 | // We mean it. |
| 16 | // |
| 17 | |
| 18 | #include <qtquickexports.h> |
| 19 | #include <private/qsgadaptationlayer_p.h> |
| 20 | #include <private/qsgbasicglyphnode_p.h> |
| 21 | |
| 22 | QT_BEGIN_NAMESPACE |
| 23 | |
| 24 | class QSGCurveGlyphAtlas; |
| 25 | class QSGCurveFillNode; |
| 26 | class QSGCurveAbstractNode; |
| 27 | |
| 28 | class Q_QUICK_EXPORT QSGCurveGlyphNode : public QSGGlyphNode |
| 29 | { |
| 30 | public: |
| 31 | QSGCurveGlyphNode(QSGRenderContext *context); |
| 32 | ~QSGCurveGlyphNode(); |
| 33 | void setGlyphs(const QPointF &position, const QGlyphRun &glyphs) override; |
| 34 | void update() override; |
| 35 | void preprocess() override; |
| 36 | void setPreferredAntialiasingMode(AntialiasingMode) override; |
| 37 | void updateGeometry(); |
| 38 | void setColor(const QColor &color) override; |
| 39 | void setStyle(QQuickText::TextStyle style) override; |
| 40 | |
| 41 | void setStyleColor(const QColor &color) override; |
| 42 | QPointF baseLine() const override { return m_baseLine; } |
| 43 | |
| 44 | private: |
| 45 | QSGRenderContext *m_context; |
| 46 | QSGGeometry m_geometry; |
| 47 | QColor m_color = Qt::black; |
| 48 | |
| 49 | struct GlyphInfo { |
| 50 | QVector<quint32> indexes; |
| 51 | QVector<QPointF> positions; |
| 52 | }; |
| 53 | |
| 54 | uint m_dirtyGeometry: 1; |
| 55 | qreal m_fontSize = 0.0f; |
| 56 | QGlyphRun m_glyphs; |
| 57 | QQuickText::TextStyle m_style; |
| 58 | QColor m_styleColor; |
| 59 | QPointF m_baseLine; |
| 60 | QPointF m_position; |
| 61 | |
| 62 | QSGCurveFillNode *m_glyphNode = nullptr; |
| 63 | QSGCurveAbstractNode *m_styleNode = nullptr; |
| 64 | }; |
| 65 | |
| 66 | QT_END_NAMESPACE |
| 67 | |
| 68 | #endif |
| 69 |
