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;
60 switch (m_preferredAntialiasingMode) {
109 m_nodesToDelete.clear();
123 m_nodesToDelete.append(subnode);
124 subnode = subnode->nextSibling();
133 const int maxGlyphs = (USHRT_MAX + 1) / 4;
134 const int maxVertices = maxGlyphs * 4;
135 const int maxIndexes = maxGlyphs * 6;
137 for (
int i = 0;
i < indexes.size(); ++
i) {
138 const int glyphIndex = indexes.at(
i);
146 if (
i >= maxGlyphs) {
147 glyphInfo.indexes.append(glyphIndex);
148 glyphInfo.positions.append(
position);
153 if (!glyphInfo.indexes.isEmpty()) {
155 subNodeGlyphRun.setGlyphIndexes(glyphInfo.indexes);
156 subNodeGlyphRun.setPositions(glyphInfo.positions);
159 subNode->setGlyphNodeType(SubGlyphNode);
163 subNode->setGlyphs(
m_position, subNodeGlyphRun);
165 subNode->updateGeometry();
171 quint16 *indexData =
g->indexDataAsUShort();
173 QVector<QSGGeometry::TexturedPoint2D> tempVertexData(maxVertices);
174 QVector<quint16> tempIndexData(maxIndexes);
176 for (
int i = 0;
i < maxGlyphs;
i++) {
182 tempIndexData[
i * 6 + 0] = indexData[
i * 6 + 0];
183 tempIndexData[
i * 6 + 1] = indexData[
i * 6 + 1];
184 tempIndexData[
i * 6 + 2] = indexData[
i * 6 + 2];
185 tempIndexData[
i * 6 + 3] = indexData[
i * 6 + 3];
186 tempIndexData[
i * 6 + 4] = indexData[
i * 6 + 4];
187 tempIndexData[
i * 6 + 5] = indexData[
i * 6 + 5];
190 g->allocate(maxVertices, maxIndexes);
192 indexData =
g->indexDataAsUShort();
194 for (
int i = 0;
i < maxGlyphs;
i++) {
200 indexData[
i * 6 + 0] = tempIndexData[
i * 6 + 0];
201 indexData[
i * 6 + 1] = tempIndexData[
i * 6 + 1];
202 indexData[
i * 6 + 2] = tempIndexData[
i * 6 + 2];
203 indexData[
i * 6 + 3] = tempIndexData[
i * 6 + 3];
204 indexData[
i * 6 + 4] = tempIndexData[
i * 6 + 4];
205 indexData[
i * 6 + 5] = tempIndexData[
i * 6 + 5];
209 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.
QList< quint32 > glyphIndexes() const
Returns the glyph indexes for this QGlyphRun object.
QRawFont rawFont() const
Returns the font selected for this QGlyphRun object.
QList< QPointF > positions() const
Returns the position of the edge of the baseline for each glyph in this set of glyph indexes.
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
QQuickText::TextStyle m_style
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
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)
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 ...