1// Copyright (C) 2016 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 QTEXTENGINE_P_H
5#define QTEXTENGINE_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 for the convenience
12// of other Qt classes. 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/private/qtguiglobal_p.h>
19#include "QtGui/qpaintengine.h"
20#include "QtGui/qtextcursor.h"
21#include "QtGui/qtextobject.h"
22#include "QtGui/qtextoption.h"
23#include "QtGui/qtextlayout.h"
24
25#include "QtCore/qdebug.h"
26#include "QtCore/qlist.h"
27#include "QtCore/qnamespace.h"
28#include "QtCore/qset.h"
29#include "QtCore/qstring.h"
30#include "QtCore/qvarlengtharray.h"
31
32#include "private/qfixed_p.h"
33#include "private/qfont_p.h"
34#include "private/qtextformat_p.h"
35#include "private/qunicodetools_p.h"
36#ifndef QT_BUILD_COMPAT_LIB
37#include "private/qtextdocument_p.h"
38#endif
39
40#include <stdlib.h>
41#include <vector>
42
43QT_BEGIN_NAMESPACE
44
45class QFontPrivate;
46class QFontEngine;
47
48class QString;
49class QPainter;
50
51class QAbstractTextDocumentLayout;
52
53typedef quint32 glyph_t;
54
55// this uses the same coordinate system as Qt, but a different one to freetype.
56// * y is usually negative, and is equal to the ascent.
57// * negative yoff means the following stuff is drawn higher up.
58// the characters bounding rect is given by QRect(x,y,width,height), its advance by
59// xoo and yoff
60struct Q_GUI_EXPORT glyph_metrics_t
61{
62 inline glyph_metrics_t()
63 : x(100000), y(100000) {}
64 inline glyph_metrics_t(QFixed _x, QFixed _y, QFixed _width, QFixed _height, QFixed _xoff, QFixed _yoff)
65 : x(_x),
66 y(_y),
67 width(_width),
68 height(_height),
69 xoff(_xoff),
70 yoff(_yoff)
71 {}
72 QFixed x;
73 QFixed y;
74 QFixed width;
75 QFixed height;
76 QFixed xoff;
77 QFixed yoff;
78
79 glyph_metrics_t transformed(const QTransform &xform) const;
80 inline bool isValid() const {return x != 100000 && y != 100000;}
81
82 inline QFixed leftBearing() const
83 {
84 if (!isValid())
85 return QFixed();
86
87 return x;
88 }
89
90 inline QFixed rightBearing() const
91 {
92 if (!isValid())
93 return QFixed();
94
95 return xoff - x - width;
96 }
97};
98Q_DECLARE_TYPEINFO(glyph_metrics_t, Q_PRIMITIVE_TYPE);
99
100struct Q_AUTOTEST_EXPORT QScriptAnalysis
101{
102 enum Flags {
103 None = 0,
104 Lowercase = 1,
105 Uppercase = 2,
106 SmallCaps = 3,
107 LineOrParagraphSeparator = 4,
108 Space = 5,
109 SpaceTabOrObject = Space,
110 Nbsp = 6,
111 Tab = 7,
112 TabOrObject = Tab,
113 Object = 8
114 };
115 enum BidiFlags {
116 BidiBN = 1,
117 BidiMaybeResetToParagraphLevel = 2,
118 BidiResetToParagraphLevel = 4,
119 BidiMirrored = 8
120 };
121 unsigned short script : 8;
122 unsigned short flags : 4;
123 unsigned short bidiFlags : 4;
124 unsigned short bidiLevel : 8; // Unicode Bidi algorithm embedding level (0-125)
125 QChar::Direction bidiDirection : 8; // used when running the bidi algorithm
126 inline bool operator == (const QScriptAnalysis &other) const {
127 return script == other.script && bidiLevel == other.bidiLevel && flags == other.flags;
128 }
129};
130Q_DECLARE_TYPEINFO(QScriptAnalysis, Q_PRIMITIVE_TYPE);
131
132struct QGlyphJustification
133{
134 inline QGlyphJustification()
135 : type(0), nKashidas(0), space_18d6(0)
136 {}
137
138 enum JustificationType {
139 JustifyNone,
140 JustifySpace,
141 JustifyKashida
142 };
143
144 uint type :2;
145 uint nKashidas : 6; // more do not make sense...
146 uint space_18d6 : 24;
147};
148Q_DECLARE_TYPEINFO(QGlyphJustification, Q_PRIMITIVE_TYPE);
149
150struct QGlyphAttributes {
151 uchar clusterStart : 1;
152 uchar dontPrint : 1;
153 uchar justification : 4;
154 uchar reserved : 2;
155};
156static_assert(sizeof(QGlyphAttributes) == 1);
157Q_DECLARE_TYPEINFO(QGlyphAttributes, Q_PRIMITIVE_TYPE);
158
159struct QGlyphLayout
160{
161 enum {
162 SpaceNeeded = sizeof(glyph_t) + sizeof(QFixed) + sizeof(QFixedPoint)
163 + sizeof(QGlyphAttributes) + sizeof(QGlyphJustification)
164 };
165
166 // init to 0 not needed, done when shaping
167 QFixedPoint *offsets; // 8 bytes per element
168 glyph_t *glyphs; // 4 bytes per element
169 QFixed *advances; // 4 bytes per element
170 QGlyphJustification *justifications; // 4 bytes per element
171 QGlyphAttributes *attributes; // 1 byte per element
172
173 int numGlyphs;
174
175 inline QGlyphLayout() : numGlyphs(0) {}
176
177 inline explicit QGlyphLayout(char *address, int totalGlyphs)
178 {
179 offsets = reinterpret_cast<QFixedPoint *>(address);
180 int offset = totalGlyphs * sizeof(QFixedPoint);
181 glyphs = reinterpret_cast<glyph_t *>(address + offset);
182 offset += totalGlyphs * sizeof(glyph_t);
183 advances = reinterpret_cast<QFixed *>(address + offset);
184 offset += totalGlyphs * sizeof(QFixed);
185 justifications = reinterpret_cast<QGlyphJustification *>(address + offset);
186 offset += totalGlyphs * sizeof(QGlyphJustification);
187 attributes = reinterpret_cast<QGlyphAttributes *>(address + offset);
188 numGlyphs = totalGlyphs;
189 }
190
191 inline QGlyphLayout mid(int position, int n = -1) const {
192 QGlyphLayout copy = *this;
193 copy.glyphs += position;
194 copy.advances += position;
195 copy.offsets += position;
196 copy.justifications += position;
197 copy.attributes += position;
198 if (n == -1)
199 copy.numGlyphs -= position;
200 else
201 copy.numGlyphs = n;
202 return copy;
203 }
204
205 inline QFixed effectiveAdvance(int item) const
206 { return (advances[item] + QFixed::fromFixed(fixed: justifications[item].space_18d6)) * !attributes[item].dontPrint; }
207
208 inline void clear(int first = 0, int last = -1) {
209 if (last == -1)
210 last = numGlyphs;
211 if (first == 0 && last == numGlyphs
212 && reinterpret_cast<char *>(offsets + numGlyphs) == reinterpret_cast<char *>(glyphs)) {
213 memset(s: static_cast<void *>(offsets), c: 0, n: (numGlyphs * SpaceNeeded));
214 } else {
215 const int num = last - first;
216 memset(s: static_cast<void *>(offsets + first), c: 0, n: num * sizeof(QFixedPoint));
217 memset(s: glyphs + first, c: 0, n: num * sizeof(glyph_t));
218 memset(s: static_cast<void *>(advances + first), c: 0, n: num * sizeof(QFixed));
219 memset(s: static_cast<void *>(justifications + first), c: 0, n: num * sizeof(QGlyphJustification));
220 memset(s: attributes + first, c: 0, n: num * sizeof(QGlyphAttributes));
221 }
222 }
223
224 inline char *data() {
225 return reinterpret_cast<char *>(offsets);
226 }
227
228 void grow(char *address, int totalGlyphs);
229};
230
231class QVarLengthGlyphLayoutArray : private QVarLengthArray<void *>, public QGlyphLayout
232{
233private:
234 typedef QVarLengthArray<void *> Array;
235public:
236 QVarLengthGlyphLayoutArray(int totalGlyphs)
237 : Array((totalGlyphs * SpaceNeeded) / sizeof(void *) + 1)
238 , QGlyphLayout(reinterpret_cast<char *>(Array::data()), totalGlyphs)
239 {
240 memset(s: Array::data(), c: 0, n: Array::size() * sizeof(void *));
241 }
242
243 void resize(int totalGlyphs)
244 {
245 Array::resize(sz: (totalGlyphs * SpaceNeeded) / sizeof(void *) + 1);
246
247 *((QGlyphLayout *)this) = QGlyphLayout(reinterpret_cast<char *>(Array::data()), totalGlyphs);
248 memset(s: Array::data(), c: 0, n: Array::size() * sizeof(void *));
249 }
250};
251
252template <int N> struct QGlyphLayoutArray : public QGlyphLayout
253{
254public:
255 QGlyphLayoutArray()
256 : QGlyphLayout(reinterpret_cast<char *>(buffer), N)
257 {
258 memset(buffer, 0, sizeof(buffer));
259 }
260
261private:
262 void *buffer[(N * SpaceNeeded) / sizeof(void *) + 1];
263};
264
265struct QScriptItem;
266/// Internal QTextItem
267class QTextItemInt : public QTextItem
268{
269public:
270 inline QTextItemInt() = default;
271 QTextItemInt(const QScriptItem &si, QFont *font, const QTextCharFormat &format = QTextCharFormat());
272 QTextItemInt(const QGlyphLayout &g, QFont *font, const QChar *chars, int numChars, QFontEngine *fe,
273 const QTextCharFormat &format = QTextCharFormat());
274
275 /// copy the structure items, adjusting the glyphs arrays to the right subarrays.
276 /// the width of the returned QTextItemInt is not adjusted, for speed reasons
277 QTextItemInt midItem(QFontEngine *fontEngine, int firstGlyphIndex, int numGlyphs) const;
278 void initWithScriptItem(const QScriptItem &si);
279
280 QFixed descent;
281 QFixed ascent;
282 QFixed width;
283
284 RenderFlags flags;
285 bool justified = false;
286 QTextCharFormat::UnderlineStyle underlineStyle = QTextCharFormat::NoUnderline;
287 const QTextCharFormat charFormat;
288 int num_chars = 0;
289 const QChar *chars = nullptr;
290 const unsigned short *logClusters = nullptr;
291 const QFont *f = nullptr;
292
293 QGlyphLayout glyphs;
294 QFontEngine *fontEngine = nullptr;
295};
296
297struct QScriptItem
298{
299 constexpr QScriptItem(int p, QScriptAnalysis a) noexcept
300 : position(p), analysis(a),
301 num_glyphs(0), descent(-1), ascent(-1), leading(-1), width(-1),
302 glyph_data_offset(0) {}
303
304 int position;
305 QScriptAnalysis analysis;
306 unsigned short num_glyphs;
307 QFixed descent;
308 QFixed ascent;
309 QFixed leading;
310 QFixed width;
311 int glyph_data_offset;
312 constexpr QFixed height() const noexcept { return ascent + descent; }
313private:
314 friend class QList<QScriptItem>;
315 QScriptItem() {} // for QList, don't use
316};
317Q_DECLARE_TYPEINFO(QScriptItem, Q_PRIMITIVE_TYPE);
318
319typedef QList<QScriptItem> QScriptItemArray;
320
321struct Q_AUTOTEST_EXPORT QScriptLine
322{
323 // created and filled in QTextLine::layout_helper
324 QScriptLine()
325 : from(0), trailingSpaces(0), length(0),
326 justified(0), gridfitted(0),
327 hasTrailingSpaces(0), leadingIncluded(0) {}
328 QFixed descent;
329 QFixed ascent;
330 QFixed leading;
331 QFixed x;
332 QFixed y;
333 QFixed width;
334 QFixed textWidth;
335 QFixed textAdvance;
336 int from;
337 unsigned short trailingSpaces;
338 signed int length : 28;
339 mutable uint justified : 1;
340 mutable uint gridfitted : 1;
341 uint hasTrailingSpaces : 1;
342 uint leadingIncluded : 1;
343 QFixed height() const { return ascent + descent
344 + (leadingIncluded? qMax(a: QFixed(),b: leading) : QFixed()); }
345 QFixed base() const { return ascent; }
346 void setDefaultHeight(QTextEngine *eng);
347 void operator+=(const QScriptLine &other);
348};
349Q_DECLARE_TYPEINFO(QScriptLine, Q_PRIMITIVE_TYPE);
350
351
352inline void QScriptLine::operator+=(const QScriptLine &other)
353{
354 leading= qMax(a: leading + ascent, b: other.leading + other.ascent) - qMax(a: ascent, b: other.ascent);
355 descent = qMax(a: descent, b: other.descent);
356 ascent = qMax(a: ascent, b: other.ascent);
357 textWidth += other.textWidth;
358 length += other.length;
359}
360
361typedef QList<QScriptLine> QScriptLineArray;
362
363class QFontPrivate;
364class QTextFormatCollection;
365
366class Q_GUI_EXPORT QTextEngine {
367public:
368 enum LayoutState {
369 LayoutEmpty,
370 InLayout,
371 LayoutFailed
372 };
373 struct Q_GUI_EXPORT LayoutData {
374 LayoutData(const QString &str, void **stack_memory, int mem_size);
375 LayoutData();
376 ~LayoutData();
377 mutable QScriptItemArray items;
378 int allocated;
379 int available_glyphs;
380 void **memory;
381 unsigned short *logClustersPtr;
382 QGlyphLayout glyphLayout;
383 mutable int used;
384 uint hasBidi : 1;
385 uint layoutState : 2;
386 uint memory_on_stack : 1;
387 uint haveCharAttributes : 1;
388 QFixed currentMaxWidth;
389 QString string;
390 bool reallocate(int totalGlyphs);
391 };
392
393 struct ItemDecoration {
394 ItemDecoration() { } // for QList, don't use
395 ItemDecoration(qreal x1, qreal x2, qreal y, const QPen &pen):
396 x1(x1), x2(x2), y(y), pen(pen) {}
397
398 qreal x1;
399 qreal x2;
400 qreal y;
401 QPen pen;
402 };
403
404 typedef QList<ItemDecoration> ItemDecorationList;
405
406 QTextEngine();
407 QTextEngine(const QString &str, const QFont &f);
408 ~QTextEngine();
409
410 enum Mode {
411 WidthOnly = 0x07
412 };
413
414 void invalidate();
415 void clearLineData();
416
417 void validate() const;
418 void itemize() const;
419
420 bool isRightToLeft() const;
421 static void bidiReorder(int numRuns, const quint8 *levels, int *visualOrder);
422
423 const QCharAttributes *attributes() const;
424
425 void shape(int item) const;
426
427 void justify(const QScriptLine &si);
428 QFixed alignLine(const QScriptLine &line);
429
430 QFixed width(int charFrom, int numChars) const;
431 glyph_metrics_t boundingBox(int from, int len) const;
432 glyph_metrics_t tightBoundingBox(int from, int len) const;
433
434 int length(int item) const {
435 const QScriptItem &si = layoutData->items[item];
436 int from = si.position;
437 item++;
438 return (item < layoutData->items.size() ? layoutData->items[item].position : layoutData->string.size()) - from;
439 }
440 int length(const QScriptItem *si) const {
441 int end;
442 if (si + 1 < layoutData->items.constData()+ layoutData->items.size())
443 end = (si+1)->position;
444 else
445 end = layoutData->string.size();
446 return end - si->position;
447 }
448
449 QFontEngine *fontEngine(const QScriptItem &si, QFixed *ascent = nullptr, QFixed *descent = nullptr, QFixed *leading = nullptr) const;
450 QFont font(const QScriptItem &si) const;
451 inline QFont font() const { return fnt; }
452
453 /**
454 * Returns a pointer to an array of log clusters, offset at the script item.
455 * Each item in the array is a unsigned short. For each character in the original string there is an entry in the table
456 * so there is a one to one correlation in indexes between the original text and the index in the logcluster.
457 * The value of each item is the position in the glyphs array. Multiple similar pointers in the logclusters array imply
458 * that one glyph is used for more than one character.
459 * \sa glyphs()
460 */
461 inline unsigned short *logClusters(const QScriptItem *si) const
462 { return layoutData->logClustersPtr+si->position; }
463 /**
464 * Returns an array of QGlyphLayout items, offset at the script item.
465 * Each item in the array matches one glyph in the text, storing the advance, position etc.
466 * The returned item's length equals to the number of available glyphs. This may be more
467 * than what was actually shaped.
468 * \sa logClusters()
469 */
470 inline QGlyphLayout availableGlyphs(const QScriptItem *si) const {
471 return layoutData->glyphLayout.mid(position: si->glyph_data_offset);
472 }
473 /**
474 * Returns an array of QGlyphLayout items, offset at the script item.
475 * Each item in the array matches one glyph in the text, storing the advance, position etc.
476 * The returned item's length equals to the number of shaped glyphs.
477 * \sa logClusters()
478 */
479 inline QGlyphLayout shapedGlyphs(const QScriptItem *si) const {
480 return layoutData->glyphLayout.mid(position: si->glyph_data_offset, n: si->num_glyphs);
481 }
482
483 inline bool ensureSpace(int nGlyphs) const {
484 if (layoutData->glyphLayout.numGlyphs - layoutData->used < nGlyphs)
485 return layoutData->reallocate(totalGlyphs: (((layoutData->used + nGlyphs)*3/2 + 15) >> 4) << 4);
486 return true;
487 }
488
489 void freeMemory();
490
491 int findItem(int strPos, int firstItem = 0) const;
492 inline QTextFormatCollection *formatCollection() const {
493 if (QTextDocumentPrivate::get(block) != nullptr)
494 return const_cast<QTextFormatCollection *>(QTextDocumentPrivate::get(block)->formatCollection());
495 return specialData ? specialData->formatCollection.data() : nullptr;
496 }
497 QTextCharFormat format(const QScriptItem *si) const;
498 inline QAbstractTextDocumentLayout *docLayout() const {
499 Q_ASSERT(QTextDocumentPrivate::get(block) != nullptr);
500 return QTextDocumentPrivate::get(block)->document()->documentLayout();
501 }
502 int formatIndex(const QScriptItem *si) const;
503
504 /// returns the width of tab at index (in the tabs array) with the tab-start at position x
505 QFixed calculateTabWidth(int index, QFixed x) const;
506
507 mutable QScriptLineArray lines;
508
509private:
510 struct FontEngineCache {
511 FontEngineCache();
512 mutable QFontEngine *prevFontEngine;
513 mutable QFontEngine *prevScaledFontEngine;
514 mutable int prevScript;
515 mutable int prevPosition;
516 mutable int prevLength;
517 inline void reset() {
518 prevFontEngine = nullptr;
519 prevScaledFontEngine = nullptr;
520 prevScript = -1;
521 prevPosition = -1;
522 prevLength = -1;
523 }
524 };
525 mutable FontEngineCache feCache;
526
527public:
528 QString text;
529 mutable QFont fnt;
530#ifndef QT_NO_RAWFONT
531 QRawFont rawFont;
532#endif
533 QTextBlock block;
534
535 QTextOption option;
536
537 QFixed minWidth;
538 QFixed maxWidth;
539 QPointF position;
540 uint ignoreBidi : 1;
541 uint cacheGlyphs : 1;
542 uint stackEngine : 1;
543 uint forceJustification : 1;
544 uint visualMovement : 1;
545 uint delayDecorations: 1;
546#ifndef QT_NO_RAWFONT
547 uint useRawFont : 1;
548#endif
549
550 mutable LayoutData *layoutData;
551
552 ItemDecorationList underlineList;
553 ItemDecorationList strikeOutList;
554 ItemDecorationList overlineList;
555
556 inline bool visualCursorMovement() const
557 { return visualMovement || (QTextDocumentPrivate::get(block) != nullptr && QTextDocumentPrivate::get(block)->defaultCursorMoveStyle == Qt::VisualMoveStyle); }
558
559 inline int preeditAreaPosition() const { return specialData ? specialData->preeditPosition : -1; }
560 inline QString preeditAreaText() const { return specialData ? specialData->preeditText : QString(); }
561 void setPreeditArea(int position, const QString &text);
562
563 inline bool hasFormats() const
564 { return QTextDocumentPrivate::get(block) != nullptr || (specialData && !specialData->formats.isEmpty()); }
565 inline QList<QTextLayout::FormatRange> formats() const
566 {
567 return specialData ? specialData->formats : QList<QTextLayout::FormatRange>();
568 }
569 void setFormats(const QList<QTextLayout::FormatRange> &formats);
570
571private:
572 static void init(QTextEngine *e);
573
574 struct SpecialData {
575 int preeditPosition;
576 QString preeditText;
577 QList<QTextLayout::FormatRange> formats;
578 QList<QTextCharFormat> resolvedFormats;
579 // only used when no QTextDocumentPrivate is available
580 QScopedPointer<QTextFormatCollection> formatCollection;
581 };
582 SpecialData *specialData;
583
584 void indexFormats();
585 void resolveFormats() const;
586
587public:
588 bool atWordSeparator(int position) const;
589
590 QString elidedText(Qt::TextElideMode mode, QFixed width, int flags = 0, int from = 0, int count = -1) const;
591
592 void shapeLine(const QScriptLine &line);
593 QFixed leadingSpaceWidth(const QScriptLine &line);
594
595 QFixed offsetInLigature(const QScriptItem *si, int pos, int max, int glyph_pos);
596 int positionInLigature(const QScriptItem *si, int end, QFixed x, QFixed edge, int glyph_pos, bool cursorOnCharacter);
597 int previousLogicalPosition(int oldPos) const;
598 int nextLogicalPosition(int oldPos) const;
599 int lineNumberForTextPosition(int pos);
600 int positionAfterVisualMovement(int oldPos, QTextCursor::MoveOperation op);
601 std::vector<int> insertionPointsForLine(int lineNum);
602 void resetFontEngineCache();
603
604 void enableDelayDecorations(bool enable = true) { delayDecorations = enable; }
605
606 void addUnderline(QPainter *painter, const QLineF &line);
607 void addStrikeOut(QPainter *painter, const QLineF &line);
608 void addOverline(QPainter *painter, const QLineF &line);
609
610 void drawDecorations(QPainter *painter);
611 void clearDecorations();
612 void adjustUnderlines();
613
614private:
615 void addItemDecoration(QPainter *painter, const QLineF &line, ItemDecorationList *decorationList);
616 void adjustUnderlines(ItemDecorationList::iterator start,
617 ItemDecorationList::iterator end,
618 qreal underlinePos, qreal penWidth);
619 void drawItemDecorationList(QPainter *painter, const ItemDecorationList &decorationList);
620 void setBoundary(int strPos) const;
621 void addRequiredBoundaries() const;
622 void shapeText(int item) const;
623#if QT_CONFIG(harfbuzz)
624 int shapeTextWithHarfbuzzNG(const QScriptItem &si,
625 const ushort *string,
626 int itemLength,
627 QFontEngine *fontEngine,
628 const QList<uint> &itemBoundaries,
629 bool kerningEnabled,
630 bool hasLetterSpacing,
631 const QHash<quint32, quint32> &features) const;
632#endif
633
634 int endOfLine(int lineNum);
635 int beginningOfLine(int lineNum);
636 int getClusterLength(unsigned short *logClusters, const QCharAttributes *attributes, int from, int to, int glyph_pos, int *start);
637};
638
639class Q_GUI_EXPORT QStackTextEngine : public QTextEngine {
640public:
641 enum { MemSize = 256*40/sizeof(void *) };
642 QStackTextEngine(const QString &string, const QFont &f);
643 LayoutData _layoutData;
644 void *_memory[MemSize];
645};
646Q_DECLARE_TYPEINFO(QTextEngine::ItemDecoration, Q_RELOCATABLE_TYPE);
647
648struct QTextLineItemIterator
649{
650 QTextLineItemIterator(QTextEngine *eng, int lineNum, const QPointF &pos = QPointF(),
651 const QTextLayout::FormatRange *_selection = nullptr);
652
653 inline bool atEnd() const { return logicalItem >= nItems - 1; }
654 inline bool atBeginning() const { return logicalItem <= 0; }
655 QScriptItem &next();
656
657 bool getSelectionBounds(QFixed *selectionX, QFixed *selectionWidth) const;
658 inline bool isOutsideSelection() const {
659 QFixed tmp1, tmp2;
660 return !getSelectionBounds(selectionX: &tmp1, selectionWidth: &tmp2);
661 }
662
663 QTextEngine *eng;
664
665 QFixed x;
666 const QScriptLine &line;
667 QScriptItem *si;
668
669 const int lineNum;
670 const int lineEnd;
671 const int firstItem;
672 const int lastItem;
673 const int nItems;
674 int logicalItem;
675 int item;
676 int itemLength;
677
678 int glyphsStart;
679 int glyphsEnd;
680 int itemStart;
681 int itemEnd;
682
683 QFixed itemWidth;
684
685 QVarLengthArray<int> visualOrder;
686
687 const QTextLayout::FormatRange *selection;
688};
689
690QT_END_NAMESPACE
691
692#endif // QTEXTENGINE_P_H
693

source code of qtbase/src/gui/text/qtextengine_p.h