text/qglyphrun.cpp

Source codeSwitch to Preprocessed file
LineSource CodeCoverage
1/**************************************************************************** -
2** -
3** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -
4** Contact: http://www.qt-project.org/legal -
5** -
6** This file is part of the QtGui module of the Qt Toolkit. -
7** -
8** $QT_BEGIN_LICENSE:LGPL$ -
9** Commercial License Usage -
10** Licensees holding valid commercial Qt licenses may use this file in -
11** accordance with the commercial license agreement provided with the -
12** Software or, alternatively, in accordance with the terms contained in -
13** a written agreement between you and Digia. For licensing terms and -
14** conditions see http://qt.digia.com/licensing. For further information -
15** use the contact form at http://qt.digia.com/contact-us. -
16** -
17** GNU Lesser General Public License Usage -
18** Alternatively, this file may be used under the terms of the GNU Lesser -
19** General Public License version 2.1 as published by the Free Software -
20** Foundation and appearing in the file LICENSE.LGPL included in the -
21** packaging of this file. Please review the following information to -
22** ensure the GNU Lesser General Public License version 2.1 requirements -
23** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -
24** -
25** In addition, as a special exception, Digia gives you certain additional -
26** rights. These rights are described in the Digia Qt LGPL Exception -
27** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -
28** -
29** GNU General Public License Usage -
30** Alternatively, this file may be used under the terms of the GNU -
31** General Public License version 3.0 as published by the Free Software -
32** Foundation and appearing in the file LICENSE.GPL included in the -
33** packaging of this file. Please review the following information to -
34** ensure the GNU General Public License version 3.0 requirements will be -
35** met: http://www.gnu.org/copyleft/gpl.html. -
36** -
37** -
38** $QT_END_LICENSE$ -
39** -
40****************************************************************************/ -
41 -
42#include "qglobal.h" -
43 -
44#if !defined(QT_NO_RAWFONT) -
45 -
46#include "qglyphrun.h" -
47#include "qglyphrun_p.h" -
48#include <qdebug.h> -
49 -
50QT_BEGIN_NAMESPACE -
51 -
52/*! -
53 \class QGlyphRun -
54 \brief The QGlyphRun class provides direct access to the internal glyphs in a font. -
55 \since 4.8 -
56 \inmodule QtGui -
57 -
58 \ingroup text -
59 \ingroup shared -
60 \mainclass -
61 -
62 When Qt displays a string of text encoded in Unicode, it will first convert the Unicode points -
63 into a list of glyph indexes and a list of positions based on one or more fonts. The Unicode -
64 representation of the text and the QFont object will in this case serve as a convenient -
65 abstraction that hides the details of what actually takes place when displaying the text -
66 on-screen. For instance, by the time the text actually reaches the screen, it may be represented -
67 by a set of fonts in addition to the one specified by the user, e.g. in case the originally -
68 selected font did not support all the writing systems contained in the text. -
69 -
70 Under certain circumstances, it can be useful as an application developer to have more low-level -
71 control over which glyphs in a specific font are drawn to the screen. This could for instance -
72 be the case in applications that use an external font engine and text shaper together with Qt. -
73 QGlyphRun provides an interface to the raw data needed to get text on the screen. It -
74 contains a list of glyph indexes, a position for each glyph and a font. -
75 -
76 It is the user's responsibility to ensure that the selected font actually contains the -
77 provided glyph indexes. -
78 -
79 QTextLayout::glyphRuns() or QTextFragment::glyphRuns() can be used to convert unicode encoded -
80 text into a list of QGlyphRun objects, and QPainter::drawGlyphRun() can be used to draw the -
81 glyphs. -
82 -
83 \note Please note that QRawFont is considered local to the thread in which it is constructed. -
84 This in turn means that a new QRawFont will have to be created and set on the QGlyphRun if it is -
85 moved to a different thread. If the QGlyphRun contains a reference to a QRawFont from a different -
86 thread than the current, it will not be possible to draw the glyphs using a QPainter, as the -
87 QRawFont is considered invalid and inaccessible in this case. -
88*/ -
89 -
90/*! -
91 \enum QGlyphRun::GlyphRunFlag -
92 \since 5.0 -
93 -
94 This enum describes flags that alter the way the run of glyphs might be presented or behave in -
95 a visual layout. The layout which generates the glyph runs can set these flags based on relevant -
96 internal data, to retain information needed to present the text as intended by the user of the -
97 layout. -
98 -
99 \value Overline Indicates that the glyphs should be visualized together with an overline. -
100 \value Underline Indicates that the glyphs should be visualized together with an underline. -
101 \value StrikeOut Indicates that the glyphs should be struck out visually. -
102 \value RightToLeft Indicates that the glyphs are ordered right to left. This can affect the -
103 positioning of other screen elements that are relative to the glyph run, such as an inline -
104 text object. -
105 \value SplitLigature Indicates that the glyph run splits a ligature glyph. This means -
106 that a ligature glyph is included in the run, but the characters represented by it corresponds -
107 only to part of that ligature. The glyph run's boundingRect() function can in this case be used -
108 to retrieve the area covered by glyphs that correspond to the characters represented by the -
109 glyph run. When visualizing the glyphs, care needs to be taken to clip to this bounding rect to -
110 ensure that only the corresponding part of the ligature is painted. In particular, this can be -
111 the case when retrieving a glyph run from a QTextLayout for a specific character range, e.g. -
112 when retrieving the selected area of a QTextLayout. -
113*/ -
114 -
115/*! -
116 Constructs an empty QGlyphRun object. -
117*/ -
118QGlyphRun::QGlyphRun() : d(new QGlyphRunPrivate) -
119{ -
120}
executed: }
Execution Count:59
59
121 -
122/*! -
123 Constructs a QGlyphRun object which is a copy of \a other. -
124*/ -
125QGlyphRun::QGlyphRun(const QGlyphRun &other) -
126{ -
127 d = other.d;
executed (the execution status of this line is deduced): d = other.d;
-
128}
executed: }
Execution Count:109
109
129 -
130/*! -
131 Destroys the QGlyphRun. -
132*/ -
133QGlyphRun::~QGlyphRun() -
134{ -
135 // Required for QExplicitlySharedDataPointer -
136} -
137 -
138/*! -
139 \internal -
140*/ -
141void QGlyphRun::detach() -
142{ -
143 if (d->ref.load() != 1)
evaluated: d->ref.load() != 1
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:142
5-142
144 d.detach();
executed: d.detach();
Execution Count:5
5
145}
executed: }
Execution Count:147
147
146 -
147/*! -
148 Assigns \a other to this QGlyphRun object. -
149*/ -
150QGlyphRun &QGlyphRun::operator=(const QGlyphRun &other) -
151{ -
152 d = other.d;
executed (the execution status of this line is deduced): d = other.d;
-
153 return *this;
executed: return *this;
Execution Count:24
24
154} -
155 -
156/*! -
157 \fn void QGlyphRun::swap(QGlyphRun &other) -
158 \since 5.0 -
159 -
160 Swaps this glyph run instance with \a other. This function is very -
161 fast and never fails. -
162*/ -
163 -
164/*! -
165 Compares \a other to this QGlyphRun object. Returns true if the list of glyph indexes, -
166 the list of positions and the font are all equal, otherwise returns false. -
167*/ -
168bool QGlyphRun::operator==(const QGlyphRun &other) const -
169{ -
170 if (d == other.d)
partially evaluated: d == other.d
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:9
0-9
171 return true;
never executed: return true;
0
172 -
173 if ((d->glyphIndexDataSize != other.d->glyphIndexDataSize)
partially evaluated: (d->glyphIndexDataSize != other.d->glyphIndexDataSize)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:9
0-9
174 || (d->glyphPositionDataSize != other.d->glyphPositionDataSize)) {
partially evaluated: (d->glyphPositionDataSize != other.d->glyphPositionDataSize)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:9
0-9
175 return false;
never executed: return false;
0
176 } -
177 -
178 if (d->glyphIndexData != other.d->glyphIndexData) {
evaluated: d->glyphIndexData != other.d->glyphIndexData
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:1
1-8
179 for (int i = 0; i < d->glyphIndexDataSize; ++i) {
evaluated: i < d->glyphIndexDataSize
TRUEFALSE
yes
Evaluation Count:24
yes
Evaluation Count:6
6-24
180 if (d->glyphIndexData[i] != other.d->glyphIndexData[i])
evaluated: d->glyphIndexData[i] != other.d->glyphIndexData[i]
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:22
2-22
181 return false;
executed: return false;
Execution Count:2
2
182 }
executed: }
Execution Count:22
22
183 }
executed: }
Execution Count:6
6
184 if (d->glyphPositionData != other.d->glyphPositionData) {
evaluated: d->glyphPositionData != other.d->glyphPositionData
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:1
1-6
185 for (int i = 0; i < d->glyphPositionDataSize; ++i) {
evaluated: i < d->glyphPositionDataSize
TRUEFALSE
yes
Evaluation Count:18
yes
Evaluation Count:4
4-18
186 if (d->glyphPositionData[i] != other.d->glyphPositionData[i])
evaluated: d->glyphPositionData[i] != other.d->glyphPositionData[i]
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:16
2-16
187 return false;
executed: return false;
Execution Count:2
2
188 }
executed: }
Execution Count:16
16
189 }
executed: }
Execution Count:4
4
190 -
191 return (d->flags == other.d->flags && d->rawFont == other.d->rawFont);
executed: return (d->flags == other.d->flags && d->rawFont == other.d->rawFont);
Execution Count:5
5
192} -
193 -
194/*! -
195 \fn bool QGlyphRun::operator!=(const QGlyphRun &other) const -
196 -
197 Compares \a other to this QGlyphRun object. Returns true if any of the list of glyph -
198 indexes, the list of positions or the font are different, otherwise returns false. -
199*/ -
200 -
201/*! -
202 Returns the font selected for this QGlyphRun object. -
203 -
204 \sa setRawFont() -
205*/ -
206QRawFont QGlyphRun::rawFont() const -
207{ -
208 return d->rawFont;
executed: return d->rawFont;
Execution Count:49
49
209} -
210 -
211/*! -
212 Sets the font in which to look up the glyph indexes to the \a rawFont -
213 specified. -
214 -
215 \sa rawFont(), setGlyphIndexes() -
216*/ -
217void QGlyphRun::setRawFont(const QRawFont &rawFont) -
218{ -
219 detach();
executed (the execution status of this line is deduced): detach();
-
220 d->rawFont = rawFont;
executed (the execution status of this line is deduced): d->rawFont = rawFont;
-
221}
executed: }
Execution Count:32
32
222 -
223/*! -
224 Returns the glyph indexes for this QGlyphRun object. -
225 -
226 \sa setGlyphIndexes(), setPositions() -
227*/ -
228QVector<quint32> QGlyphRun::glyphIndexes() const -
229{ -
230 if (d->glyphIndexes.constData() == d->glyphIndexData) {
evaluated: d->glyphIndexes.constData() == d->glyphIndexData
TRUEFALSE
yes
Evaluation Count:13
yes
Evaluation Count:1
1-13
231 return d->glyphIndexes;
executed: return d->glyphIndexes;
Execution Count:13
13
232 } else { -
233 QVector<quint32> indexes(d->glyphIndexDataSize);
executed (the execution status of this line is deduced): QVector<quint32> indexes(d->glyphIndexDataSize);
-
234 memcpy(indexes.data(), d->glyphIndexData, d->glyphIndexDataSize * sizeof(quint32));
executed (the execution status of this line is deduced): memcpy(indexes.data(), d->glyphIndexData, d->glyphIndexDataSize * sizeof(quint32));
-
235 return indexes;
executed: return indexes;
Execution Count:1
1
236 } -
237} -
238 -
239/*! -
240 Set the glyph indexes for this QGlyphRun object to \a glyphIndexes. The glyph indexes must -
241 be valid for the selected font. -
242*/ -
243void QGlyphRun::setGlyphIndexes(const QVector<quint32> &glyphIndexes) -
244{ -
245 detach();
executed (the execution status of this line is deduced): detach();
-
246 d->glyphIndexes = glyphIndexes; // Keep a reference to the QVector to avoid copying
executed (the execution status of this line is deduced): d->glyphIndexes = glyphIndexes;
-
247 d->glyphIndexData = glyphIndexes.constData();
executed (the execution status of this line is deduced): d->glyphIndexData = glyphIndexes.constData();
-
248 d->glyphIndexDataSize = glyphIndexes.size();
executed (the execution status of this line is deduced): d->glyphIndexDataSize = glyphIndexes.size();
-
249}
executed: }
Execution Count:37
37
250 -
251/*! -
252 Returns the position of the edge of the baseline for each glyph in this set of glyph indexes. -
253*/ -
254QVector<QPointF> QGlyphRun::positions() const -
255{ -
256 if (d->glyphPositions.constData() == d->glyphPositionData) {
evaluated: d->glyphPositions.constData() == d->glyphPositionData
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:1
1-5
257 return d->glyphPositions;
executed: return d->glyphPositions;
Execution Count:5
5
258 } else { -
259 QVector<QPointF> glyphPositions(d->glyphPositionDataSize);
executed (the execution status of this line is deduced): QVector<QPointF> glyphPositions(d->glyphPositionDataSize);
-
260 memcpy(glyphPositions.data(), d->glyphPositionData,
executed (the execution status of this line is deduced): memcpy(glyphPositions.data(), d->glyphPositionData,
-
261 d->glyphPositionDataSize * sizeof(QPointF));
executed (the execution status of this line is deduced): d->glyphPositionDataSize * sizeof(QPointF));
-
262 return glyphPositions;
executed: return glyphPositions;
Execution Count:1
1
263 } -
264} -
265 -
266/*! -
267 Sets the positions of the edge of the baseline for each glyph in this set of glyph indexes to -
268 \a positions. -
269*/ -
270void QGlyphRun::setPositions(const QVector<QPointF> &positions) -
271{ -
272 detach();
executed (the execution status of this line is deduced): detach();
-
273 d->glyphPositions = positions; // Keep a reference to the vector to avoid copying
executed (the execution status of this line is deduced): d->glyphPositions = positions;
-
274 d->glyphPositionData = positions.constData();
executed (the execution status of this line is deduced): d->glyphPositionData = positions.constData();
-
275 d->glyphPositionDataSize = positions.size();
executed (the execution status of this line is deduced): d->glyphPositionDataSize = positions.size();
-
276}
executed: }
Execution Count:34
34
277 -
278/*! -
279 Clears all data in the QGlyphRun object. -
280*/ -
281void QGlyphRun::clear() -
282{ -
283 detach();
executed (the execution status of this line is deduced): detach();
-
284 d->rawFont = QRawFont();
executed (the execution status of this line is deduced): d->rawFont = QRawFont();
-
285 d->flags = 0;
executed (the execution status of this line is deduced): d->flags = 0;
-
286 -
287 setPositions(QVector<QPointF>());
executed (the execution status of this line is deduced): setPositions(QVector<QPointF>());
-
288 setGlyphIndexes(QVector<quint32>());
executed (the execution status of this line is deduced): setGlyphIndexes(QVector<quint32>());
-
289}
executed: }
Execution Count:2
2
290 -
291/*! -
292 Sets the glyph indexes and positions of this QGlyphRun to use the first \a size -
293 elements in the arrays \a glyphIndexArray and \a glyphPositionArray. The data is -
294 \e not copied. The caller must guarantee that the arrays are not deleted as long -
295 as this QGlyphRun and any copies of it exists. -
296 -
297 \sa setGlyphIndexes(), setPositions() -
298*/ -
299void QGlyphRun::setRawData(const quint32 *glyphIndexArray, const QPointF *glyphPositionArray, -
300 int size) -
301{ -
302 detach();
executed (the execution status of this line is deduced): detach();
-
303 d->glyphIndexes.clear();
executed (the execution status of this line is deduced): d->glyphIndexes.clear();
-
304 d->glyphPositions.clear();
executed (the execution status of this line is deduced): d->glyphPositions.clear();
-
305 -
306 d->glyphIndexData = glyphIndexArray;
executed (the execution status of this line is deduced): d->glyphIndexData = glyphIndexArray;
-
307 d->glyphPositionData = glyphPositionArray;
executed (the execution status of this line is deduced): d->glyphPositionData = glyphPositionArray;
-
308 d->glyphIndexDataSize = d->glyphPositionDataSize = size;
executed (the execution status of this line is deduced): d->glyphIndexDataSize = d->glyphPositionDataSize = size;
-
309}
executed: }
Execution Count:5
5
310 -
311/*! -
312 Returns true if this QGlyphRun should be painted with an overline decoration. -
313 -
314 \sa setOverline(), flags() -
315*/ -
316bool QGlyphRun::overline() const -
317{ -
318 return d->flags & Overline;
executed: return d->flags & Overline;
Execution Count:12
12
319} -
320 -
321/*! -
322 Indicates that this QGlyphRun should be painted with an overline decoration if \a overline is true. -
323 Otherwise the QGlyphRun should be painted with no overline decoration. -
324 -
325 \sa overline(), setFlag(), setFlags() -
326*/ -
327void QGlyphRun::setOverline(bool overline) -
328{ -
329 setFlag(Overline, overline);
never executed (the execution status of this line is deduced): setFlag(Overline, overline);
-
330}
never executed: }
0
331 -
332/*! -
333 Returns true if this QGlyphRun should be painted with an underline decoration. -
334 -
335 \sa setUnderline(), flags() -
336*/ -
337bool QGlyphRun::underline() const -
338{ -
339 return d->flags & Underline;
executed: return d->flags & Underline;
Execution Count:12
12
340} -
341 -
342/*! -
343 Indicates that this QGlyphRun should be painted with an underline decoration if \a underline is -
344 true. Otherwise the QGlyphRun should be painted with no underline decoration. -
345 -
346 \sa underline(), setFlag(), setFlags() -
347*/ -
348void QGlyphRun::setUnderline(bool underline) -
349{ -
350 setFlag(Underline, underline);
never executed (the execution status of this line is deduced): setFlag(Underline, underline);
-
351}
never executed: }
0
352 -
353/*! -
354 Returns true if this QGlyphRun should be painted with a strike out decoration. -
355 -
356 \sa setStrikeOut(), flags() -
357*/ -
358bool QGlyphRun::strikeOut() const -
359{ -
360 return d->flags & StrikeOut;
executed: return d->flags & StrikeOut;
Execution Count:12
12
361} -
362 -
363/*! -
364 Indicates that this QGlyphRun should be painted with an strike out decoration if \a strikeOut is -
365 true. Otherwise the QGlyphRun should be painted with no strike out decoration. -
366 -
367 \sa strikeOut(), setFlag(), setFlags() -
368*/ -
369void QGlyphRun::setStrikeOut(bool strikeOut) -
370{ -
371 setFlag(StrikeOut, strikeOut);
never executed (the execution status of this line is deduced): setFlag(StrikeOut, strikeOut);
-
372}
never executed: }
0
373 -
374/*! -
375 Returns true if this QGlyphRun contains glyphs that are painted from the right to the left. -
376 -
377 \since 5.0 -
378 \sa setRightToLeft(), flags() -
379*/ -
380bool QGlyphRun::isRightToLeft() const -
381{ -
382 return d->flags & RightToLeft;
never executed: return d->flags & RightToLeft;
0
383} -
384 -
385/*! -
386 Indicates that this QGlyphRun contains glyphs that should be ordered from the right to left -
387 if \a rightToLeft is true. Otherwise the order of the glyphs is assumed to be left to right. -
388 -
389 \since 5.0 -
390 \sa isRightToLeft(), setFlag(), setFlags() -
391*/ -
392void QGlyphRun::setRightToLeft(bool rightToLeft) -
393{ -
394 setFlag(RightToLeft, rightToLeft);
never executed (the execution status of this line is deduced): setFlag(RightToLeft, rightToLeft);
-
395}
never executed: }
0
396 -
397/*! -
398 Returns the flags set for this QGlyphRun. -
399 -
400 \since 5.0 -
401 \sa setFlag(), setFlag() -
402*/ -
403QGlyphRun::GlyphRunFlags QGlyphRun::flags() const -
404{ -
405 return d->flags;
executed: return d->flags;
Execution Count:23
23
406} -
407 -
408/*! -
409 If \a enabled is true, then \a flag is enabled; otherwise, it is disabled. -
410 -
411 \since 5.0 -
412 \sa flags(), setFlags() -
413*/ -
414void QGlyphRun::setFlag(GlyphRunFlag flag, bool enabled) -
415{ -
416 if (d->flags.testFlag(flag) == enabled)
never evaluated: d->flags.testFlag(flag) == enabled
0
417 return;
never executed: return;
0
418 -
419 detach();
never executed (the execution status of this line is deduced): detach();
-
420 if (enabled)
never evaluated: enabled
0
421 d->flags |= flag;
never executed: d->flags |= flag;
0
422 else -
423 d->flags &= ~flag;
never executed: d->flags &= ~flag;
0
424} -
425 -
426/*! -
427 Sets the flags of this QGlyphRun to \a flags. -
428 -
429 \since 5.0 -
430 \sa setFlag(), flags() -
431*/ -
432void QGlyphRun::setFlags(GlyphRunFlags flags) -
433{ -
434 if (d->flags == flags)
evaluated: d->flags == flags
TRUEFALSE
yes
Evaluation Count:10
yes
Evaluation Count:13
10-13
435 return;
executed: return;
Execution Count:10
10
436 -
437 detach();
executed (the execution status of this line is deduced): detach();
-
438 d->flags = flags;
executed (the execution status of this line is deduced): d->flags = flags;
-
439}
executed: }
Execution Count:13
13
440 -
441/*! -
442 Sets the bounding rect of the glyphs in this QGlyphRun to be \a boundingRect. This rectangle -
443 will be returned by boundingRect() unless it is empty, in which case the bounding rectangle of the -
444 glyphs in the glyph run will be returned instead. -
445 -
446 \note Unless you are implementing text shaping, you should not have to use this function. -
447 It is used specifically when the QGlyphRun should represent an area which is smaller than the -
448 area of the glyphs it contains. This could happen e.g. if the glyph run is retrieved by calling -
449 QTextLayout::glyphRuns() and the specified range only includes part of a ligature (where two or -
450 more characters are combined to a single glyph.) When this is the case, the bounding rect should -
451 only include the appropriate part of the ligature glyph, based on a calculation of the average -
452 width of the characters in the ligature. -
453 -
454 In order to support such a case (an example is selections which should be drawn with a different -
455 color than the main text color), it is necessary to clip the painting mechanism to the rectangle -
456 returned from boundingRect() to avoid drawing the entire ligature glyph. -
457 -
458 \sa boundingRect() -
459 -
460 \since 5.0 -
461*/ -
462void QGlyphRun::setBoundingRect(const QRectF &boundingRect) -
463{ -
464 detach();
executed (the execution status of this line is deduced): detach();
-
465 d->boundingRect = boundingRect;
executed (the execution status of this line is deduced): d->boundingRect = boundingRect;
-
466}
executed: }
Execution Count:24
24
467 -
468/*! -
469 Returns the smallest rectangle that contains all glyphs in this QGlyphRun. If a bounding rect -
470 has been set using setBoundingRect(), then this will be returned. Otherwise the bounding rect -
471 will be calculated based on the font metrics of the glyphs in the glyph run. -
472 -
473 \since 5.0 -
474*/ -
475QRectF QGlyphRun::boundingRect() const -
476{ -
477 if (!d->boundingRect.isEmpty() || !d->rawFont.isValid())
evaluated: !d->boundingRect.isEmpty()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:2
partially evaluated: !d->rawFont.isValid()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
478 return d->boundingRect;
executed: return d->boundingRect;
Execution Count:1
1
479 -
480 qreal minX, minY, maxX, maxY;
executed (the execution status of this line is deduced): qreal minX, minY, maxX, maxY;
-
481 minX = minY = maxX = maxY = 0;
executed (the execution status of this line is deduced): minX = minY = maxX = maxY = 0;
-
482 -
483 for (int i = 0, n = qMin(d->glyphIndexDataSize, d->glyphPositionDataSize); i < n; ++i) {
evaluated: i < n
TRUEFALSE
yes
Evaluation Count:10
yes
Evaluation Count:2
2-10
484 QRectF glyphRect = d->rawFont.boundingRect(d->glyphIndexData[i]);
executed (the execution status of this line is deduced): QRectF glyphRect = d->rawFont.boundingRect(d->glyphIndexData[i]);
-
485 glyphRect.translate(d->glyphPositionData[i]);
executed (the execution status of this line is deduced): glyphRect.translate(d->glyphPositionData[i]);
-
486 -
487 if (i == 0) {
evaluated: i == 0
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:8
2-8
488 minX = glyphRect.left();
executed (the execution status of this line is deduced): minX = glyphRect.left();
-
489 minY = glyphRect.top();
executed (the execution status of this line is deduced): minY = glyphRect.top();
-
490 maxX = glyphRect.right();
executed (the execution status of this line is deduced): maxX = glyphRect.right();
-
491 maxY = glyphRect.bottom();
executed (the execution status of this line is deduced): maxY = glyphRect.bottom();
-
492 } else {
executed: }
Execution Count:2
2
493 minX = qMin(glyphRect.left(), minX);
executed (the execution status of this line is deduced): minX = qMin(glyphRect.left(), minX);
-
494 minY = qMin(glyphRect.top(), minY);
executed (the execution status of this line is deduced): minY = qMin(glyphRect.top(), minY);
-
495 maxX = qMax(glyphRect.right(),maxX);
executed (the execution status of this line is deduced): maxX = qMax(glyphRect.right(),maxX);
-
496 maxY = qMax(glyphRect.bottom(), maxY);
executed (the execution status of this line is deduced): maxY = qMax(glyphRect.bottom(), maxY);
-
497 }
executed: }
Execution Count:8
8
498 } -
499 -
500 return QRectF(QPointF(minX, minY), QPointF(maxX, maxY));
executed: return QRectF(QPointF(minX, minY), QPointF(maxX, maxY));
Execution Count:2
2
501} -
502 -
503/*! -
504 Returns true if the QGlyphRun does not contain any glyphs. -
505 -
506 \since 5.0 -
507*/ -
508bool QGlyphRun::isEmpty() const -
509{ -
510 return d->glyphIndexDataSize == 0;
executed: return d->glyphIndexDataSize == 0;
Execution Count:27
27
511} -
512 -
513QT_END_NAMESPACE -
514 -
515#endif // QT_NO_RAWFONT -
516 -
Source codeSwitch to Preprocessed file

Generated by Squish Coco Non-Commercial