aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/scenegraph/qsgcurveglyphnode_p.h
blob: cb634112d0fab77aac0f9941b269f1427a248ee2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
// Copyright (C) 2023 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only

#ifndef QSGCURVEGLYPHNODE_P_H
#define QSGCURVEGLYPHNODE_P_H

//
//  W A R N I N G
//  -------------
//
// This file is not part of the Qt API.  It exists purely as an
// implementation detail.  This header file may change from version to
// version without notice, or even be removed.
//
// We mean it.
//

#include <qtquickexports.h>
#include <private/qsgadaptationlayer_p.h>
#include <private/qsgbasicglyphnode_p.h>

QT_BEGIN_NAMESPACE

class QSGCurveGlyphAtlas;
class QSGCurveFillNode;
class QSGCurveAbstractNode;

class Q_QUICK_EXPORT QSGCurveGlyphNode : public QSGGlyphNode
{
public:
    QSGCurveGlyphNode(QSGRenderContext *context);
    ~QSGCurveGlyphNode();
    void setGlyphs(const QPointF &position, const QGlyphRun &glyphs) override;
    void update() override;
    void preprocess() override;
    void setPreferredAntialiasingMode(AntialiasingMode) override;
    void updateGeometry();
    void setColor(const QColor &color) override;
    void setStyle(QQuickText::TextStyle style) override;

    void setStyleColor(const QColor &color) override;
    QPointF baseLine() const override { return m_baseLine; }

private:
    QSGRenderContext *m_context;
    QSGGeometry m_geometry;
    QColor m_color = Qt::black;

    struct GlyphInfo {
        QVector<quint32> indexes;
        QVector<QPointF> positions;
    };

    uint m_dirtyGeometry: 1;
    qreal m_fontSize = 0.0f;
    QGlyphRun m_glyphs;
    QQuickText::TextStyle m_style;
    QColor m_styleColor;
    QPointF m_baseLine;
    QPointF m_position;

    QSGCurveFillNode *m_glyphNode = nullptr;
    QSGCurveAbstractNode *m_styleNode = nullptr;
};

QT_END_NAMESPACE

#endif