diff options
Diffstat (limited to 'src/quick/scenegraph/qsgcurveglyphatlas_p.h')
-rw-r--r-- | src/quick/scenegraph/qsgcurveglyphatlas_p.h | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/src/quick/scenegraph/qsgcurveglyphatlas_p.h b/src/quick/scenegraph/qsgcurveglyphatlas_p.h new file mode 100644 index 0000000000..c82f1921f9 --- /dev/null +++ b/src/quick/scenegraph/qsgcurveglyphatlas_p.h @@ -0,0 +1,69 @@ +// 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 QSGCURVEGLYPHATLAS_P_H +#define QSGCURVEGLYPHATLAS_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 <QtGui/qrawfont.h> +#include <QtGui/private/qtextengine_p.h> +#include <QtQuick/qtquickexports.h> + +QT_BEGIN_NAMESPACE + +class QSGCurveFillNode; +class QSGCurveStrokeNode; + +class Q_QUICK_EXPORT QSGCurveGlyphAtlas +{ +public: + QSGCurveGlyphAtlas(const QRawFont &font); + virtual ~QSGCurveGlyphAtlas(); + + void populate(const QList<glyph_t> &glyphs); + void addGlyph(QSGCurveFillNode *node, + glyph_t glyph, + const QPointF &position, + qreal pixelSize) const; + void addStroke(QSGCurveStrokeNode *node, + glyph_t glyph, + const QPointF &position) const; + + qreal fontSize() const + { + return m_font.pixelSize(); + } + +private: + struct Glyph + { + QList<QVector2D> vertices; + QList<QVector3D> uvs; + QList<QVector2D> normals; + QList<QVector2D> duvdx; + QList<QVector2D> duvdy; + + QList<QVector2D> strokeVertices; + QList<QVector2D> strokeUvs; + QList<QVector2D> strokeNormals; + QList<bool> strokeElementIsLine; + }; + + QHash<glyph_t, Glyph> m_glyphs; + QRawFont m_font; +}; + +QT_END_NAMESPACE + + +#endif // QSGCURVEGLYPHATLAS_P_H |