7#include <private/qrawfont_p.h>
13 , m_glyphNodeType(RootGlyphNode)
14 , m_dirtyGeometry(
false)
15 , m_preferredAntialiasingMode(DefaultAntialiasing)
22 if (m_glyphNodeType == SubGlyphNode)
26 m_nodesToDelete.clear();
31 m_preferredAntialiasingMode =
mode;
42 m_dirtyGeometry =
true;
57 switch (m_preferredAntialiasingMode) {
106 m_nodesToDelete.clear();
120 m_nodesToDelete.append(subnode);
130 const int maxGlyphs = (USHRT_MAX + 1) / 4;
131 const int maxVertices = maxGlyphs * 4;
132 const int maxIndexes = maxGlyphs * 6;
134 for (
int i = 0;
i < indexes.
size(); ++
i) {
135 const int glyphIndex = indexes.
at(
i);
143 if (
i >= maxGlyphs) {
144 glyphInfo.indexes.append(glyphIndex);
145 glyphInfo.positions.append(
position);
150 if (!glyphInfo.indexes.isEmpty()) {
156 subNode->setGlyphNodeType(SubGlyphNode);
168 quint16 *indexData =
g->indexDataAsUShort();
173 for (
int i = 0;
i < maxGlyphs;
i++) {
174 tempVertexData[
i * 4 + 0] = vertexData[
i * 4 + 0];
175 tempVertexData[
i * 4 + 1] = vertexData[
i * 4 + 1];
176 tempVertexData[
i * 4 + 2] = vertexData[
i * 4 + 2];
177 tempVertexData[
i * 4 + 3] = vertexData[
i * 4 + 3];
179 tempIndexData[
i * 6 + 0] = indexData[
i * 6 + 0];
180 tempIndexData[
i * 6 + 1] = indexData[
i * 6 + 1];
181 tempIndexData[
i * 6 + 2] = indexData[
i * 6 + 2];
182 tempIndexData[
i * 6 + 3] = indexData[
i * 6 + 3];
183 tempIndexData[
i * 6 + 4] = indexData[
i * 6 + 4];
184 tempIndexData[
i * 6 + 5] = indexData[
i * 6 + 5];
187 g->allocate(maxVertices, maxIndexes);
188 vertexData =
g->vertexDataAsTexturedPoint2D();
189 indexData =
g->indexDataAsUShort();
191 for (
int i = 0;
i < maxGlyphs;
i++) {
192 vertexData[
i * 4 + 0] = tempVertexData[
i * 4 + 0];
193 vertexData[
i * 4 + 1] = tempVertexData[
i * 4 + 1];
194 vertexData[
i * 4 + 2] = tempVertexData[
i * 4 + 2];
195 vertexData[
i * 4 + 3] = tempVertexData[
i * 4 + 3];
197 indexData[
i * 6 + 0] = tempIndexData[
i * 6 + 0];
198 indexData[
i * 6 + 1] = tempIndexData[
i * 6 + 1];
199 indexData[
i * 6 + 2] = tempIndexData[
i * 6 + 2];
200 indexData[
i * 6 + 3] = tempIndexData[
i * 6 + 3];
201 indexData[
i * 6 + 4] = tempIndexData[
i * 6 + 4];
202 indexData[
i * 6 + 5] = tempIndexData[
i * 6 + 5];
206 m_dirtyGeometry =
false;
The QColor class provides colors based on RGB, HSV or CMYK values.
QColor toRgb() const noexcept
Create and returns an RGB QColor based on this color.
The QGlyphRun class provides direct access to the internal glyphs in a font.
void setPositions(const QList< QPointF > &positions)
Sets the positions of the edge of the baseline for each glyph in this set of glyph indexes to positio...
QList< quint32 > glyphIndexes() const
Returns the glyph indexes for this QGlyphRun object.
QRawFont rawFont() const
Returns the font selected for this QGlyphRun object.
void setGlyphIndexes(const QList< quint32 > &glyphIndexes)
Set the glyph indexes for this QGlyphRun object to glyphIndexes.
QList< QPointF > positions() const
Returns the position of the edge of the baseline for each glyph in this set of glyph indexes.
qsizetype size() const noexcept
const_reference at(qsizetype i) const noexcept
constexpr void setTop(int top) noexcept
Sets the Top margin to Top.
constexpr void setBottom(int bottom) noexcept
Sets the bottom margin to bottom.
\inmodule QtCore\reentrant
static QRawFontPrivate * get(const QRawFont &font)
The QRawFont class provides access to a single physical instance of a font.
\inmodule QtCore\reentrant
const QSGGeometry * geometry() const
Returns this node's geometry.
void setGlyphs(const QPointF &position, const QGlyphRun &glyphs) override
void setColor(const QColor &color) override
void setStyle(QQuickText::TextStyle) override
QQuickText::TextStyle m_style
void setStyleColor(const QColor &) override
void setMaterialColor(const QColor &color) override
void setPreferredAntialiasingMode(AntialiasingMode) override
void setGlyphs(const QPointF &position, const QGlyphRun &glyphs) override
void preprocess() override
Override this function to do processing on the node before it is rendered.
QSGDefaultGlyphNode(QSGRenderContext *context)
QSGMaterial * material() const
Returns the material of the QSGGeometryNode.
void setMaterial(QSGMaterial *material)
Sets the material of this geometry node to material.
The QSGGeometry class provides low-level storage for graphics primitives in the \l{Qt Quick Scene Gra...
virtual void setBoundingRect(const QRectF &bounds)
virtual QRectF boundingRect() const
@ HighQualitySubPixelAntialiasing
@ LowQualitySubPixelAntialiasing
\group qtquick-scenegraph-nodes \title Qt Quick Scene Graph Node classes
QSGNode * nextSibling() const
Returns the node after this in the parent's list of children.
void appendChildNode(QSGNode *node)
Appends node to this node's list of children.
QSGNode * firstChild() const
Returns the first child of this node.
void markDirty(DirtyState bits)
Notifies all connected renderers that the node has dirty bits.
void setFlag(Flag, bool=true)
Sets the flag f on this node if enabled is true; otherwise clears the flag.
void removeAllChildNodes()
Removes all child nodes from this node's list of children.
void setColor(const QColor &c)
void populate(const QPointF &position, const QVector< quint32 > &glyphIndexes, const QVector< QPointF > &glyphPositions, QSGGeometry *geometry, QRectF *boundingRect, QPointF *baseLine, const QMargins &margins=QMargins(0, 0, 0, 0))
The QVector2D class represents a vector or vertex in 2D space.
The QVector4D class represents a vector or vertex in 4D space.
qDeleteAll(list.begin(), list.end())
Combined button and popup list for selecting options.
static const QCssKnownValue positions[NumKnownPositionModes - 1]
static qreal position(const QQuickItem *item, QQuickAnchors::Anchor anchorLine)
The QSGGeometry::TexturedPoint2D struct is a convenience struct for accessing 2D Points with texture ...