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 QSGCURVEGLYPHATLAS_P_H
5#define QSGCURVEGLYPHATLAS_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 <QtGui/qrawfont.h>
19#include <QtGui/private/qtextengine_p.h>
20#include <QtQuick/qtquickexports.h>
21
22QT_BEGIN_NAMESPACE
23
24class QSGCurveFillNode;
25class QSGCurveStrokeNode;
26
27class Q_QUICK_EXPORT QSGCurveGlyphAtlas
28{
29public:
30 QSGCurveGlyphAtlas(const QRawFont &font);
31 virtual ~QSGCurveGlyphAtlas();
32
33 void populate(const QList<glyph_t> &glyphs);
34 void addGlyph(QSGCurveFillNode *node,
35 glyph_t glyph,
36 const QPointF &position,
37 qreal pixelSize) const;
38 void addStroke(QSGCurveStrokeNode *node,
39 glyph_t glyph,
40 const QPointF &position) const;
41
42 qreal fontSize() const
43 {
44 return m_font.pixelSize();
45 }
46
47private:
48 struct Glyph
49 {
50 QList<QVector2D> vertices;
51 QList<QVector3D> uvs;
52 QList<QVector2D> normals;
53 QList<QVector2D> duvdx;
54 QList<QVector2D> duvdy;
55
56 QList<QVector2D> strokeVertices;
57 QList<QVector2D> strokeUvs;
58 QList<QVector2D> strokeNormals;
59 QList<bool> strokeElementIsLine;
60 };
61
62 QHash<glyph_t, Glyph> m_glyphs;
63 QRawFont m_font;
64};
65
66QT_END_NAMESPACE
67
68
69#endif // QSGCURVEGLYPHATLAS_P_H
70

Provided by KDAB

Privacy Policy
Learn Advanced QML with KDAB
Find out more

source code of qtdeclarative/src/quick/scenegraph/qsgcurveglyphatlas_p.h