1 /****************************************************************************
3 ** Copyright (C) 2015 The Qt Company Ltd.
4 ** Copyright (C) 2016 Ivailo Monev
6 ** This file is part of the test suite of the Katie Toolkit.
8 ** $QT_BEGIN_LICENSE:LGPL$
10 ** GNU Lesser General Public License Usage
11 ** This file may be used under the terms of the GNU Lesser
12 ** General Public License version 2.1 as published by the Free Software
13 ** Foundation and appearing in the file LICENSE.LGPL included in the
14 ** packaging of this file. Please review the following information to
15 ** ensure the GNU Lesser General Public License version 2.1 requirements
16 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
20 ****************************************************************************/
22 #ifndef QSTATICTEXT_P_H
23 #define QSTATICTEXT_P_H
29 // This file is not part of the Katie API. It exists for the convenience
30 // of internal files. This header file may change from version to version
31 // without notice, or even be removed.
36 #include "qstatictext.h"
38 #include "qfontengine_p.h"
39 #include <QtGui/qcolor.h>
43 class Q_GUI_EXPORT QStaticTextItem
46 QStaticTextItem() : chars(nullptr), numChars(0), m_fontEngine(nullptr) {}
48 QStaticTextItem(const QStaticTextItem &other)
53 void operator=(const QStaticTextItem &other)
55 glyphPositions = other.glyphPositions;
56 glyphs = other.glyphs;
58 numGlyphs = other.numGlyphs;
59 numChars = other.numChars;
63 m_fontEngine = nullptr;
64 setFontEngine(other.fontEngine());
69 void setFontEngine(QFontEngine *fe);
70 QFontEngine *fontEngine() const { return m_fontEngine; }
73 QFixedPoint *glyphPositions; // 8 bytes per glyph
77 glyph_t *glyphs; // 4 bytes per glyph
81 QChar *chars; // 2 bytes per glyph
87 // 12 bytes for pointers
88 int numGlyphs; // 4 bytes per item
89 int numChars; // 4 bytes per item
90 QFont font; // 8 bytes per item
91 QColor color; // 10 bytes per item
95 private: // Needs special handling in setters, so private to avoid abuse
96 QFontEngine *m_fontEngine; // 4 bytes per item
100 class Q_AUTOTEST_EXPORT QStaticTextPrivate
103 QStaticTextPrivate();
104 QStaticTextPrivate(const QStaticTextPrivate &other);
105 ~QStaticTextPrivate();
108 void paintText(const QPointF &pos, QPainter *p);
112 needsRelayout = true;
115 QAtomicInt ref; // 4 bytes per text
117 QString text; // 4 bytes per text
118 QFont font; // 8 bytes per text
119 qreal textWidth; // 8 bytes per text
120 QSizeF actualSize; // 16 bytes per text
121 QPointF position; // 16 bytes per text
123 QTransform matrix; // 80 bytes per text
124 QStaticTextItem *items; // 4 bytes per text
125 int itemCount; // 4 bytes per text
127 glyph_t *glyphPool; // 4 bytes per text
128 QFixedPoint *positionPool; // 4 bytes per text
129 QChar *charPool; // 4 bytes per text
131 QTextOption textOption; // 28 bytes per text
133 bool needsRelayout; // 1 byte per text
134 Qt::TextFormat textFormat;
135 bool untransformedCoordinates;
137 // 195 bytes per text
139 static QStaticTextPrivate *get(const QStaticText *q);
144 #endif // QSTATICTEXT_P_H