text/qtextengine.cpp

Switch to Source codePreprocessed file
LineSource CodeCoverage
1 -
2 -
3 -
4 -
5 -
6 -
7static const float smallCapsFraction = 0.7f; -
8 -
9namespace { -
10 -
11 -
12class Itemizer { -
13public: -
14 Itemizer(const QString &string, const QScriptAnalysis *analysis, QScriptItemArray &items) -
15 : m_string(string), -
16 m_analysis(analysis), -
17 m_items(items), -
18 m_splitter(0) -
19 { -
20 }
executed: }
Execution Count:226652
226652
21 ~Itemizer() -
22 { -
23 delete m_splitter; -
24 }
executed: }
Execution Count:226652
226652
25 -
26 -
27 -
28 void generate(int start, int length, QFont::Capitalization caps) -
29 { -
30 if ((int)caps == (int)QFont::SmallCaps)
evaluated: (int)caps == (int)QFont::SmallCaps
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:227296
1-227296
31 generateScriptItemsSmallCaps(reinterpret_cast<const ushort *>(m_string.unicode()), start, length);
executed: generateScriptItemsSmallCaps(reinterpret_cast<const ushort *>(m_string.unicode()), start, length);
Execution Count:1
1
32 else if(caps == QFont::Capitalize)
partially evaluated: caps == QFont::Capitalize
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:227296
0-227296
33 generateScriptItemsCapitalize(start, length);
never executed: generateScriptItemsCapitalize(start, length);
0
34 else if(caps != QFont::MixedCase) {
partially evaluated: caps != QFont::MixedCase
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:227296
0-227296
35 generateScriptItemsAndChangeCase(start, length, -
36 caps == QFont::AllLowercase ? QScriptAnalysis::Lowercase : QScriptAnalysis::Uppercase); -
37 }
never executed: }
0
38 else -
39 generateScriptItems(start, length);
executed: generateScriptItems(start, length);
Execution Count:227296
227296
40 } -
41 -
42private: -
43 enum { MaxItemLength = 4096 }; -
44 -
45 void generateScriptItemsAndChangeCase(int start, int length, QScriptAnalysis::Flags flags) -
46 { -
47 generateScriptItems(start, length); -
48 if (m_items.isEmpty())
never evaluated: m_items.isEmpty()
0
49 return;
never executed: return;
0
50 QScriptItemArray::Iterator iter = m_items.end(); -
51 do { -
52 iter--; -
53 if (iter->analysis.flags < QScriptAnalysis::LineOrParagraphSeparator)
never evaluated: iter->analysis.flags < QScriptAnalysis::LineOrParagraphSeparator
0
54 iter->analysis.flags = flags;
never executed: iter->analysis.flags = flags;
0
55 } while (iter->position > start);
never executed: }
never evaluated: iter->position > start
0
56 }
never executed: }
0
57 -
58 void generateScriptItems(int start, int length) -
59 { -
60 if (!length)
partially evaluated: !length
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:227296
0-227296
61 return;
never executed: return;
0
62 const int end = start + length; -
63 for (int i = start + 1; i < end; ++i) {
evaluated: i < end
TRUEFALSE
yes
Evaluation Count:3164585
yes
Evaluation Count:227296
227296-3164585
64 if (m_analysis[i].bidiLevel == m_analysis[start].bidiLevel
evaluated: m_analysis[i].bidiLevel == m_analysis[start].bidiLevel
TRUEFALSE
yes
Evaluation Count:3164094
yes
Evaluation Count:491
491-3164094
65 && m_analysis[i].flags == m_analysis[start].flags
evaluated: m_analysis[i].flags == m_analysis[start].flags
TRUEFALSE
yes
Evaluation Count:3142575
yes
Evaluation Count:21519
21519-3142575
66 && (m_analysis[i].script == m_analysis[start].script || m_string[i] == QLatin1Char('.'))
evaluated: m_analysis[i].script == m_analysis[start].script
TRUEFALSE
yes
Evaluation Count:3141928
yes
Evaluation Count:647
evaluated: m_string[i] == QLatin1Char('.')
TRUEFALSE
yes
Evaluation Count:39
yes
Evaluation Count:608
39-3141928
67 && m_analysis[i].flags < QScriptAnalysis::SpaceTabOrObject
evaluated: m_analysis[i].flags < QScriptAnalysis::SpaceTabOrObject
TRUEFALSE
yes
Evaluation Count:3141965
yes
Evaluation Count:2
2-3141965
68 && i - start < MaxItemLength)
evaluated: i - start < MaxItemLength
TRUEFALSE
yes
Evaluation Count:3141635
yes
Evaluation Count:330
330-3141635
69 continue;
executed: continue;
Execution Count:3141635
3141635
70 m_items.append(QScriptItem(start, m_analysis[start])); -
71 start = i; -
72 }
executed: }
Execution Count:22950
22950
73 m_items.append(QScriptItem(start, m_analysis[start])); -
74 }
executed: }
Execution Count:227296
227296
75 -
76 void generateScriptItemsCapitalize(int start, int length) -
77 { -
78 if (!length)
never evaluated: !length
0
79 return;
never executed: return;
0
80 -
81 if (!m_splitter)
never evaluated: !m_splitter
0
82 m_splitter = new QTextBoundaryFinder(QTextBoundaryFinder::Word, 0
83 m_string.constData(), m_string.length(), 0
84 0, 0);
never executed: m_splitter = new QTextBoundaryFinder(QTextBoundaryFinder::Word, m_string.constData(), m_string.length(), 0, 0);
0
85 -
86 m_splitter->setPosition(start); -
87 QScriptAnalysis itemAnalysis = m_analysis[start]; -
88 -
89 if (m_splitter->boundaryReasons() & QTextBoundaryFinder::StartOfItem)
never evaluated: m_splitter->boundaryReasons() & QTextBoundaryFinder::StartOfItem
0
90 itemAnalysis.flags = QScriptAnalysis::Uppercase;
never executed: itemAnalysis.flags = QScriptAnalysis::Uppercase;
0
91 -
92 m_splitter->toNextBoundary(); -
93 -
94 const int end = start + length; -
95 for (int i = start + 1; i < end; ++i) {
never evaluated: i < end
0
96 bool atWordStart = false; -
97 -
98 if (i == m_splitter->position()) {
never evaluated: i == m_splitter->position()
0
99 if (m_splitter->boundaryReasons() & QTextBoundaryFinder::StartOfItem) {
never evaluated: m_splitter->boundaryReasons() & QTextBoundaryFinder::StartOfItem
0
100 qt_noop(); -
101 atWordStart = true; -
102 }
never executed: }
0
103 -
104 m_splitter->toNextBoundary(); -
105 }
never executed: }
0
106 -
107 if (m_analysis[i] == itemAnalysis
never evaluated: m_analysis[i] == itemAnalysis
0
108 && m_analysis[i].flags < QScriptAnalysis::TabOrObject
never evaluated: m_analysis[i].flags < QScriptAnalysis::TabOrObject
0
109 && !atWordStart
never evaluated: !atWordStart
0
110 && i - start < MaxItemLength)
never evaluated: i - start < MaxItemLength
0
111 continue;
never executed: continue;
0
112 -
113 m_items.append(QScriptItem(start, itemAnalysis)); -
114 start = i; -
115 itemAnalysis = m_analysis[start]; -
116 -
117 if (atWordStart)
never evaluated: atWordStart
0
118 itemAnalysis.flags = QScriptAnalysis::Uppercase;
never executed: itemAnalysis.flags = QScriptAnalysis::Uppercase;
0
119 }
never executed: }
0
120 m_items.append(QScriptItem(start, itemAnalysis)); -
121 }
never executed: }
0
122 -
123 void generateScriptItemsSmallCaps(const ushort *uc, int start, int length) -
124 { -
125 if (!length)
partially evaluated: !length
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
126 return;
never executed: return;
0
127 bool lower = (QChar::category(uc[start]) == QChar::Letter_Lowercase); -
128 const int end = start + length; -
129 -
130 for (int i = start + 1; i < end; ++i) {
evaluated: i < end
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:1
1-3
131 bool l = (QChar::category(uc[i]) == QChar::Letter_Lowercase); -
132 if ((m_analysis[i] == m_analysis[start])
partially evaluated: (m_analysis[i] == m_analysis[start])
TRUEFALSE
yes
Evaluation Count:3
no
Evaluation Count:0
0-3
133 && m_analysis[i].flags < QScriptAnalysis::TabOrObject
partially evaluated: m_analysis[i].flags < QScriptAnalysis::TabOrObject
TRUEFALSE
yes
Evaluation Count:3
no
Evaluation Count:0
0-3
134 && l == lower
evaluated: l == lower
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:1
1-2
135 && i - start < MaxItemLength)
partially evaluated: i - start < MaxItemLength
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
0-2
136 continue;
executed: continue;
Execution Count:2
2
137 m_items.append(QScriptItem(start, m_analysis[start])); -
138 if (lower)
partially evaluated: lower
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
139 m_items.last().analysis.flags = QScriptAnalysis::SmallCaps;
never executed: m_items.last().analysis.flags = QScriptAnalysis::SmallCaps;
0
140 -
141 start = i; -
142 lower = l; -
143 }
executed: }
Execution Count:1
1
144 m_items.append(QScriptItem(start, m_analysis[start])); -
145 if (lower)
partially evaluated: lower
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-1
146 m_items.last().analysis.flags = QScriptAnalysis::SmallCaps;
executed: m_items.last().analysis.flags = QScriptAnalysis::SmallCaps;
Execution Count:1
1
147 }
executed: }
Execution Count:1
1
148 -
149 const QString &m_string; -
150 const QScriptAnalysis * const m_analysis; -
151 QScriptItemArray &m_items; -
152 QTextBoundaryFinder *m_splitter; -
153}; -
154} -
155struct QBidiStatus { -
156 QBidiStatus() { -
157 eor = QChar::DirON; -
158 lastStrong = QChar::DirON; -
159 last = QChar:: DirON; -
160 dir = QChar::DirON; -
161 }
executed: }
Execution Count:1533
1533
162 QChar::Direction eor; -
163 QChar::Direction lastStrong; -
164 QChar::Direction last; -
165 QChar::Direction dir; -
166}; -
167 -
168enum { MaxBidiLevel = 61 }; -
169 -
170struct QBidiControl { -
171 inline QBidiControl(bool rtl) -
172 : cCtx(0), base(rtl ? 1 : 0), level(rtl ? 1 : 0), override(false) {}
executed: }
Execution Count:226652
226652
173 -
174 inline void embed(bool rtl, bool o = false) { -
175 unsigned int toAdd = 1; -
176 if((level%2 != 0) == rtl ) {
evaluated: (level%2 != 0) == rtl
TRUEFALSE
yes
Evaluation Count:34
yes
Evaluation Count:39
34-39
177 ++toAdd; -
178 }
executed: }
Execution Count:34
34
179 if (level + toAdd <= MaxBidiLevel) {
partially evaluated: level + toAdd <= MaxBidiLevel
TRUEFALSE
yes
Evaluation Count:73
no
Evaluation Count:0
0-73
180 ctx[cCtx].level = level; -
181 ctx[cCtx].override = override; -
182 cCtx++; -
183 override = o; -
184 level += toAdd; -
185 }
executed: }
Execution Count:73
73
186 }
executed: }
Execution Count:73
73
187 inline bool canPop() const { return cCtx != 0; }
executed: return cCtx != 0;
Execution Count:73
73
188 inline void pdf() { -
189 qt_noop(); -
190 --cCtx; -
191 level = ctx[cCtx].level; -
192 override = ctx[cCtx].override; -
193 }
executed: }
Execution Count:73
73
194 -
195 inline QChar::Direction basicDirection() const { -
196 return (base ? QChar::DirR : QChar:: DirL);
executed: return (base ? QChar::DirR : QChar:: DirL);
Execution Count:3234
3234
197 } -
198 inline unsigned int baseLevel() const { -
199 return base;
executed: return base;
Execution Count:13
13
200 } -
201 inline QChar::Direction direction() const { -
202 return ((level%2) ? QChar::DirR : QChar:: DirL);
executed: return ((level%2) ? QChar::DirR : QChar:: DirL);
Execution Count:531
531
203 } -
204 -
205 struct { -
206 unsigned int level; -
207 bool override; -
208 } ctx[MaxBidiLevel]; -
209 unsigned int cCtx; -
210 const unsigned int base; -
211 unsigned int level; -
212 bool override; -
213}; -
214 -
215 -
216static void appendItems(QScriptAnalysis *analysis, int &start, int &stop, const QBidiControl &control, QChar::Direction dir) -
217{ -
218 if (start > stop)
evaluated: start > stop
TRUEFALSE
yes
Evaluation Count:79
yes
Evaluation Count:2090
79-2090
219 return;
executed: return;
Execution Count:79
79
220 -
221 int level = control.level; -
222 -
223 if(dir != QChar::DirON && !control.override) {
partially evaluated: dir != QChar::DirON
TRUEFALSE
yes
Evaluation Count:2090
no
Evaluation Count:0
evaluated: !control.override
TRUEFALSE
yes
Evaluation Count:2000
yes
Evaluation Count:90
0-2090
224 -
225 if(level % 2) {
evaluated: level % 2
TRUEFALSE
yes
Evaluation Count:510
yes
Evaluation Count:1490
510-1490
226 if(dir == QChar::DirL || dir == QChar::DirAN || dir == QChar::DirEN)
evaluated: dir == QChar::DirL
TRUEFALSE
yes
Evaluation Count:121
yes
Evaluation Count:389
evaluated: dir == QChar::DirAN
TRUEFALSE
yes
Evaluation Count:112
yes
Evaluation Count:277
partially evaluated: dir == QChar::DirEN
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:277
0-389
227 level++;
executed: level++;
Execution Count:233
233
228 } else {
executed: }
Execution Count:510
510
229 if(dir == QChar::DirR)
evaluated: dir == QChar::DirR
TRUEFALSE
yes
Evaluation Count:98
yes
Evaluation Count:1392
98-1392
230 level++;
executed: level++;
Execution Count:98
98
231 else if(dir == QChar::DirAN || dir == QChar::DirEN)
evaluated: dir == QChar::DirAN
TRUEFALSE
yes
Evaluation Count:21
yes
Evaluation Count:1371
partially evaluated: dir == QChar::DirEN
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1371
0-1371
232 level += 2;
executed: level += 2;
Execution Count:21
21
233 } -
234 } -
235 -
236 -
237 -
238 -
239 QScriptAnalysis *s = analysis + start; -
240 const QScriptAnalysis *e = analysis + stop; -
241 while (s <= e) {
evaluated: s <= e
TRUEFALSE
yes
Evaluation Count:491392
yes
Evaluation Count:2090
2090-491392
242 s->bidiLevel = level; -
243 ++s; -
244 }
executed: }
Execution Count:491392
491392
245 ++stop; -
246 start = stop; -
247}
executed: }
Execution Count:2090
2090
248 -
249static QChar::Direction skipBoundryNeutrals(QScriptAnalysis *analysis, -
250 const ushort *unicode, int length, -
251 int &sor, int &eor, QBidiControl &control) -
252{ -
253 QChar::Direction dir = control.basicDirection(); -
254 int level = sor > 0 ? analysis[sor - 1].bidiLevel : control.level;
partially evaluated: sor > 0
TRUEFALSE
yes
Evaluation Count:143
no
Evaluation Count:0
0-143
255 while (sor < length) {
evaluated: sor < length
TRUEFALSE
yes
Evaluation Count:121
yes
Evaluation Count:25
25-121
256 dir = QChar::direction(unicode[sor]); -
257 -
258 if (dir != QChar::DirBN)
evaluated: dir != QChar::DirBN
TRUEFALSE
yes
Evaluation Count:118
yes
Evaluation Count:3
3-118
259 break;
executed: break;
Execution Count:118
118
260 analysis[sor++].bidiLevel = level; -
261 }
executed: }
Execution Count:3
3
262 -
263 eor = sor; -
264 if (eor == length)
evaluated: eor == length
TRUEFALSE
yes
Evaluation Count:25
yes
Evaluation Count:118
25-118
265 dir = control.basicDirection();
executed: dir = control.basicDirection();
Execution Count:25
25
266 -
267 return dir;
executed: return dir;
Execution Count:143
143
268} -
269 -
270 -
271static bool bidiItemize(QTextEngine *engine, QScriptAnalysis *analysis, QBidiControl &control) -
272{ -
273 bool rightToLeft = (control.basicDirection() == 1); -
274 bool hasBidi = rightToLeft; -
275 -
276 -
277 -
278 -
279 int sor = 0; -
280 int eor = -1; -
281 -
282 -
283 int length = engine->layoutData->string.length(); -
284 -
285 const ushort *unicode = (const ushort *)engine->layoutData->string.unicode(); -
286 int current = 0; -
287 -
288 QChar::Direction dir = rightToLeft ? QChar::DirR : QChar::DirL;
evaluated: rightToLeft
TRUEFALSE
yes
Evaluation Count:199
yes
Evaluation Count:1334
199-1334
289 QBidiStatus status; -
290 -
291 QChar::Direction sdir = QChar::direction(*unicode); -
292 if (sdir != QChar::DirL && sdir != QChar::DirR && sdir != QChar::DirEN && sdir != QChar::DirAN)
evaluated: sdir != QChar::DirL
TRUEFALSE
yes
Evaluation Count:1075
yes
Evaluation Count:458
evaluated: sdir != QChar::DirR
TRUEFALSE
yes
Evaluation Count:1006
yes
Evaluation Count:69
evaluated: sdir != QChar::DirEN
TRUEFALSE
yes
Evaluation Count:840
yes
Evaluation Count:166
partially evaluated: sdir != QChar::DirAN
TRUEFALSE
yes
Evaluation Count:840
no
Evaluation Count:0
0-1075
293 sdir = QChar::DirON;
executed: sdir = QChar::DirON;
Execution Count:840
840
294 else -
295 dir = QChar::DirON;
executed: dir = QChar::DirON;
Execution Count:693
693
296 status.eor = sdir; -
297 status.lastStrong = rightToLeft ? QChar::DirR : QChar::DirL;
evaluated: rightToLeft
TRUEFALSE
yes
Evaluation Count:199
yes
Evaluation Count:1334
199-1334
298 status.last = status.lastStrong; -
299 status.dir = sdir; -
300 -
301 -
302 while (current <= length) {
partially evaluated: current <= length
TRUEFALSE
yes
Evaluation Count:492928
no
Evaluation Count:0
0-492928
303 -
304 QChar::Direction dirCurrent; -
305 if (current == (int)length)
evaluated: current == (int)length
TRUEFALSE
yes
Evaluation Count:1533
yes
Evaluation Count:491395
1533-491395
306 dirCurrent = control.basicDirection();
executed: dirCurrent = control.basicDirection();
Execution Count:1533
1533
307 else -
308 dirCurrent = QChar::direction(unicode[current]);
executed: dirCurrent = QChar::direction(unicode[current]);
Execution Count:491395
491395
309 switch(dirCurrent) { -
310 -
311 -
312 case QChar::DirRLE: -
313 case QChar::DirRLO: -
314 case QChar::DirLRE: -
315 case QChar::DirLRO: -
316 { -
317 bool rtl = (dirCurrent == QChar::DirRLE || dirCurrent == QChar::DirRLO);
evaluated: dirCurrent == QChar::DirRLE
TRUEFALSE
yes
Evaluation Count:18
yes
Evaluation Count:55
evaluated: dirCurrent == QChar::DirRLO
TRUEFALSE
yes
Evaluation Count:18
yes
Evaluation Count:37
18-55
318 hasBidi |= rtl; -
319 bool override = (dirCurrent == QChar::DirLRO || dirCurrent == QChar::DirRLO);
evaluated: dirCurrent == QChar::DirLRO
TRUEFALSE
yes
Evaluation Count:18
yes
Evaluation Count:55
evaluated: dirCurrent == QChar::DirRLO
TRUEFALSE
yes
Evaluation Count:18
yes
Evaluation Count:37
18-55
320 -
321 unsigned int level = control.level+1; -
322 if ((level%2 != 0) == rtl) ++level;
executed: ++level;
Execution Count:39
evaluated: (level%2 != 0) == rtl
TRUEFALSE
yes
Evaluation Count:39
yes
Evaluation Count:34
34-39
323 if(level < MaxBidiLevel) {
partially evaluated: level < MaxBidiLevel
TRUEFALSE
yes
Evaluation Count:73
no
Evaluation Count:0
0-73
324 eor = current-1; -
325 appendItems(analysis, sor, eor, control, dir); -
326 eor = current; -
327 control.embed(rtl, override); -
328 QChar::Direction edir = (rtl ? QChar::DirR : QChar::DirL);
evaluated: rtl
TRUEFALSE
yes
Evaluation Count:36
yes
Evaluation Count:37
36-37
329 dir = status.eor = edir; -
330 status.lastStrong = edir; -
331 }
executed: }
Execution Count:73
73
332 break;
executed: break;
Execution Count:73
73
333 } -
334 case QChar::DirPDF: -
335 { -
336 if (control.canPop()) {
partially evaluated: control.canPop()
TRUEFALSE
yes
Evaluation Count:73
no
Evaluation Count:0
0-73
337 if (dir != control.direction()) {
evaluated: dir != control.direction()
TRUEFALSE
yes
Evaluation Count:42
yes
Evaluation Count:31
31-42
338 eor = current-1; -
339 appendItems(analysis, sor, eor, control, dir); -
340 dir = control.direction(); -
341 }
executed: }
Execution Count:42
42
342 eor = current; -
343 appendItems(analysis, sor, eor, control, dir); -
344 control.pdf(); -
345 dir = QChar::DirON; status.eor = QChar::DirON; -
346 status.last = control.direction(); -
347 if (control.override)
evaluated: control.override
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:67
6-67
348 dir = control.direction();
executed: dir = control.direction();
Execution Count:6
6
349 else -
350 dir = QChar::DirON;
executed: dir = QChar::DirON;
Execution Count:67
67
351 status.lastStrong = control.direction(); -
352 }
executed: }
Execution Count:73
73
353 break;
executed: break;
Execution Count:73
73
354 } -
355 -
356 -
357 case QChar::DirL: -
358 if(dir == QChar::DirON)
evaluated: dir == QChar::DirON
TRUEFALSE
yes
Evaluation Count:492
yes
Evaluation Count:211927
492-211927
359 dir = QChar::DirL;
executed: dir = QChar::DirL;
Execution Count:492
492
360 switch(status.last) -
361 { -
362 case QChar::DirL: -
363 eor = current; status.eor = QChar::DirL; break;
executed: break;
Execution Count:145493
145493
364 case QChar::DirR: -
365 case QChar::DirAL: -
366 case QChar::DirEN: -
367 case QChar::DirAN: -
368 if (eor >= 0) {
evaluated: eor >= 0
TRUEFALSE
yes
Evaluation Count:80
yes
Evaluation Count:22
22-80
369 appendItems(analysis, sor, eor, control, dir); -
370 status.eor = dir = skipBoundryNeutrals(analysis, unicode, length, sor, eor, control); -
371 } else {
executed: }
Execution Count:80
80
372 eor = current; status.eor = dir; -
373 }
executed: }
Execution Count:22
22
374 break;
executed: break;
Execution Count:102
102
375 case QChar::DirES: -
376 case QChar::DirET: -
377 case QChar::DirCS: -
378 case QChar::DirBN: -
379 case QChar::DirB: -
380 case QChar::DirS: -
381 case QChar::DirWS: -
382 case QChar::DirON: -
383 if(dir != QChar::DirL) {
evaluated: dir != QChar::DirL
TRUEFALSE
yes
Evaluation Count:108
yes
Evaluation Count:66682
108-66682
384 -
385 if(control.direction() == QChar::DirR) {
evaluated: control.direction() == QChar::DirR
TRUEFALSE
yes
Evaluation Count:63
yes
Evaluation Count:45
45-63
386 if(status.eor != QChar::DirR) {
evaluated: status.eor != QChar::DirR
TRUEFALSE
yes
Evaluation Count:9
yes
Evaluation Count:54
9-54
387 -
388 appendItems(analysis, sor, eor, control, dir); -
389 status.eor = QChar::DirON; -
390 dir = QChar::DirR; -
391 }
executed: }
Execution Count:9
9
392 eor = current - 1; -
393 appendItems(analysis, sor, eor, control, dir); -
394 status.eor = dir = skipBoundryNeutrals(analysis, unicode, length, sor, eor, control); -
395 } else {
executed: }
Execution Count:63
63
396 if(status.eor != QChar::DirL) {
partially evaluated: status.eor != QChar::DirL
TRUEFALSE
yes
Evaluation Count:45
no
Evaluation Count:0
0-45
397 appendItems(analysis, sor, eor, control, dir); -
398 status.eor = QChar::DirON; -
399 dir = QChar::DirL; -
400 } else {
executed: }
Execution Count:45
45
401 eor = current; status.eor = QChar::DirL; break;
never executed: break;
0
402 } -
403 } -
404 } else { -
405 eor = current; status.eor = QChar::DirL; -
406 }
executed: }
Execution Count:66682
66682
407 default: -
408 break;
executed: break;
Execution Count:66824
66824
409 } -
410 status.lastStrong = QChar::DirL; -
411 break;
executed: break;
Execution Count:212419
212419
412 case QChar::DirAL: -
413 case QChar::DirR: -
414 hasBidi = true; -
415 if(dir == QChar::DirON) dir = QChar::DirR;
evaluated: dir == QChar::DirON
TRUEFALSE
yes
Evaluation Count:102
yes
Evaluation Count:1251
executed: dir = QChar::DirR;
Execution Count:102
102-1251
416 switch(status.last) -
417 { -
418 case QChar::DirL: -
419 case QChar::DirEN: -
420 case QChar::DirAN: -
421 if (eor >= 0)
evaluated: eor >= 0
TRUEFALSE
yes
Evaluation Count:124
yes
Evaluation Count:9
9-124
422 appendItems(analysis, sor, eor, control, dir);
executed: appendItems(analysis, sor, eor, control, dir);
Execution Count:124
124
423 -
424 case QChar::DirR:
code before this statement executed: case QChar::DirR:
Execution Count:133
133
425 case QChar::DirAL: -
426 dir = QChar::DirR; eor = current; status.eor = QChar::DirR; break;
executed: break;
Execution Count:1087
1087
427 case QChar::DirES: -
428 case QChar::DirET: -
429 case QChar::DirCS: -
430 case QChar::DirBN: -
431 case QChar::DirB: -
432 case QChar::DirS: -
433 case QChar::DirWS: -
434 case QChar::DirON: -
435 if(status.eor != QChar::DirR && status.eor != QChar::DirAL) {
evaluated: status.eor != QChar::DirR
TRUEFALSE
yes
Evaluation Count:156
yes
Evaluation Count:71
partially evaluated: status.eor != QChar::DirAL
TRUEFALSE
yes
Evaluation Count:156
no
Evaluation Count:0
0-156
436 -
437 if(control.direction() == QChar::DirR
evaluated: control.direction() == QChar::DirR
TRUEFALSE
yes
Evaluation Count:90
yes
Evaluation Count:66
66-90
438 || status.lastStrong == QChar::DirR || status.lastStrong == QChar::DirAL) {
evaluated: status.lastStrong == QChar::DirR
TRUEFALSE
yes
Evaluation Count:12
yes
Evaluation Count:54
evaluated: status.lastStrong == QChar::DirAL
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:51
3-54
439 appendItems(analysis, sor, eor, control, dir); -
440 dir = QChar::DirR; status.eor = QChar::DirON; -
441 eor = current; -
442 } else {
executed: }
Execution Count:105
105
443 eor = current - 1; -
444 appendItems(analysis, sor, eor, control, dir); -
445 dir = QChar::DirR; status.eor = QChar::DirON; -
446 }
executed: }
Execution Count:51
51
447 } else { -
448 eor = current; status.eor = QChar::DirR; -
449 }
executed: }
Execution Count:71
71
450 default: -
451 break;
executed: break;
Execution Count:266
266
452 } -
453 status.lastStrong = dirCurrent; -
454 break;
executed: break;
Execution Count:1353
1353
455 -
456 -
457 -
458 case QChar::DirNSM: -
459 if (eor == current-1)
evaluated: eor == current-1
TRUEFALSE
yes
Evaluation Count:102447
yes
Evaluation Count:102400
102400-102447
460 eor = current;
executed: eor = current;
Execution Count:102447
102447
461 break;
executed: break;
Execution Count:204847
204847
462 case QChar::DirEN: -
463 -
464 if(status.lastStrong != QChar::DirAL) {
evaluated: status.lastStrong != QChar::DirAL
TRUEFALSE
yes
Evaluation Count:2445
yes
Evaluation Count:106
106-2445
465 if(dir == QChar::DirON) {
evaluated: dir == QChar::DirON
TRUEFALSE
yes
Evaluation Count:166
yes
Evaluation Count:2279
166-2279
466 if(status.lastStrong == QChar::DirL)
evaluated: status.lastStrong == QChar::DirL
TRUEFALSE
yes
Evaluation Count:142
yes
Evaluation Count:24
24-142
467 dir = QChar::DirL;
executed: dir = QChar::DirL;
Execution Count:142
142
468 else -
469 dir = QChar::DirEN;
executed: dir = QChar::DirEN;
Execution Count:24
24
470 } -
471 switch(status.last) -
472 { -
473 case QChar::DirET: -
474 if (status.lastStrong == QChar::DirR || status.lastStrong == QChar::DirAL) {
never evaluated: status.lastStrong == QChar::DirR
never evaluated: status.lastStrong == QChar::DirAL
0
475 appendItems(analysis, sor, eor, control, dir); -
476 status.eor = QChar::DirON; -
477 dir = QChar::DirAN; -
478 }
never executed: }
0
479 -
480 case QChar::DirEN:
code before this statement never executed: case QChar::DirEN:
0
481 case QChar::DirL: -
482 eor = current; -
483 status.eor = dirCurrent; -
484 break;
executed: break;
Execution Count:601
601
485 case QChar::DirR: -
486 case QChar::DirAL: -
487 case QChar::DirAN: -
488 if (eor >= 0)
evaluated: eor >= 0
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:24
6-24
489 appendItems(analysis, sor, eor, control, dir);
executed: appendItems(analysis, sor, eor, control, dir);
Execution Count:6
6
490 else -
491 eor = current;
executed: eor = current;
Execution Count:24
24
492 status.eor = QChar::DirEN; -
493 dir = QChar::DirAN; break;
executed: break;
Execution Count:30
30
494 case QChar::DirES: -
495 case QChar::DirCS: -
496 if(status.eor == QChar::DirEN || dir == QChar::DirAN) {
evaluated: status.eor == QChar::DirEN
TRUEFALSE
yes
Evaluation Count:1056
yes
Evaluation Count:24
evaluated: dir == QChar::DirAN
TRUEFALSE
yes
Evaluation Count:9
yes
Evaluation Count:15
9-1056
497 eor = current; break;
executed: break;
Execution Count:1065
1065
498 } -
499 case QChar::DirBN:
code before this statement executed: case QChar::DirBN:
Execution Count:15
15
500 case QChar::DirB: -
501 case QChar::DirS: -
502 case QChar::DirWS: -
503 case QChar::DirON: -
504 if(status.eor == QChar::DirR) {
evaluated: status.eor == QChar::DirR
TRUEFALSE
yes
Evaluation Count:24
yes
Evaluation Count:725
24-725
505 -
506 eor = current - 1; -
507 appendItems(analysis, sor, eor, control, dir); -
508 dir = QChar::DirON; status.eor = QChar::DirEN; -
509 dir = QChar::DirAN; -
510 }
executed: }
Execution Count:24
24
511 else if(status.eor == QChar::DirL ||
evaluated: status.eor == QChar::DirL
TRUEFALSE
yes
Evaluation Count:30
yes
Evaluation Count:695
30-695
512 (status.eor == QChar::DirEN && status.lastStrong == QChar::DirL)) {
evaluated: status.eor == QChar::DirEN
TRUEFALSE
yes
Evaluation Count:148
yes
Evaluation Count:547
evaluated: status.lastStrong == QChar::DirL
TRUEFALSE
yes
Evaluation Count:136
yes
Evaluation Count:12
12-547
513 eor = current; status.eor = dirCurrent; -
514 } else {
executed: }
Execution Count:166
166
515 -
516 if(dir != QChar::DirL) {
evaluated: dir != QChar::DirL
TRUEFALSE
yes
Evaluation Count:27
yes
Evaluation Count:532
27-532
517 appendItems(analysis, sor, eor, control, dir); -
518 dir = QChar::DirON; status.eor = QChar::DirON; -
519 eor = current - 1; -
520 dir = QChar::DirR; -
521 appendItems(analysis, sor, eor, control, dir); -
522 dir = QChar::DirON; status.eor = QChar::DirON; -
523 dir = QChar::DirAN; -
524 } else {
executed: }
Execution Count:27
27
525 eor = current; status.eor = dirCurrent; -
526 }
executed: }
Execution Count:532
532
527 } -
528 default: -
529 break;
executed: break;
Execution Count:749
749
530 } -
531 break;
executed: break;
Execution Count:2445
2445
532 } -
533 case QChar::DirAN:
code before this statement executed: case QChar::DirAN:
Execution Count:106
106
534 hasBidi = true; -
535 dirCurrent = QChar::DirAN; -
536 if(dir == QChar::DirON) dir = QChar::DirAN;
partially evaluated: dir == QChar::DirON
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:106
never executed: dir = QChar::DirAN;
0-106
537 switch(status.last) -
538 { -
539 case QChar::DirL: -
540 case QChar::DirAN: -
541 eor = current; status.eor = QChar::DirAN; break;
executed: break;
Execution Count:21
21
542 case QChar::DirR: -
543 case QChar::DirAL: -
544 case QChar::DirEN: -
545 if (eor >= 0){
partially evaluated: eor >= 0
TRUEFALSE
yes
Evaluation Count:4
no
Evaluation Count:0
0-4
546 appendItems(analysis, sor, eor, control, dir); -
547 } else {
executed: }
Execution Count:4
4
548 eor = current; -
549 }
never executed: }
0
550 dir = QChar::DirAN; status.eor = QChar::DirAN; -
551 break;
executed: break;
Execution Count:4
4
552 case QChar::DirCS: -
553 if(status.eor == QChar::DirAN) {
partially evaluated: status.eor == QChar::DirAN
TRUEFALSE
yes
Evaluation Count:33
no
Evaluation Count:0
0-33
554 eor = current; break;
executed: break;
Execution Count:33
33
555 } -
556 case QChar::DirES:
code before this statement never executed: case QChar::DirES:
0
557 case QChar::DirET: -
558 case QChar::DirBN: -
559 case QChar::DirB: -
560 case QChar::DirS: -
561 case QChar::DirWS: -
562 case QChar::DirON: -
563 if(status.eor == QChar::DirR) {
evaluated: status.eor == QChar::DirR
TRUEFALSE
yes
Evaluation Count:30
yes
Evaluation Count:18
18-30
564 -
565 eor = current - 1; -
566 appendItems(analysis, sor, eor, control, dir); -
567 status.eor = QChar::DirAN; -
568 dir = QChar::DirAN; -
569 } else if(status.eor == QChar::DirL ||
executed: }
Execution Count:30
partially evaluated: status.eor == QChar::DirL
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:18
0-30
570 (status.eor == QChar::DirEN && status.lastStrong == QChar::DirL)) {
partially evaluated: status.eor == QChar::DirEN
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:18
never evaluated: status.lastStrong == QChar::DirL
0-18
571 eor = current; status.eor = dirCurrent; -
572 } else {
never executed: }
0
573 -
574 if(dir != QChar::DirL) {
partially evaluated: dir != QChar::DirL
TRUEFALSE
yes
Evaluation Count:18
no
Evaluation Count:0
0-18
575 appendItems(analysis, sor, eor, control, dir); -
576 status.eor = QChar::DirON; -
577 eor = current - 1; -
578 dir = QChar::DirR; -
579 appendItems(analysis, sor, eor, control, dir); -
580 status.eor = QChar::DirAN; -
581 dir = QChar::DirAN; -
582 } else {
executed: }
Execution Count:18
18
583 eor = current; status.eor = dirCurrent; -
584 }
never executed: }
0
585 } -
586 default: -
587 break;
executed: break;
Execution Count:48
48
588 } -
589 break;
executed: break;
Execution Count:106
106
590 case QChar::DirES: -
591 case QChar::DirCS: -
592 break;
executed: break;
Execution Count:2050
2050
593 case QChar::DirET: -
594 if(status.last == QChar::DirEN) {
evaluated: status.last == QChar::DirEN
TRUEFALSE
yes
Evaluation Count:21
yes
Evaluation Count:10
10-21
595 dirCurrent = QChar::DirEN; -
596 eor = current; status.eor = dirCurrent; -
597 }
executed: }
Execution Count:21
21
598 break;
executed: break;
Execution Count:31
31
599 -
600 -
601 case QChar::DirBN: -
602 break;
executed: break;
Execution Count:1031
1031
603 -
604 case QChar::DirB: -
605 -
606 break;
executed: break;
Execution Count:6
6
607 case QChar::DirS: -
608 -
609 break;
never executed: break;
0
610 case QChar::DirWS: -
611 case QChar::DirON: -
612 break;
executed: break;
Execution Count:68494
68494
613 default: -
614 break;
never executed: break;
0
615 } -
616 -
617 -
618 -
619 if(current >= (int)length) break;
executed: break;
Execution Count:1533
evaluated: current >= (int)length
TRUEFALSE
yes
Evaluation Count:1533
yes
Evaluation Count:491395
1533-491395
620 -
621 -
622 switch(dirCurrent) { -
623 case QChar::DirET: -
624 case QChar::DirES: -
625 case QChar::DirCS: -
626 case QChar::DirS: -
627 case QChar::DirWS: -
628 case QChar::DirON: -
629 switch(status.last) -
630 { -
631 case QChar::DirL: -
632 case QChar::DirR: -
633 case QChar::DirAL: -
634 case QChar::DirEN: -
635 case QChar::DirAN: -
636 status.last = dirCurrent; -
637 break;
executed: break;
Execution Count:68906
68906
638 default: -
639 status.last = QChar::DirON; -
640 }
executed: }
Execution Count:1648
1648
641 break;
executed: break;
Execution Count:70554
70554
642 case QChar::DirNSM: -
643 case QChar::DirBN: -
644 -
645 break;
executed: break;
Execution Count:205878
205878
646 case QChar::DirLRO: -
647 case QChar::DirLRE: -
648 status.last = QChar::DirL; -
649 break;
executed: break;
Execution Count:37
37
650 case QChar::DirRLO: -
651 case QChar::DirRLE: -
652 status.last = QChar::DirR; -
653 break;
executed: break;
Execution Count:36
36
654 case QChar::DirEN: -
655 if (status.last == QChar::DirL) {
evaluated: status.last == QChar::DirL
TRUEFALSE
yes
Evaluation Count:235
yes
Evaluation Count:2231
235-2231
656 status.last = QChar::DirL; -
657 break;
executed: break;
Execution Count:235
235
658 } -
659 -
660 default:
code before this statement executed: default:
Execution Count:2231
2231
661 status.last = dirCurrent; -
662 }
executed: }
Execution Count:214655
214655
663 -
664 ++current; -
665 }
executed: }
Execution Count:491395
491395
666 -
667 -
668 -
669 -
670 eor = current - 1; -
671 -
672 if (sor <= eor)
evaluated: sor <= eor
TRUEFALSE
yes
Evaluation Count:1350
yes
Evaluation Count:183
183-1350
673 appendItems(analysis, sor, eor, control, dir);
executed: appendItems(analysis, sor, eor, control, dir);
Execution Count:1350
1350
674 -
675 return hasBidi;
executed: return hasBidi;
Execution Count:1533
1533
676} -
677 -
678void QTextEngine::bidiReorder(int numItems, const quint8 *levels, int *visualOrder) -
679{ -
680 -
681 -
682 quint8 levelLow = 128; -
683 quint8 levelHigh = 0; -
684 int i = 0; -
685 while (i < numItems) {
evaluated: i < numItems
TRUEFALSE
yes
Evaluation Count:45625
yes
Evaluation Count:33233
33233-45625
686 -
687 if (levels[i] > levelHigh)
evaluated: levels[i] > levelHigh
TRUEFALSE
yes
Evaluation Count:4063
yes
Evaluation Count:41562
4063-41562
688 levelHigh = levels[i];
executed: levelHigh = levels[i];
Execution Count:4063
4063
689 if (levels[i] < levelLow)
evaluated: levels[i] < levelLow
TRUEFALSE
yes
Evaluation Count:33309
yes
Evaluation Count:12316
12316-33309
690 levelLow = levels[i];
executed: levelLow = levels[i];
Execution Count:33309
33309
691 i++; -
692 }
executed: }
Execution Count:45625
45625
693 -
694 -
695 -
696 -
697 -
698 -
699 if(!(levelLow%2)) levelLow++;
executed: levelLow++;
Execution Count:31737
evaluated: !(levelLow%2)
TRUEFALSE
yes
Evaluation Count:31737
yes
Evaluation Count:1496
1496-31737
700 -
701 -
702 -
703 -
704 -
705 int count = numItems - 1; -
706 for (i = 0; i < numItems; i++)
evaluated: i < numItems
TRUEFALSE
yes
Evaluation Count:45625
yes
Evaluation Count:33233
33233-45625
707 visualOrder[i] = i;
executed: visualOrder[i] = i;
Execution Count:45625
45625
708 -
709 while(levelHigh >= levelLow) {
evaluated: levelHigh >= levelLow
TRUEFALSE
yes
Evaluation Count:3994
yes
Evaluation Count:33233
3994-33233
710 int i = 0; -
711 while (i < count) {
evaluated: i < count
TRUEFALSE
yes
Evaluation Count:5235
yes
Evaluation Count:3994
3994-5235
712 while(i < count && levels[i] < levelHigh) i++;
evaluated: i < count
TRUEFALSE
yes
Evaluation Count:10778
yes
Evaluation Count:954
evaluated: levels[i] < levelHigh
TRUEFALSE
yes
Evaluation Count:6497
yes
Evaluation Count:4281
executed: i++;
Execution Count:6497
954-10778
713 int start = i; -
714 while(i <= count && levels[i] >= levelHigh) i++;
evaluated: i <= count
TRUEFALSE
yes
Evaluation Count:17685
yes
Evaluation Count:1937
evaluated: levels[i] >= levelHigh
TRUEFALSE
yes
Evaluation Count:14387
yes
Evaluation Count:3298
executed: i++;
Execution Count:14387
1937-17685
715 int end = i-1; -
716 -
717 if(start != end) {
evaluated: start != end
TRUEFALSE
yes
Evaluation Count:2415
yes
Evaluation Count:2820
2415-2820
718 -
719 for(int j = 0; j < (end-start+1)/2; j++) {
evaluated: j < (end-start+1)/2
TRUEFALSE
yes
Evaluation Count:5027
yes
Evaluation Count:2415
2415-5027
720 int tmp = visualOrder[start+j]; -
721 visualOrder[start+j] = visualOrder[end-j]; -
722 visualOrder[end-j] = tmp; -
723 }
executed: }
Execution Count:5027
5027
724 }
executed: }
Execution Count:2415
2415
725 i++; -
726 }
executed: }
Execution Count:5235
5235
727 levelHigh--; -
728 }
executed: }
Execution Count:3994
3994
729 -
730 -
731 -
732 -
733 -
734 -
735}
executed: }
Execution Count:33233
33233
736 -
737 -
738 -
739 -
740 -
741 -
742 -
743 -
744static bool stringToGlyphs(HB_ShaperItem *item, QGlyphLayout *glyphs, QFontEngine *fontEngine) -
745{ -
746 int nGlyphs = item->num_glyphs; -
747 -
748 QFontEngine::ShaperFlags shaperFlags(QFontEngine::GlyphIndicesOnly); -
749 if (item->item.bidiLevel % 2)
evaluated: item->item.bidiLevel % 2
TRUEFALSE
yes
Evaluation Count:285
yes
Evaluation Count:246799
285-246799
750 shaperFlags |= QFontEngine::RightToLeft;
executed: shaperFlags |= QFontEngine::RightToLeft;
Execution Count:285
285
751 -
752 bool result = fontEngine->stringToCMap(reinterpret_cast<const QChar *>(item->string + item->item.pos), item->item.length, glyphs, &nGlyphs, shaperFlags); -
753 item->num_glyphs = nGlyphs; -
754 glyphs->numGlyphs = nGlyphs; -
755 return result;
executed: return result;
Execution Count:247084
247084
756} -
757 -
758 -
759void QTextEngine::shapeLine(const QScriptLine &line) -
760{ -
761 QFixed x; -
762 bool first = true; -
763 const int end = findItem(line.from + line.length - 1); -
764 int item = findItem(line.from); -
765 if (item == -1)
partially evaluated: item == -1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:33132
0-33132
766 return;
never executed: return;
0
767 for (item = findItem(line.from); item <= end; ++item) {
evaluated: item <= end
TRUEFALSE
yes
Evaluation Count:45236
yes
Evaluation Count:33132
33132-45236
768 QScriptItem &si = layoutData->items[item]; -
769 if (si.analysis.flags == QScriptAnalysis::Tab) {
evaluated: si.analysis.flags == QScriptAnalysis::Tab
TRUEFALSE
yes
Evaluation Count:10
yes
Evaluation Count:45226
10-45226
770 ensureSpace(1); -
771 si.width = calculateTabWidth(item, x); -
772 } else {
executed: }
Execution Count:10
10
773 shape(item); -
774 }
executed: }
Execution Count:45226
45226
775 if (first && si.position != line.from) {
evaluated: first
TRUEFALSE
yes
Evaluation Count:33132
yes
Evaluation Count:12104
evaluated: si.position != line.from
TRUEFALSE
yes
Evaluation Count:179
yes
Evaluation Count:32953
179-33132
776 QGlyphLayout glyphs = shapedGlyphs(&si); -
777 qt_noop(); -
778 for (int i = line.from - si.position - 1; i >= 0; i--) {
evaluated: i >= 0
TRUEFALSE
yes
Evaluation Count:24528
yes
Evaluation Count:179
179-24528
779 x -= glyphs.effectiveAdvance(i); -
780 }
executed: }
Execution Count:24528
24528
781 }
executed: }
Execution Count:179
179
782 first = false; -
783 -
784 x += si.width; -
785 }
executed: }
Execution Count:45236
45236
786}
executed: }
Execution Count:33132
33132
787 -
788 -
789void QTextEngine::shapeText(int item) const -
790{ -
791 qt_noop(); -
792 QScriptItem &si = layoutData->items[item]; -
793 -
794 if (si.num_glyphs)
evaluated: si.num_glyphs
TRUEFALSE
yes
Evaluation Count:25960
yes
Evaluation Count:247084
25960-247084
795 return;
executed: return;
Execution Count:25960
25960
796 -
797 shapeTextWithHarfbuzz(item); -
798 -
799 si.width = 0; -
800 -
801 if (!si.num_glyphs)
partially evaluated: !si.num_glyphs
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:247084
0-247084
802 return;
never executed: return;
0
803 QGlyphLayout glyphs = shapedGlyphs(&si); -
804 -
805 bool letterSpacingIsAbsolute; -
806 QFixed letterSpacing, wordSpacing; -
807 -
808 if (useRawFont) {
partially evaluated: useRawFont
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:247084
0-247084
809 QTextCharFormat f = format(&si); -
810 wordSpacing = QFixed::fromReal(f.fontWordSpacing()); -
811 letterSpacing = QFixed::fromReal(f.fontLetterSpacing()); -
812 letterSpacingIsAbsolute = true; -
813 } else
never executed: }
0
814 -
815 { -
816 QFont font = this->font(si); -
817 letterSpacingIsAbsolute = font.d->letterSpacingIsAbsolute; -
818 letterSpacing = font.d->letterSpacing; -
819 wordSpacing = font.d->wordSpacing; -
820 -
821 if (letterSpacingIsAbsolute && letterSpacing.value())
partially evaluated: letterSpacingIsAbsolute
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:247084
never evaluated: letterSpacing.value()
0-247084
822 letterSpacing *= font.d->dpi / qt_defaultDpiY();
never executed: letterSpacing *= font.d->dpi / qt_defaultDpiY();
0
823 }
executed: }
Execution Count:247084
247084
824 -
825 if (letterSpacing != 0) {
partially evaluated: letterSpacing != 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:247084
0-247084
826 for (int i = 1; i < si.num_glyphs; ++i) {
never evaluated: i < si.num_glyphs
0
827 if (glyphs.attributes[i].clusterStart) {
never evaluated: glyphs.attributes[i].clusterStart
0
828 if (letterSpacingIsAbsolute)
never evaluated: letterSpacingIsAbsolute
0
829 glyphs.advances_x[i-1] += letterSpacing;
never executed: glyphs.advances_x[i-1] += letterSpacing;
0
830 else { -
831 QFixed &advance = glyphs.advances_x[i-1]; -
832 advance += (letterSpacing - 100) * advance / 100; -
833 }
never executed: }
0
834 } -
835 }
never executed: }
0
836 if (letterSpacingIsAbsolute)
never evaluated: letterSpacingIsAbsolute
0
837 glyphs.advances_x[si.num_glyphs-1] += letterSpacing;
never executed: glyphs.advances_x[si.num_glyphs-1] += letterSpacing;
0
838 else { -
839 QFixed &advance = glyphs.advances_x[si.num_glyphs-1]; -
840 advance += (letterSpacing - 100) * advance / 100; -
841 }
never executed: }
0
842 } -
843 if (wordSpacing != 0) {
evaluated: wordSpacing != 0
TRUEFALSE
yes
Evaluation Count:10
yes
Evaluation Count:247074
10-247074
844 for (int i = 0; i < si.num_glyphs; ++i) {
evaluated: i < si.num_glyphs
TRUEFALSE
yes
Evaluation Count:10
yes
Evaluation Count:10
10
845 if (glyphs.attributes[i].justification == HB_Space
evaluated: glyphs.attributes[i].justification == HB_Space
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:8
2-8
846 || glyphs.attributes[i].justification == HB_Arabic_Space) {
partially evaluated: glyphs.attributes[i].justification == HB_Arabic_Space
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8
0-8
847 -
848 if (i + 1 == si.num_glyphs
partially evaluated: i + 1 == si.num_glyphs
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
0-2
849 ||(glyphs.attributes[i+1].justification != HB_Space
never evaluated: glyphs.attributes[i+1].justification != HB_Space
0
850 && glyphs.attributes[i+1].justification != HB_Arabic_Space))
never evaluated: glyphs.attributes[i+1].justification != HB_Arabic_Space
0
851 glyphs.advances_x[i] += wordSpacing;
executed: glyphs.advances_x[i] += wordSpacing;
Execution Count:2
2
852 }
executed: }
Execution Count:2
2
853 }
executed: }
Execution Count:10
10
854 }
executed: }
Execution Count:10
10
855 -
856 for (int i = 0; i < si.num_glyphs; ++i)
evaluated: i < si.num_glyphs
TRUEFALSE
yes
Evaluation Count:3306477
yes
Evaluation Count:247084
247084-3306477
857 si.width += glyphs.advances_x[i] * !glyphs.attributes[i].dontPrint;
executed: si.width += glyphs.advances_x[i] * !glyphs.attributes[i].dontPrint;
Execution Count:3306477
3306477
858}
executed: }
Execution Count:247084
247084
859 -
860static inline bool hasCaseChange(const QScriptItem &si) -
861{ -
862 return si.analysis.flags == QScriptAnalysis::SmallCaps || 247084
863 si.analysis.flags == QScriptAnalysis::Uppercase || 247084
864 si.analysis.flags == QScriptAnalysis::Lowercase;
executed: return si.analysis.flags == QScriptAnalysis::SmallCaps || si.analysis.flags == QScriptAnalysis::Uppercase || si.analysis.flags == QScriptAnalysis::Lowercase;
Execution Count:247084
247084
865} -
866 -
867 -
868static inline void moveGlyphData(const QGlyphLayout &destination, const QGlyphLayout &source, int num) -
869{ -
870 if (num > 0 && destination.glyphs != source.glyphs) {
evaluated: num > 0
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:247135
partially evaluated: destination.glyphs != source.glyphs
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3
0-247135
871 memmove(destination.glyphs, source.glyphs, num * sizeof(HB_Glyph)); -
872 memmove(destination.attributes, source.attributes, num * sizeof(HB_GlyphAttributes)); -
873 memmove(destination.advances_x, source.advances_x, num * sizeof(HB_Fixed)); -
874 memmove(destination.offsets, source.offsets, num * sizeof(HB_FixedPoint)); -
875 }
never executed: }
0
876}
executed: }
Execution Count:247138
247138
877 -
878 -
879void QTextEngine::shapeTextWithHarfbuzz(int item) const -
880{ -
881 qt_noop(); -
882 qt_noop(); -
883 -
884 QScriptItem &si = layoutData->items[item]; -
885 -
886 si.glyph_data_offset = layoutData->used; -
887 -
888 QFontEngine *font = fontEngine(si, &si.ascent, &si.descent, &si.leading); -
889 -
890 bool kerningEnabled; -
891 -
892 if (useRawFont) {
partially evaluated: useRawFont
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:247084
0-247084
893 QTextCharFormat f = format(&si); -
894 kerningEnabled = f.fontKerning(); -
895 } else
never executed: }
0
896 -
897 kerningEnabled = this->font(si).d->kerning;
executed: kerningEnabled = this->font(si).d->kerning;
Execution Count:247084
247084
898 -
899 HB_ShaperItem entire_shaper_item; -
900 memset(&entire_shaper_item, 0, sizeof(entire_shaper_item)); -
901 entire_shaper_item.string = reinterpret_cast<const HB_UChar16 *>(layoutData->string.constData()); -
902 entire_shaper_item.stringLength = layoutData->string.length(); -
903 entire_shaper_item.item.script = (HB_Script)si.analysis.script; -
904 entire_shaper_item.item.pos = si.position; -
905 entire_shaper_item.item.length = length(item); -
906 entire_shaper_item.item.bidiLevel = si.analysis.bidiLevel; -
907 -
908 QVarLengthArray<HB_UChar16, 256> casedString; -
909 if (hasCaseChange(si)) {
partially evaluated: hasCaseChange(si)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:247084
0-247084
910 if (casedString.size() < static_cast<int>(entire_shaper_item.item.length))
never evaluated: casedString.size() < static_cast<int>(entire_shaper_item.item.length)
0
911 casedString.resize(entire_shaper_item.item.length);
never executed: casedString.resize(entire_shaper_item.item.length);
0
912 HB_UChar16 *uc = casedString.data(); -
913 for (uint i = 0; i < entire_shaper_item.item.length; ++i) {
never evaluated: i < entire_shaper_item.item.length
0
914 uint ucs4 = entire_shaper_item.string[si.position + i]; -
915 if (QChar::isHighSurrogate(ucs4)) {
never evaluated: QChar::isHighSurrogate(ucs4)
0
916 uc[i] = ucs4; -
917 if (i + 1 < entire_shaper_item.item.length) {
never evaluated: i + 1 < entire_shaper_item.item.length
0
918 ushort low = entire_shaper_item.string[si.position + i + 1]; -
919 if (QChar::isLowSurrogate(low)) {
never evaluated: QChar::isLowSurrogate(low)
0
920 ucs4 = QChar::surrogateToUcs4(ucs4, low); -
921 ucs4 = si.analysis.flags == QScriptAnalysis::Lowercase ? QChar::toLower(ucs4)
never evaluated: si.analysis.flags == QScriptAnalysis::Lowercase
0
922 : QChar::toUpper(ucs4); -
923 uc[++i] = QChar::lowSurrogate(ucs4); -
924 }
never executed: }
0
925 }
never executed: }
0
926 } else {
never executed: }
0
927 uc[i] = si.analysis.flags == QScriptAnalysis::Lowercase ? QChar::toLower(ucs4)
never evaluated: si.analysis.flags == QScriptAnalysis::Lowercase
0
928 : QChar::toUpper(ucs4); -
929 }
never executed: }
0
930 } -
931 entire_shaper_item.item.pos = 0; -
932 entire_shaper_item.string = uc; -
933 entire_shaper_item.stringLength = entire_shaper_item.item.length; -
934 }
never executed: }
0
935 -
936 entire_shaper_item.shaperFlags = 0; -
937 if (!kerningEnabled)
partially evaluated: !kerningEnabled
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:247084
0-247084
938 entire_shaper_item.shaperFlags |= HB_ShaperFlag_NoKerning;
never executed: entire_shaper_item.shaperFlags |= HB_ShaperFlag_NoKerning;
0
939 if (option.useDesignMetrics())
partially evaluated: option.useDesignMetrics()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:247084
0-247084
940 entire_shaper_item.shaperFlags |= HB_ShaperFlag_UseDesignMetrics;
never executed: entire_shaper_item.shaperFlags |= HB_ShaperFlag_UseDesignMetrics;
0
941 -
942 entire_shaper_item.num_glyphs = qMax(layoutData->glyphLayout.numGlyphs - layoutData->used, int(entire_shaper_item.item.length)); -
943 if (!ensureSpace(entire_shaper_item.num_glyphs))
partially evaluated: !ensureSpace(entire_shaper_item.num_glyphs)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:247084
0-247084
944 return;
never executed: return;
0
945 QGlyphLayout initialGlyphs = availableGlyphs(&si).mid(0, entire_shaper_item.num_glyphs); -
946 -
947 if (!stringToGlyphs(&entire_shaper_item, &initialGlyphs, font)) {
partially evaluated: !stringToGlyphs(&entire_shaper_item, &initialGlyphs, font)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:247084
0-247084
948 if (!ensureSpace(entire_shaper_item.num_glyphs))
never evaluated: !ensureSpace(entire_shaper_item.num_glyphs)
0
949 return;
never executed: return;
0
950 initialGlyphs = availableGlyphs(&si).mid(0, entire_shaper_item.num_glyphs); -
951 if (!stringToGlyphs(&entire_shaper_item, &initialGlyphs, font)) {
never evaluated: !stringToGlyphs(&entire_shaper_item, &initialGlyphs, font)
0
952 -
953 return;
never executed: return;
0
954 } -
955 }
never executed: }
0
956 -
957 -
958 QVarLengthArray<int> itemBoundaries(2); -
959 -
960 itemBoundaries[0] = entire_shaper_item.item.pos; -
961 itemBoundaries[1] = 0; -
962 -
963 if (font->type() == QFontEngine::Multi) {
evaluated: font->type() == QFontEngine::Multi
TRUEFALSE
yes
Evaluation Count:247041
yes
Evaluation Count:43
43-247041
964 uint lastEngine = 0; -
965 int charIdx = entire_shaper_item.item.pos; -
966 const int stringEnd = charIdx + entire_shaper_item.item.length; -
967 for (quint32 i = 0; i < entire_shaper_item.num_glyphs; ++i, ++charIdx) {
evaluated: i < entire_shaper_item.num_glyphs
TRUEFALSE
yes
Evaluation Count:3112539
yes
Evaluation Count:247041
247041-3112539
968 uint engineIdx = initialGlyphs.glyphs[i] >> 24; -
969 if (engineIdx != lastEngine && i > 0) {
evaluated: engineIdx != lastEngine
TRUEFALSE
yes
Evaluation Count:10
yes
Evaluation Count:3112529
evaluated: i > 0
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:7
3-3112529
970 itemBoundaries.append(charIdx); -
971 itemBoundaries.append(i); -
972 }
executed: }
Execution Count:3
3
973 lastEngine = engineIdx; -
974 if ((((entire_shaper_item.string[charIdx]) & 0xfc00) == 0xd800)
partially evaluated: (((entire_shaper_item.string[charIdx]) & 0xfc00) == 0xd800)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3112539
0-3112539
975 && charIdx < stringEnd - 1
never evaluated: charIdx < stringEnd - 1
0
976 && (((entire_shaper_item.string[charIdx + 1]) & 0xfc00) == 0xdc00))
never evaluated: (((entire_shaper_item.string[charIdx + 1]) & 0xfc00) == 0xdc00)
0
977 ++charIdx;
never executed: ++charIdx;
0
978 }
executed: }
Execution Count:3112539
3112539
979 }
executed: }
Execution Count:247041
247041
980 -
981 -
982 -
983 int remaining_glyphs = entire_shaper_item.num_glyphs; -
984 int glyph_pos = 0; -
985 -
986 for (int k = 0; k < itemBoundaries.size(); k += 2) {
evaluated: k < itemBoundaries.size()
TRUEFALSE
yes
Evaluation Count:247087
yes
Evaluation Count:247084
247084-247087
987 -
988 HB_ShaperItem shaper_item = entire_shaper_item; -
989 -
990 shaper_item.item.pos = itemBoundaries[k]; -
991 if (k < itemBoundaries.size() - 3) {
evaluated: k < itemBoundaries.size() - 3
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:247084
3-247084
992 shaper_item.item.length = itemBoundaries[k + 2] - shaper_item.item.pos; -
993 shaper_item.num_glyphs = itemBoundaries[k + 3] - itemBoundaries[k + 1]; -
994 } else {
executed: }
Execution Count:3
3
995 shaper_item.item.length -= shaper_item.item.pos - entire_shaper_item.item.pos; -
996 shaper_item.num_glyphs -= itemBoundaries[k + 1]; -
997 }
executed: }
Execution Count:247084
247084
998 shaper_item.initialGlyphCount = shaper_item.num_glyphs; -
999 if (shaper_item.num_glyphs < shaper_item.item.length)
partially evaluated: shaper_item.num_glyphs < shaper_item.item.length
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:247087
0-247087
1000 shaper_item.num_glyphs = shaper_item.item.length;
never executed: shaper_item.num_glyphs = shaper_item.item.length;
0
1001 -
1002 QFontEngine *actualFontEngine = font; -
1003 uint engineIdx = 0; -
1004 if (font->type() == QFontEngine::Multi) {
evaluated: font->type() == QFontEngine::Multi
TRUEFALSE
yes
Evaluation Count:247044
yes
Evaluation Count:43
43-247044
1005 engineIdx = uint(availableGlyphs(&si).glyphs[glyph_pos] >> 24); -
1006 -
1007 actualFontEngine = static_cast<QFontEngineMulti *>(font)->engine(engineIdx); -
1008 }
executed: }
Execution Count:247044
247044
1009 -
1010 si.ascent = qMax(actualFontEngine->ascent(), si.ascent); -
1011 si.descent = qMax(actualFontEngine->descent(), si.descent); -
1012 si.leading = qMax(actualFontEngine->leading(), si.leading); -
1013 -
1014 shaper_item.font = actualFontEngine->harfbuzzFont(); -
1015 shaper_item.face = actualFontEngine->initializedHarfbuzzFace(); -
1016 -
1017 shaper_item.glyphIndicesPresent = true; -
1018 -
1019 remaining_glyphs -= shaper_item.initialGlyphCount; -
1020 -
1021 do { -
1022 if (!ensureSpace(glyph_pos + shaper_item.num_glyphs + remaining_glyphs))
partially evaluated: !ensureSpace(glyph_pos + shaper_item.num_glyphs + remaining_glyphs)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:247138
0-247138
1023 return;
never executed: return;
0
1024 -
1025 const QGlyphLayout g = availableGlyphs(&si).mid(glyph_pos); -
1026 if (shaper_item.num_glyphs > shaper_item.item.length)
evaluated: shaper_item.num_glyphs > shaper_item.item.length
TRUEFALSE
yes
Evaluation Count:51
yes
Evaluation Count:247087
51-247087
1027 moveGlyphData(g.mid(shaper_item.num_glyphs), g.mid(shaper_item.initialGlyphCount), remaining_glyphs);
executed: moveGlyphData(g.mid(shaper_item.num_glyphs), g.mid(shaper_item.initialGlyphCount), remaining_glyphs);
Execution Count:51
51
1028 -
1029 shaper_item.glyphs = g.glyphs; -
1030 shaper_item.attributes = g.attributes; -
1031 shaper_item.advances = reinterpret_cast<HB_Fixed *>(g.advances_x); -
1032 shaper_item.offsets = reinterpret_cast<HB_FixedPoint *>(g.offsets); -
1033 -
1034 if (engineIdx != 0 && shaper_item.glyphIndicesPresent) {
evaluated: engineIdx != 0
TRUEFALSE
yes
Evaluation Count:9
yes
Evaluation Count:247129
partially evaluated: shaper_item.glyphIndicesPresent
TRUEFALSE
yes
Evaluation Count:9
no
Evaluation Count:0
0-247129
1035 for (hb_uint32 i = 0; i < shaper_item.initialGlyphCount; ++i)
evaluated: i < shaper_item.initialGlyphCount
TRUEFALSE
yes
Evaluation Count:58
yes
Evaluation Count:9
9-58
1036 shaper_item.glyphs[i] &= 0x00ffffff;
executed: shaper_item.glyphs[i] &= 0x00ffffff;
Execution Count:58
58
1037 }
executed: }
Execution Count:9
9
1038 -
1039 shaper_item.log_clusters = logClusters(&si) + shaper_item.item.pos - entire_shaper_item.item.pos; -
1040 -
1041 -
1042 } while (!qShapeItem(&shaper_item));
executed: }
Execution Count:247138
evaluated: !qShapeItem(&shaper_item)
TRUEFALSE
yes
Evaluation Count:51
yes
Evaluation Count:247087
51-247138
1043 -
1044 QGlyphLayout g = availableGlyphs(&si).mid(glyph_pos, shaper_item.num_glyphs); -
1045 moveGlyphData(g.mid(shaper_item.num_glyphs), g.mid(shaper_item.initialGlyphCount), remaining_glyphs); -
1046 -
1047 for (hb_uint32 i = 0; i < shaper_item.item.length; ++i)
evaluated: i < shaper_item.item.length
TRUEFALSE
yes
Evaluation Count:3112719
yes
Evaluation Count:247087
247087-3112719
1048 shaper_item.log_clusters[i] += glyph_pos;
executed: shaper_item.log_clusters[i] += glyph_pos;
Execution Count:3112719
3112719
1049 -
1050 if (kerningEnabled && !shaper_item.kerning_applied)
partially evaluated: kerningEnabled
TRUEFALSE
yes
Evaluation Count:247087
no
Evaluation Count:0
evaluated: !shaper_item.kerning_applied
TRUEFALSE
yes
Evaluation Count:162822
yes
Evaluation Count:84265
0-247087
1051 actualFontEngine->doKerning(&g, option.useDesignMetrics() ? QFontEngine::DesignMetrics : QFontEngine::ShaperFlags(0));
executed: actualFontEngine->doKerning(&g, option.useDesignMetrics() ? QFontEngine::DesignMetrics : QFontEngine::ShaperFlags(0));
Execution Count:162822
162822
1052 -
1053 if (engineIdx != 0) {
evaluated: engineIdx != 0
TRUEFALSE
yes
Evaluation Count:9
yes
Evaluation Count:247078
9-247078
1054 for (hb_uint32 i = 0; i < shaper_item.num_glyphs; ++i)
evaluated: i < shaper_item.num_glyphs
TRUEFALSE
yes
Evaluation Count:58
yes
Evaluation Count:9
9-58
1055 g.glyphs[i] |= (engineIdx << 24);
executed: g.glyphs[i] |= (engineIdx << 24);
Execution Count:58
58
1056 }
executed: }
Execution Count:9
9
1057 -
1058 glyph_pos += shaper_item.num_glyphs; -
1059 }
executed: }
Execution Count:247087
247087
1060 -
1061 -
1062 si.num_glyphs = glyph_pos; -
1063 -
1064 layoutData->used += si.num_glyphs; -
1065}
executed: }
Execution Count:247084
247084
1066 -
1067static void init(QTextEngine *e) -
1068{ -
1069 e->ignoreBidi = false; -
1070 e->cacheGlyphs = false; -
1071 e->forceJustification = false; -
1072 e->visualMovement = false; -
1073 e->delayDecorations = false; -
1074 -
1075 e->layoutData = 0; -
1076 -
1077 e->minWidth = 0; -
1078 e->maxWidth = 0; -
1079 -
1080 e->underlinePositions = 0; -
1081 e->specialData = 0; -
1082 e->stackEngine = false; -
1083 -
1084 e->useRawFont = false; -
1085 -
1086}
executed: }
Execution Count:203464
203464
1087 -
1088QTextEngine::QTextEngine() -
1089{ -
1090 init(this); -
1091}
executed: }
Execution Count:17216
17216
1092 -
1093QTextEngine::QTextEngine(const QString &str, const QFont &f) -
1094 : text(str), -
1095 fnt(f) -
1096{ -
1097 init(this); -
1098}
executed: }
Execution Count:186248
186248
1099 -
1100QTextEngine::~QTextEngine() -
1101{ -
1102 if (!stackEngine)
evaluated: !stackEngine
TRUEFALSE
yes
Evaluation Count:154184
yes
Evaluation Count:49261
49261-154184
1103 delete layoutData;
executed: delete layoutData;
Execution Count:154184
154184
1104 delete specialData; -
1105 resetFontEngineCache(); -
1106}
executed: }
Execution Count:203445
203445
1107 -
1108const QCharAttributes *QTextEngine::attributes() const -
1109{ -
1110 if (layoutData && layoutData->haveCharAttributes)
evaluated: layoutData
TRUEFALSE
yes
Evaluation Count:461778
yes
Evaluation Count:111
evaluated: layoutData->haveCharAttributes
TRUEFALSE
yes
Evaluation Count:265419
yes
Evaluation Count:196359
111-461778
1111 return (QCharAttributes *) layoutData->memory;
executed: return (QCharAttributes *) layoutData->memory;
Execution Count:265419
265419
1112 -
1113 itemize(); -
1114 if (! ensureSpace(layoutData->string.length()))
partially evaluated: ! ensureSpace(layoutData->string.length())
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:196470
0-196470
1115 return __null;
never executed: return __null;
0
1116 -
1117 QVarLengthArray<QUnicodeTools::ScriptItem> scriptItems(layoutData->items.size()); -
1118 for (int i = 0; i < layoutData->items.size(); ++i) {
evaluated: i < layoutData->items.size()
TRUEFALSE
yes
Evaluation Count:218179
yes
Evaluation Count:196470
196470-218179
1119 const QScriptItem &si = layoutData->items[i]; -
1120 scriptItems[i].position = si.position; -
1121 scriptItems[i].script = si.analysis.script; -
1122 }
executed: }
Execution Count:218179
218179
1123 -
1124 QUnicodeTools::initCharAttributes(reinterpret_cast<const HB_UChar16 *>(layoutData->string.constData()), -
1125 layoutData->string.length(), -
1126 scriptItems.data(), scriptItems.size(), -
1127 (QCharAttributes *)layoutData->memory); -
1128 -
1129 -
1130 layoutData->haveCharAttributes = true; -
1131 return (QCharAttributes *) layoutData->memory;
executed: return (QCharAttributes *) layoutData->memory;
Execution Count:196470
196470
1132} -
1133 -
1134void QTextEngine::shape(int item) const -
1135{ -
1136 if (layoutData->items[item].analysis.flags == QScriptAnalysis::Object) {
evaluated: layoutData->items[item].analysis.flags == QScriptAnalysis::Object
TRUEFALSE
yes
Evaluation Count:16
yes
Evaluation Count:273058
16-273058
1137 ensureSpace(1); -
1138 if (block.docHandle()) {
partially evaluated: block.docHandle()
TRUEFALSE
yes
Evaluation Count:16
no
Evaluation Count:0
0-16
1139 QTextFormat format = formats()->format(formatIndex(&layoutData->items[item])); -
1140 docLayout()->resizeInlineObject(QTextInlineObject(item, const_cast<QTextEngine *>(this)), -
1141 layoutData->items[item].position + block.position(), format); -
1142 }
executed: }
Execution Count:16
16
1143 } else if (layoutData->items[item].analysis.flags == QScriptAnalysis::Tab) {
executed: }
Execution Count:16
evaluated: layoutData->items[item].analysis.flags == QScriptAnalysis::Tab
TRUEFALSE
yes
Evaluation Count:14
yes
Evaluation Count:273044
14-273044
1144 -
1145 fontEngine(layoutData->items[item], -
1146 &layoutData->items[item].ascent, -
1147 &layoutData->items[item].descent, -
1148 &layoutData->items[item].leading); -
1149 } else {
executed: }
Execution Count:14
14
1150 shapeText(item); -
1151 }
executed: }
Execution Count:273044
273044
1152} -
1153 -
1154static inline void releaseCachedFontEngine(QFontEngine *fontEngine) -
1155{ -
1156 if (fontEngine) {
evaluated: fontEngine
TRUEFALSE
yes
Evaluation Count:209307
yes
Evaluation Count:688621
209307-688621
1157 fontEngine->ref.deref(); -
1158 if (fontEngine->cache_count == 0 && fontEngine->ref.load() == 0)
evaluated: fontEngine->cache_count == 0
TRUEFALSE
yes
Evaluation Count:43
yes
Evaluation Count:209264
partially evaluated: fontEngine->ref.load() == 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:43
0-209264
1159 delete fontEngine;
never executed: delete fontEngine;
0
1160 }
executed: }
Execution Count:209307
209307
1161}
executed: }
Execution Count:897928
897928
1162 -
1163void QTextEngine::resetFontEngineCache() -
1164{ -
1165 releaseCachedFontEngine(feCache.prevFontEngine); -
1166 releaseCachedFontEngine(feCache.prevScaledFontEngine); -
1167 feCache.reset(); -
1168}
executed: }
Execution Count:448008
448008
1169 -
1170void QTextEngine::invalidate() -
1171{ -
1172 freeMemory(); -
1173 minWidth = 0; -
1174 maxWidth = 0; -
1175 if (specialData)
evaluated: specialData
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:229487
7-229487
1176 specialData->resolvedFormatIndices.clear();
executed: specialData->resolvedFormatIndices.clear();
Execution Count:7
7
1177 -
1178 resetFontEngineCache(); -
1179}
executed: }
Execution Count:229494
229494
1180 -
1181void QTextEngine::clearLineData() -
1182{ -
1183 lines.clear(); -
1184}
executed: }
Execution Count:238789
238789
1185 -
1186void QTextEngine::validate() const -
1187{ -
1188 if (layoutData)
evaluated: layoutData
TRUEFALSE
yes
Evaluation Count:657541
yes
Evaluation Count:198182
198182-657541
1189 return;
executed: return;
Execution Count:657541
657541
1190 layoutData = new LayoutData(); -
1191 if (block.docHandle()) {
evaluated: block.docHandle()
TRUEFALSE
yes
Evaluation Count:20547
yes
Evaluation Count:177635
20547-177635
1192 layoutData->string = block.text(); -
1193 if (option.flags() & QTextOption::ShowLineAndParagraphSeparators)
partially evaluated: option.flags() & QTextOption::ShowLineAndParagraphSeparators
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:20547
0-20547
1194 layoutData->string += QLatin1Char(block.next().isValid() ? 0xb6 : 0x20);
never executed: layoutData->string += QLatin1Char(block.next().isValid() ? 0xb6 : 0x20);
0
1195 } else {
executed: }
Execution Count:20547
20547
1196 layoutData->string = text; -
1197 }
executed: }
Execution Count:177635
177635
1198 if (specialData && specialData->preeditPosition != -1)
evaluated: specialData
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:198177
evaluated: specialData->preeditPosition != -1
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:2
2-198177
1199 layoutData->string.insert(specialData->preeditPosition, specialData->preeditText);
executed: layoutData->string.insert(specialData->preeditPosition, specialData->preeditText);
Execution Count:3
3
1200}
executed: }
Execution Count:198182
198182
1201 -
1202void QTextEngine::itemize() const -
1203{ -
1204 validate(); -
1205 if (layoutData->items.size())
evaluated: layoutData->items.size()
TRUEFALSE
yes
Evaluation Count:603922
yes
Evaluation Count:247532
247532-603922
1206 return;
executed: return;
Execution Count:603922
603922
1207 -
1208 int length = layoutData->string.length(); -
1209 if (!length)
evaluated: !length
TRUEFALSE
yes
Evaluation Count:20880
yes
Evaluation Count:226652
20880-226652
1210 return;
executed: return;
Execution Count:20880
20880
1211 -
1212 bool ignore = ignoreBidi; -
1213 -
1214 bool rtl = isRightToLeft(); -
1215 -
1216 if (!ignore && !rtl) {
evaluated: !ignore
TRUEFALSE
yes
Evaluation Count:186536
yes
Evaluation Count:40116
evaluated: !rtl
TRUEFALSE
yes
Evaluation Count:186337
yes
Evaluation Count:199
199-186536
1217 ignore = true; -
1218 const QChar *start = layoutData->string.unicode(); -
1219 const QChar * const end = start + length; -
1220 while (start < end) {
evaluated: start < end
TRUEFALSE
yes
Evaluation Count:2745656
yes
Evaluation Count:185003
185003-2745656
1221 if (start->unicode() >= 0x590) {
evaluated: start->unicode() >= 0x590
TRUEFALSE
yes
Evaluation Count:1334
yes
Evaluation Count:2744322
1334-2744322
1222 ignore = false; -
1223 break;
executed: break;
Execution Count:1334
1334
1224 } -
1225 ++start; -
1226 }
executed: }
Execution Count:2744322
2744322
1227 }
executed: }
Execution Count:186337
186337
1228 -
1229 QVarLengthArray<QScriptAnalysis, 4096> scriptAnalysis(length); -
1230 QScriptAnalysis *analysis = scriptAnalysis.data(); -
1231 -
1232 QBidiControl control(rtl); -
1233 -
1234 if (ignore) {
evaluated: ignore
TRUEFALSE
yes
Evaluation Count:225119
yes
Evaluation Count:1533
1533-225119
1235 memset(analysis, 0, length*sizeof(QScriptAnalysis)); -
1236 if (option.textDirection() == Qt::RightToLeft) {
evaluated: option.textDirection() == Qt::RightToLeft
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:225115
4-225115
1237 for (int i = 0; i < length; ++i)
evaluated: i < length
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:4
4-8
1238 analysis[i].bidiLevel = 1;
executed: analysis[i].bidiLevel = 1;
Execution Count:8
8
1239 layoutData->hasBidi = true; -
1240 }
executed: }
Execution Count:4
4
1241 } else {
executed: }
Execution Count:225119
225119
1242 layoutData->hasBidi = bidiItemize(const_cast<QTextEngine *>(this), analysis, control); -
1243 }
executed: }
Execution Count:1533
1533
1244 -
1245 const ushort *uc = reinterpret_cast<const ushort *>(layoutData->string.unicode()); -
1246 const ushort *e = uc + length; -
1247 int lastScript = QUnicodeTables::Common; -
1248 while (uc < e) {
evaluated: uc < e
TRUEFALSE
yes
Evaluation Count:3391885
yes
Evaluation Count:226652
226652-3391885
1249 switch (*uc) { -
1250 case QChar::ObjectReplacementCharacter: -
1251 analysis->script = QUnicodeTables::Common; -
1252 analysis->flags = QScriptAnalysis::Object; -
1253 break;
executed: break;
Execution Count:68
68
1254 case QChar::LineSeparator: -
1255 if (analysis->bidiLevel % 2)
evaluated: analysis->bidiLevel % 2
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:10832
2-10832
1256 --analysis->bidiLevel;
executed: --analysis->bidiLevel;
Execution Count:2
2
1257 analysis->script = QUnicodeTables::Common; -
1258 analysis->flags = QScriptAnalysis::LineOrParagraphSeparator; -
1259 if (option.flags() & QTextOption::ShowLineAndParagraphSeparators)
partially evaluated: option.flags() & QTextOption::ShowLineAndParagraphSeparators
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:10834
0-10834
1260 *const_cast<ushort*>(uc) = 0x21B5;
never executed: *const_cast<ushort*>(uc) = 0x21B5;
0
1261 break;
executed: break;
Execution Count:10834
10834
1262 case QChar::Tabulation: -
1263 analysis->script = QUnicodeTables::Common; -
1264 analysis->flags = QScriptAnalysis::Tab; -
1265 analysis->bidiLevel = control.baseLevel(); -
1266 break;
executed: break;
Execution Count:13
13
1267 case QChar::Space: -
1268 case QChar::Nbsp: -
1269 if (option.flags() & QTextOption::ShowTabsAndSpaces) {
partially evaluated: option.flags() & QTextOption::ShowTabsAndSpaces
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:364068
0-364068
1270 analysis->script = QUnicodeTables::Common; -
1271 analysis->flags = QScriptAnalysis::Space; -
1272 analysis->bidiLevel = control.baseLevel(); -
1273 break;
never executed: break;
0
1274 } -
1275 -
1276 default:
code before this statement executed: default:
Execution Count:364068
364068
1277 int script = QUnicodeTables::script(*uc); -
1278 analysis->script = script == QUnicodeTables::Inherited ? lastScript : script;
evaluated: script == QUnicodeTables::Inherited
TRUEFALSE
yes
Evaluation Count:1030
yes
Evaluation Count:3379940
1030-3379940
1279 analysis->flags = QScriptAnalysis::None; -
1280 break;
executed: break;
Execution Count:3380970
3380970
1281 } -
1282 lastScript = analysis->script; -
1283 ++uc; -
1284 ++analysis; -
1285 }
executed: }
Execution Count:3391885
3391885
1286 if (option.flags() & QTextOption::ShowLineAndParagraphSeparators) {
partially evaluated: option.flags() & QTextOption::ShowLineAndParagraphSeparators
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:226652
0-226652
1287 (analysis-1)->flags = QScriptAnalysis::LineOrParagraphSeparator; -
1288 }
never executed: }
0
1289 -
1290 Itemizer itemizer(layoutData->string, scriptAnalysis.data(), layoutData->items); -
1291 -
1292 const QTextDocumentPrivate *p = block.docHandle(); -
1293 if (p) {
evaluated: p
TRUEFALSE
yes
Evaluation Count:4751
yes
Evaluation Count:221901
4751-221901
1294 SpecialData *s = specialData; -
1295 -
1296 QTextDocumentPrivate::FragmentIterator it = p->find(block.position()); -
1297 QTextDocumentPrivate::FragmentIterator end = p->find(block.position() + block.length() - 1); -
1298 int format = it.value()->format; -
1299 -
1300 int prevPosition = 0; -
1301 int position = prevPosition; -
1302 while (1) {
partially evaluated: 1
TRUEFALSE
yes
Evaluation Count:10394
no
Evaluation Count:0
0-10394
1303 const QTextFragmentData * const frag = it.value(); -
1304 if (it == end || format != frag->format) {
evaluated: it == end
TRUEFALSE
yes
Evaluation Count:4751
yes
Evaluation Count:5643
evaluated: format != frag->format
TRUEFALSE
yes
Evaluation Count:645
yes
Evaluation Count:4998
645-5643
1305 if (s && position >= s->preeditPosition) {
evaluated: s
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:5392
partially evaluated: position >= s->preeditPosition
TRUEFALSE
yes
Evaluation Count:4
no
Evaluation Count:0
0-5392
1306 position += s->preeditText.length(); -
1307 s = 0; -
1308 }
executed: }
Execution Count:4
4
1309 qt_noop(); -
1310 QFont::Capitalization capitalization = -
1311 formats()->charFormat(format).hasProperty(QTextFormat::FontCapitalization)
evaluated: formats()->charFormat(format).hasProperty(QTextFormat::FontCapitalization)
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:5394
2-5394
1312 ? formats()->charFormat(format).fontCapitalization() -
1313 : formats()->defaultFont().capitalization(); -
1314 itemizer.generate(prevPosition, position - prevPosition, capitalization); -
1315 if (it == end) {
evaluated: it == end
TRUEFALSE
yes
Evaluation Count:4751
yes
Evaluation Count:645
645-4751
1316 if (position < length)
partially evaluated: position < length
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4751
0-4751
1317 itemizer.generate(position, length - position, capitalization);
never executed: itemizer.generate(position, length - position, capitalization);
0
1318 break;
executed: break;
Execution Count:4751
4751
1319 } -
1320 format = frag->format; -
1321 prevPosition = position; -
1322 }
executed: }
Execution Count:645
645
1323 position += frag->size_array[0]; -
1324 ++it; -
1325 }
executed: }
Execution Count:5643
5643
1326 } else {
executed: }
Execution Count:4751
4751
1327 -
1328 if (useRawFont && specialData) {
partially evaluated: useRawFont
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:221901
never evaluated: specialData
0-221901
1329 int lastIndex = 0; -
1330 for (int i = 0; i < specialData->addFormats.size(); ++i) {
never evaluated: i < specialData->addFormats.size()
0
1331 const QTextLayout::FormatRange &range = specialData->addFormats.at(i); -
1332 if (range.format.fontCapitalization()) {
never evaluated: range.format.fontCapitalization()
0
1333 itemizer.generate(lastIndex, range.start - lastIndex, QFont::MixedCase); -
1334 itemizer.generate(range.start, range.length, range.format.fontCapitalization()); -
1335 lastIndex = range.start + range.length; -
1336 }
never executed: }
0
1337 }
never executed: }
0
1338 itemizer.generate(lastIndex, length - lastIndex, QFont::MixedCase); -
1339 } else
never executed: }
0
1340 -
1341 itemizer.generate(0, length, static_cast<QFont::Capitalization> (fnt.d->capital));
executed: itemizer.generate(0, length, static_cast<QFont::Capitalization> (fnt.d->capital));
Execution Count:221901
221901
1342 } -
1343 -
1344 addRequiredBoundaries(); -
1345 resolveAdditionalFormats(); -
1346}
executed: }
Execution Count:226652
226652
1347 -
1348bool QTextEngine::isRightToLeft() const -
1349{ -
1350 switch (option.textDirection()) { -
1351 case Qt::LeftToRight: -
1352 return false;
executed: return false;
Execution Count:77642
77642
1353 case Qt::RightToLeft: -
1354 return true;
executed: return true;
Execution Count:2024
2024
1355 default: -
1356 break;
executed: break;
Execution Count:159267
159267
1357 } -
1358 if (!layoutData)
partially evaluated: !layoutData
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:159267
0-159267
1359 itemize();
never executed: itemize();
0
1360 -
1361 if (layoutData->string.isEmpty())
evaluated: layoutData->string.isEmpty()
TRUEFALSE
yes
Evaluation Count:211
yes
Evaluation Count:159056
211-159056
1362 return (static_cast<QGuiApplication *>(QCoreApplication::instance())) ? (static_cast<QGuiApplication *>(QCoreApplication::instance()))->inputMethod()->inputDirection() == Qt::RightToLeft : false;
executed: return (static_cast<QGuiApplication *>(QCoreApplication::instance())) ? (static_cast<QGuiApplication *>(QCoreApplication::instance()))->inputMethod()->inputDirection() == Qt::RightToLeft : false;
Execution Count:211
211
1363 return layoutData->string.isRightToLeft();
executed: return layoutData->string.isRightToLeft();
Execution Count:159056
159056
1364} -
1365 -
1366 -
1367int QTextEngine::findItem(int strPos) const -
1368{ -
1369 itemize(); -
1370 int left = 1; -
1371 int right = layoutData->items.size()-1; -
1372 while(left <= right) {
evaluated: left <= right
TRUEFALSE
yes
Evaluation Count:196493
yes
Evaluation Count:389936
196493-389936
1373 int middle = ((right-left)/2)+left; -
1374 if (strPos > layoutData->items[middle].position)
evaluated: strPos > layoutData->items[middle].position
TRUEFALSE
yes
Evaluation Count:93056
yes
Evaluation Count:103437
93056-103437
1375 left = middle+1;
executed: left = middle+1;
Execution Count:93056
93056
1376 else if(strPos < layoutData->items[middle].position)
evaluated: strPos < layoutData->items[middle].position
TRUEFALSE
yes
Evaluation Count:87352
yes
Evaluation Count:16085
16085-87352
1377 right = middle-1;
executed: right = middle-1;
Execution Count:87352
87352
1378 else { -
1379 return middle;
executed: return middle;
Execution Count:16085
16085
1380 } -
1381 } -
1382 return right;
executed: return right;
Execution Count:389936
389936
1383} -
1384 -
1385QFixed QTextEngine::width(int from, int len) const -
1386{ -
1387 itemize(); -
1388 -
1389 QFixed w = 0; -
1390 -
1391 -
1392 for (int i = 0; i < layoutData->items.size(); i++) {
evaluated: i < layoutData->items.size()
TRUEFALSE
yes
Evaluation Count:23443
yes
Evaluation Count:23629
23443-23629
1393 const QScriptItem *si = layoutData->items.constData() + i; -
1394 int pos = si->position; -
1395 int ilen = length(i); -
1396 -
1397 if (pos >= from + len)
partially evaluated: pos >= from + len
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:23443
0-23443
1398 break;
never executed: break;
0
1399 if (pos + ilen > from) {
partially evaluated: pos + ilen > from
TRUEFALSE
yes
Evaluation Count:23443
no
Evaluation Count:0
0-23443
1400 if (!si->num_glyphs)
evaluated: !si->num_glyphs
TRUEFALSE
yes
Evaluation Count:10953
yes
Evaluation Count:12490
10953-12490
1401 shape(i);
executed: shape(i);
Execution Count:10953
10953
1402 -
1403 if (si->analysis.flags == QScriptAnalysis::Object) {
partially evaluated: si->analysis.flags == QScriptAnalysis::Object
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:23443
0-23443
1404 w += si->width; -
1405 continue;
never executed: continue;
0
1406 } else if (si->analysis.flags == QScriptAnalysis::Tab) {
partially evaluated: si->analysis.flags == QScriptAnalysis::Tab
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:23443
0-23443
1407 w += calculateTabWidth(i, w); -
1408 continue;
never executed: continue;
0
1409 } -
1410 -
1411 -
1412 QGlyphLayout glyphs = shapedGlyphs(si); -
1413 unsigned short *logClusters = this->logClusters(si); -
1414 -
1415 -
1416 -
1417 -
1418 -
1419 -
1420 int charFrom = from - pos; -
1421 if (charFrom < 0)
evaluated: charFrom < 0
TRUEFALSE
yes
Evaluation Count:60
yes
Evaluation Count:23383
60-23383
1422 charFrom = 0;
executed: charFrom = 0;
Execution Count:60
60
1423 int glyphStart = logClusters[charFrom]; -
1424 if (charFrom > 0 && logClusters[charFrom-1] == glyphStart)
evaluated: charFrom > 0
TRUEFALSE
yes
Evaluation Count:11219
yes
Evaluation Count:12224
evaluated: logClusters[charFrom-1] == glyphStart
TRUEFALSE
yes
Evaluation Count:28
yes
Evaluation Count:11191
28-12224
1425 while (charFrom < ilen && logClusters[charFrom] == glyphStart)
partially evaluated: charFrom < ilen
TRUEFALSE
yes
Evaluation Count:59
no
Evaluation Count:0
evaluated: logClusters[charFrom] == glyphStart
TRUEFALSE
yes
Evaluation Count:31
yes
Evaluation Count:28
0-59
1426 charFrom++;
executed: charFrom++;
Execution Count:31
31
1427 if (charFrom < ilen) {
partially evaluated: charFrom < ilen
TRUEFALSE
yes
Evaluation Count:23443
no
Evaluation Count:0
0-23443
1428 glyphStart = logClusters[charFrom]; -
1429 int charEnd = from + len - 1 - pos; -
1430 if (charEnd >= ilen)
evaluated: charEnd >= ilen
TRUEFALSE
yes
Evaluation Count:60
yes
Evaluation Count:23383
60-23383
1431 charEnd = ilen-1;
executed: charEnd = ilen-1;
Execution Count:60
60
1432 int glyphEnd = logClusters[charEnd]; -
1433 while (charEnd < ilen && logClusters[charEnd] == glyphEnd)
evaluated: charEnd < ilen
TRUEFALSE
yes
Evaluation Count:35731
yes
Evaluation Count:11186
evaluated: logClusters[charEnd] == glyphEnd
TRUEFALSE
yes
Evaluation Count:23474
yes
Evaluation Count:12257
11186-35731
1434 charEnd++;
executed: charEnd++;
Execution Count:23474
23474
1435 glyphEnd = (charEnd == ilen) ? si->num_glyphs : logClusters[charEnd];
evaluated: (charEnd == ilen)
TRUEFALSE
yes
Evaluation Count:11186
yes
Evaluation Count:12257
11186-12257
1436 -
1437 -
1438 for (int i = glyphStart; i < glyphEnd; i++)
evaluated: i < glyphEnd
TRUEFALSE
yes
Evaluation Count:499530
yes
Evaluation Count:23443
23443-499530
1439 w += glyphs.advances_x[i] * !glyphs.attributes[i].dontPrint;
executed: w += glyphs.advances_x[i] * !glyphs.attributes[i].dontPrint;
Execution Count:499530
499530
1440 }
executed: }
Execution Count:23443
23443
1441 }
executed: }
Execution Count:23443
23443
1442 }
executed: }
Execution Count:23443
23443
1443 -
1444 return w;
executed: return w;
Execution Count:23629
23629
1445} -
1446 -
1447glyph_metrics_t QTextEngine::boundingBox(int from, int len) const -
1448{ -
1449 itemize(); -
1450 -
1451 glyph_metrics_t gm; -
1452 -
1453 for (int i = 0; i < layoutData->items.size(); i++) {
evaluated: i < layoutData->items.size()
TRUEFALSE
yes
Evaluation Count:880
yes
Evaluation Count:880
880
1454 const QScriptItem *si = layoutData->items.constData() + i; -
1455 -
1456 int pos = si->position; -
1457 int ilen = length(i); -
1458 if (pos > from + len)
partially evaluated: pos > from + len
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:880
0-880
1459 break;
never executed: break;
0
1460 if (pos + ilen > from) {
partially evaluated: pos + ilen > from
TRUEFALSE
yes
Evaluation Count:880
no
Evaluation Count:0
0-880
1461 if (!si->num_glyphs)
partially evaluated: !si->num_glyphs
TRUEFALSE
yes
Evaluation Count:880
no
Evaluation Count:0
0-880
1462 shape(i);
executed: shape(i);
Execution Count:880
880
1463 -
1464 if (si->analysis.flags == QScriptAnalysis::Object) {
partially evaluated: si->analysis.flags == QScriptAnalysis::Object
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:880
0-880
1465 gm.width += si->width; -
1466 continue;
never executed: continue;
0
1467 } else if (si->analysis.flags == QScriptAnalysis::Tab) {
partially evaluated: si->analysis.flags == QScriptAnalysis::Tab
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:880
0-880
1468 gm.width += calculateTabWidth(i, gm.width); -
1469 continue;
never executed: continue;
0
1470 } -
1471 -
1472 unsigned short *logClusters = this->logClusters(si); -
1473 QGlyphLayout glyphs = shapedGlyphs(si); -
1474 -
1475 -
1476 int charFrom = from - pos; -
1477 if (charFrom < 0)
partially evaluated: charFrom < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:880
0-880
1478 charFrom = 0;
never executed: charFrom = 0;
0
1479 int glyphStart = logClusters[charFrom]; -
1480 if (charFrom > 0 && logClusters[charFrom-1] == glyphStart)
partially evaluated: charFrom > 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:880
never evaluated: logClusters[charFrom-1] == glyphStart
0-880
1481 while (charFrom < ilen && logClusters[charFrom] == glyphStart)
never evaluated: charFrom < ilen
never evaluated: logClusters[charFrom] == glyphStart
0
1482 charFrom++;
never executed: charFrom++;
0
1483 if (charFrom < ilen) {
partially evaluated: charFrom < ilen
TRUEFALSE
yes
Evaluation Count:880
no
Evaluation Count:0
0-880
1484 QFontEngine *fe = fontEngine(*si); -
1485 glyphStart = logClusters[charFrom]; -
1486 int charEnd = from + len - 1 - pos; -
1487 if (charEnd >= ilen)
partially evaluated: charEnd >= ilen
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:880
0-880
1488 charEnd = ilen-1;
never executed: charEnd = ilen-1;
0
1489 int glyphEnd = logClusters[charEnd]; -
1490 while (charEnd < ilen && logClusters[charEnd] == glyphEnd)
evaluated: charEnd < ilen
TRUEFALSE
yes
Evaluation Count:880
yes
Evaluation Count:880
partially evaluated: logClusters[charEnd] == glyphEnd
TRUEFALSE
yes
Evaluation Count:880
no
Evaluation Count:0
0-880
1491 charEnd++;
executed: charEnd++;
Execution Count:880
880
1492 glyphEnd = (charEnd == ilen) ? si->num_glyphs : logClusters[charEnd];
partially evaluated: (charEnd == ilen)
TRUEFALSE
yes
Evaluation Count:880
no
Evaluation Count:0
0-880
1493 if (glyphStart <= glyphEnd ) {
partially evaluated: glyphStart <= glyphEnd
TRUEFALSE
yes
Evaluation Count:880
no
Evaluation Count:0
0-880
1494 glyph_metrics_t m = fe->boundingBox(glyphs.mid(glyphStart, glyphEnd - glyphStart)); -
1495 gm.x = qMin(gm.x, m.x + gm.xoff); -
1496 gm.y = qMin(gm.y, m.y + gm.yoff); -
1497 gm.width = qMax(gm.width, m.width+gm.xoff); -
1498 gm.height = qMax(gm.height, m.height+gm.yoff); -
1499 gm.xoff += m.xoff; -
1500 gm.yoff += m.yoff; -
1501 }
executed: }
Execution Count:880
880
1502 }
executed: }
Execution Count:880
880
1503 }
executed: }
Execution Count:880
880
1504 }
executed: }
Execution Count:880
880
1505 return gm;
executed: return gm;
Execution Count:880
880
1506} -
1507 -
1508glyph_metrics_t QTextEngine::tightBoundingBox(int from, int len) const -
1509{ -
1510 itemize(); -
1511 -
1512 glyph_metrics_t gm; -
1513 -
1514 for (int i = 0; i < layoutData->items.size(); i++) {
never evaluated: i < layoutData->items.size()
0
1515 const QScriptItem *si = layoutData->items.constData() + i; -
1516 int pos = si->position; -
1517 int ilen = length(i); -
1518 if (pos > from + len)
never evaluated: pos > from + len
0
1519 break;
never executed: break;
0
1520 if (pos + len > from) {
never evaluated: pos + len > from
0
1521 if (!si->num_glyphs)
never evaluated: !si->num_glyphs
0
1522 shape(i);
never executed: shape(i);
0
1523 unsigned short *logClusters = this->logClusters(si); -
1524 QGlyphLayout glyphs = shapedGlyphs(si); -
1525 -
1526 -
1527 int charFrom = from - pos; -
1528 if (charFrom < 0)
never evaluated: charFrom < 0
0
1529 charFrom = 0;
never executed: charFrom = 0;
0
1530 int glyphStart = logClusters[charFrom]; -
1531 if (charFrom > 0 && logClusters[charFrom-1] == glyphStart)
never evaluated: charFrom > 0
never evaluated: logClusters[charFrom-1] == glyphStart
0
1532 while (charFrom < ilen && logClusters[charFrom] == glyphStart)
never evaluated: charFrom < ilen
never evaluated: logClusters[charFrom] == glyphStart
0
1533 charFrom++;
never executed: charFrom++;
0
1534 if (charFrom < ilen) {
never evaluated: charFrom < ilen
0
1535 glyphStart = logClusters[charFrom]; -
1536 int charEnd = from + len - 1 - pos; -
1537 if (charEnd >= ilen)
never evaluated: charEnd >= ilen
0
1538 charEnd = ilen-1;
never executed: charEnd = ilen-1;
0
1539 int glyphEnd = logClusters[charEnd]; -
1540 while (charEnd < ilen && logClusters[charEnd] == glyphEnd)
never evaluated: charEnd < ilen
never evaluated: logClusters[charEnd] == glyphEnd
0
1541 charEnd++;
never executed: charEnd++;
0
1542 glyphEnd = (charEnd == ilen) ? si->num_glyphs : logClusters[charEnd];
never evaluated: (charEnd == ilen)
0
1543 if (glyphStart <= glyphEnd ) {
never evaluated: glyphStart <= glyphEnd
0
1544 QFontEngine *fe = fontEngine(*si); -
1545 glyph_metrics_t m = fe->tightBoundingBox(glyphs.mid(glyphStart, glyphEnd - glyphStart)); -
1546 gm.x = qMin(gm.x, m.x + gm.xoff); -
1547 gm.y = qMin(gm.y, m.y + gm.yoff); -
1548 gm.width = qMax(gm.width, m.width+gm.xoff); -
1549 gm.height = qMax(gm.height, m.height+gm.yoff); -
1550 gm.xoff += m.xoff; -
1551 gm.yoff += m.yoff; -
1552 }
never executed: }
0
1553 }
never executed: }
0
1554 }
never executed: }
0
1555 }
never executed: }
0
1556 return gm;
never executed: return gm;
0
1557} -
1558 -
1559QFont QTextEngine::font(const QScriptItem &si) const -
1560{ -
1561 QFont font = fnt; -
1562 if (hasFormats()) {
evaluated: hasFormats()
TRUEFALSE
yes
Evaluation Count:7675
yes
Evaluation Count:508947
7675-508947
1563 QTextCharFormat f = format(&si); -
1564 font = f.font(); -
1565 -
1566 if (block.docHandle() && block.docHandle()->layout()) {
evaluated: block.docHandle()
TRUEFALSE
yes
Evaluation Count:7673
yes
Evaluation Count:2
partially evaluated: block.docHandle()->layout()
TRUEFALSE
yes
Evaluation Count:7673
no
Evaluation Count:0
0-7673
1567 -
1568 QPaintDevice *pdev = block.docHandle()->layout()->paintDevice(); -
1569 if (pdev)
evaluated: pdev
TRUEFALSE
yes
Evaluation Count:2416
yes
Evaluation Count:5257
2416-5257
1570 font = QFont(font, pdev);
executed: font = QFont(font, pdev);
Execution Count:2416
2416
1571 } else {
executed: }
Execution Count:7673
7673
1572 font = font.resolve(fnt); -
1573 }
executed: }
Execution Count:2
2
1574 QTextCharFormat::VerticalAlignment valign = f.verticalAlignment(); -
1575 if (valign == QTextCharFormat::AlignSuperScript || valign == QTextCharFormat::AlignSubScript) {
partially evaluated: valign == QTextCharFormat::AlignSuperScript
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:7675
partially evaluated: valign == QTextCharFormat::AlignSubScript
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:7675
0-7675
1576 if (font.pointSize() != -1)
never evaluated: font.pointSize() != -1
0
1577 font.setPointSize((font.pointSize() * 2) / 3);
never executed: font.setPointSize((font.pointSize() * 2) / 3);
0
1578 else -
1579 font.setPixelSize((font.pixelSize() * 2) / 3);
never executed: font.setPixelSize((font.pixelSize() * 2) / 3);
0
1580 } -
1581 }
executed: }
Execution Count:7675
7675
1582 -
1583 if (si.analysis.flags == QScriptAnalysis::SmallCaps)
partially evaluated: si.analysis.flags == QScriptAnalysis::SmallCaps
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:516622
0-516622
1584 font = font.d->smallCapsFont();
never executed: font = font.d->smallCapsFont();
0
1585 -
1586 return font;
executed: return font;
Execution Count:516622
516622
1587} -
1588 -
1589QTextEngine::FontEngineCache::FontEngineCache() -
1590{ -
1591 reset(); -
1592}
executed: }
Execution Count:203464
203464
1593 -
1594 -
1595 -
1596QFontEngine *QTextEngine::fontEngine(const QScriptItem &si, QFixed *ascent, QFixed *descent, QFixed *leading) const -
1597{ -
1598 QFontEngine *engine = 0; -
1599 QFontEngine *scaledEngine = 0; -
1600 int script = si.analysis.script; -
1601 -
1602 QFont font = fnt; -
1603 -
1604 if (useRawFont && rawFont.isValid()) {
partially evaluated: useRawFont
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:513034
never evaluated: rawFont.isValid()
0-513034
1605 if (feCache.prevFontEngine && feCache.prevFontEngine->type() == QFontEngine::Multi && feCache.prevScript == script) {
never evaluated: feCache.prevFontEngine
never evaluated: feCache.prevFontEngine->type() == QFontEngine::Multi
never evaluated: feCache.prevScript == script
0
1606 engine = feCache.prevFontEngine; -
1607 } else {
never executed: }
0
1608 engine = QFontEngineMultiQPA::createMultiFontEngine(rawFont.d->fontEngine, script); -
1609 feCache.prevFontEngine = engine; -
1610 feCache.prevScript = script; -
1611 engine->ref.ref(); -
1612 if (feCache.prevScaledFontEngine)
never evaluated: feCache.prevScaledFontEngine
0
1613 releaseCachedFontEngine(feCache.prevScaledFontEngine);
never executed: releaseCachedFontEngine(feCache.prevScaledFontEngine);
0
1614 }
never executed: }
0
1615 if (si.analysis.flags & QFont::SmallCaps) {
never evaluated: si.analysis.flags & QFont::SmallCaps
0
1616 if (feCache.prevScaledFontEngine) {
never evaluated: feCache.prevScaledFontEngine
0
1617 scaledEngine = feCache.prevScaledFontEngine; -
1618 } else {
never executed: }
0
1619 QFontEngine *scEngine = rawFont.d->fontEngine->cloneWithSize(smallCapsFraction * rawFont.pixelSize()); -
1620 scaledEngine = QFontEngineMultiQPA::createMultiFontEngine(scEngine, script); -
1621 scaledEngine->ref.ref(); -
1622 feCache.prevScaledFontEngine = scaledEngine; -
1623 }
never executed: }
0
1624 } -
1625 } else
never executed: }
0
1626 -
1627 { -
1628 if (hasFormats()) {
evaluated: hasFormats()
TRUEFALSE
yes
Evaluation Count:33675
yes
Evaluation Count:479359
33675-479359
1629 if (feCache.prevFontEngine && feCache.prevPosition == si.position && feCache.prevLength == length(&si) && feCache.prevScript == script) {
evaluated: feCache.prevFontEngine
TRUEFALSE
yes
Evaluation Count:31781
yes
Evaluation Count:1894
evaluated: feCache.prevPosition == si.position
TRUEFALSE
yes
Evaluation Count:30355
yes
Evaluation Count:1426
partially evaluated: feCache.prevLength == length(&si)
TRUEFALSE
yes
Evaluation Count:30355
no
Evaluation Count:0
partially evaluated: feCache.prevScript == script
TRUEFALSE
yes
Evaluation Count:30355
no
Evaluation Count:0
0-31781
1630 engine = feCache.prevFontEngine; -
1631 scaledEngine = feCache.prevScaledFontEngine; -
1632 } else {
executed: }
Execution Count:30355
30355
1633 QTextCharFormat f = format(&si); -
1634 font = f.font(); -
1635 -
1636 if (block.docHandle() && block.docHandle()->layout()) {
evaluated: block.docHandle()
TRUEFALSE
yes
Evaluation Count:3319
yes
Evaluation Count:1
partially evaluated: block.docHandle()->layout()
TRUEFALSE
yes
Evaluation Count:3319
no
Evaluation Count:0
0-3319
1637 -
1638 QPaintDevice *pdev = block.docHandle()->layout()->paintDevice(); -
1639 if (pdev)
evaluated: pdev
TRUEFALSE
yes
Evaluation Count:986
yes
Evaluation Count:2333
986-2333
1640 font = QFont(font, pdev);
executed: font = QFont(font, pdev);
Execution Count:986
986
1641 } else {
executed: }
Execution Count:3319
3319
1642 font = font.resolve(fnt); -
1643 }
executed: }
Execution Count:1
1
1644 engine = font.d->engineForScript(script); -
1645 QTextCharFormat::VerticalAlignment valign = f.verticalAlignment(); -
1646 if (valign == QTextCharFormat::AlignSuperScript || valign == QTextCharFormat::AlignSubScript) {
partially evaluated: valign == QTextCharFormat::AlignSuperScript
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3320
partially evaluated: valign == QTextCharFormat::AlignSubScript
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3320
0-3320
1647 if (font.pointSize() != -1)
never evaluated: font.pointSize() != -1
0
1648 font.setPointSize((font.pointSize() * 2) / 3);
never executed: font.setPointSize((font.pointSize() * 2) / 3);
0
1649 else -
1650 font.setPixelSize((font.pixelSize() * 2) / 3);
never executed: font.setPixelSize((font.pixelSize() * 2) / 3);
0
1651 scaledEngine = font.d->engineForScript(script); -
1652 }
never executed: }
0
1653 -
1654 if (engine)
partially evaluated: engine
TRUEFALSE
yes
Evaluation Count:3320
no
Evaluation Count:0
0-3320
1655 engine->ref.ref();
executed: engine->ref.ref();
Execution Count:3320
3320
1656 if (feCache.prevFontEngine)
evaluated: feCache.prevFontEngine
TRUEFALSE
yes
Evaluation Count:1426
yes
Evaluation Count:1894
1426-1894
1657 releaseCachedFontEngine(feCache.prevFontEngine);
executed: releaseCachedFontEngine(feCache.prevFontEngine);
Execution Count:1426
1426
1658 feCache.prevFontEngine = engine; -
1659 -
1660 if (scaledEngine)
partially evaluated: scaledEngine
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3320
0-3320
1661 scaledEngine->ref.ref();
never executed: scaledEngine->ref.ref();
0
1662 if (feCache.prevScaledFontEngine)
partially evaluated: feCache.prevScaledFontEngine
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3320
0-3320
1663 releaseCachedFontEngine(feCache.prevScaledFontEngine);
never executed: releaseCachedFontEngine(feCache.prevScaledFontEngine);
0
1664 feCache.prevScaledFontEngine = scaledEngine; -
1665 -
1666 feCache.prevScript = script; -
1667 feCache.prevPosition = si.position; -
1668 feCache.prevLength = length(&si); -
1669 }
executed: }
Execution Count:3320
3320
1670 } else { -
1671 if (feCache.prevFontEngine && feCache.prevScript == script && feCache.prevPosition == -1)
evaluated: feCache.prevFontEngine
TRUEFALSE
yes
Evaluation Count:273848
yes
Evaluation Count:205511
evaluated: feCache.prevScript == script
TRUEFALSE
yes
Evaluation Count:273362
yes
Evaluation Count:486
partially evaluated: feCache.prevPosition == -1
TRUEFALSE
yes
Evaluation Count:273362
no
Evaluation Count:0
0-273848
1672 engine = feCache.prevFontEngine;
executed: engine = feCache.prevFontEngine;
Execution Count:273362
273362
1673 else { -
1674 engine = font.d->engineForScript(script); -
1675 -
1676 if (engine)
partially evaluated: engine
TRUEFALSE
yes
Evaluation Count:205997
no
Evaluation Count:0
0-205997
1677 engine->ref.ref();
executed: engine->ref.ref();
Execution Count:205997
205997
1678 if (feCache.prevFontEngine)
evaluated: feCache.prevFontEngine
TRUEFALSE
yes
Evaluation Count:486
yes
Evaluation Count:205511
486-205511
1679 releaseCachedFontEngine(feCache.prevFontEngine);
executed: releaseCachedFontEngine(feCache.prevFontEngine);
Execution Count:486
486
1680 feCache.prevFontEngine = engine; -
1681 -
1682 feCache.prevScript = script; -
1683 feCache.prevPosition = -1; -
1684 feCache.prevLength = -1; -
1685 feCache.prevScaledFontEngine = 0; -
1686 }
executed: }
Execution Count:205997
205997
1687 } -
1688 -
1689 if (si.analysis.flags == QScriptAnalysis::SmallCaps) {
partially evaluated: si.analysis.flags == QScriptAnalysis::SmallCaps
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:513034
0-513034
1690 QFontPrivate *p = font.d->smallCapsFontPrivate(); -
1691 scaledEngine = p->engineForScript(script); -
1692 }
never executed: }
0
1693 }
executed: }
Execution Count:513034
513034
1694 -
1695 if (ascent) {
evaluated: ascent
TRUEFALSE
yes
Evaluation Count:247098
yes
Evaluation Count:265936
247098-265936
1696 *ascent = engine->ascent(); -
1697 *descent = engine->descent(); -
1698 *leading = engine->leading(); -
1699 }
executed: }
Execution Count:247098
247098
1700 -
1701 if (scaledEngine)
partially evaluated: scaledEngine
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:513034
0-513034
1702 return scaledEngine;
never executed: return scaledEngine;
0
1703 return engine;
executed: return engine;
Execution Count:513034
513034
1704} -
1705 -
1706struct QJustificationPoint { -
1707 int type; -
1708 QFixed kashidaWidth; -
1709 QGlyphLayout glyph; -
1710}; -
1711 -
1712template<> class QTypeInfo<QJustificationPoint > { public: enum { isComplex = (((Q_PRIMITIVE_TYPE) & Q_PRIMITIVE_TYPE) == 0), isStatic = (((Q_PRIMITIVE_TYPE) & (Q_MOVABLE_TYPE | Q_PRIMITIVE_TYPE)) == 0), isLarge = (sizeof(QJustificationPoint)>sizeof(void*)), isPointer = false, isDummy = (((Q_PRIMITIVE_TYPE) & Q_DUMMY_TYPE) != 0), sizeOf = sizeof(QJustificationPoint) }; static inline const char *name() { return "QJustificationPoint"; } }; -
1713 -
1714static void set(QJustificationPoint *point, int type, const QGlyphLayout &glyph, QFontEngine *fe) -
1715{ -
1716 point->type = type; -
1717 point->glyph = glyph; -
1718 -
1719 if (type >= HB_Arabic_Normal) {
never evaluated: type >= HB_Arabic_Normal
0
1720 QChar ch(0x640); -
1721 QGlyphLayoutArray<8> glyphs; -
1722 int nglyphs = 7; -
1723 fe->stringToCMap(&ch, 1, &glyphs, &nglyphs, 0); -
1724 if (glyphs.glyphs[0] && glyphs.advances_x[0] != 0) {
never evaluated: glyphs.glyphs[0]
never evaluated: glyphs.advances_x[0] != 0
0
1725 point->kashidaWidth = glyphs.advances_x[0]; -
1726 } else {
never executed: }
0
1727 point->type = HB_NoJustification; -
1728 point->kashidaWidth = 0; -
1729 }
never executed: }
0
1730 } -
1731}
never executed: }
0
1732 -
1733 -
1734void QTextEngine::justify(const QScriptLine &line) -
1735{ -
1736 -
1737 if (line.gridfitted && line.justified)
evaluated: line.gridfitted
TRUEFALSE
yes
Evaluation Count:8954
yes
Evaluation Count:26132
partially evaluated: line.justified
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8954
0-26132
1738 return;
never executed: return;
0
1739 -
1740 if (!line.gridfitted) {
evaluated: !line.gridfitted
TRUEFALSE
yes
Evaluation Count:26132
yes
Evaluation Count:8954
8954-26132
1741 -
1742 const_cast<QScriptLine &>(line).gridfitted = true; -
1743 }
executed: }
Execution Count:26132
26132
1744 -
1745 if ((option.alignment() & Qt::AlignHorizontal_Mask) != Qt::AlignJustify)
evaluated: (option.alignment() & Qt::AlignHorizontal_Mask) != Qt::AlignJustify
TRUEFALSE
yes
Evaluation Count:35084
yes
Evaluation Count:2
2-35084
1746 return;
executed: return;
Execution Count:35084
35084
1747 -
1748 itemize(); -
1749 -
1750 if (!forceJustification) {
partially evaluated: !forceJustification
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
0-2
1751 int end = line.from + (int)line.length + line.trailingSpaces; -
1752 if (end == layoutData->string.length())
partially evaluated: end == layoutData->string.length()
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
0-2
1753 return;
executed: return;
Execution Count:2
2
1754 if (end && layoutData->items[findItem(end-1)].analysis.flags == QScriptAnalysis::LineOrParagraphSeparator)
never evaluated: end
never evaluated: layoutData->items[findItem(end-1)].analysis.flags == QScriptAnalysis::LineOrParagraphSeparator
0
1755 return;
never executed: return;
0
1756 }
never executed: }
0
1757 -
1758 -
1759 int maxJustify = 0; -
1760 -
1761 -
1762 int line_length = line.length; -
1763 const QCharAttributes *a = attributes(); -
1764 if (! a)
never evaluated: ! a
0
1765 return;
never executed: return;
0
1766 a += line.from; -
1767 while (line_length && a[line_length-1].whiteSpace)
never evaluated: line_length
never evaluated: a[line_length-1].whiteSpace
0
1768 --line_length;
never executed: --line_length;
0
1769 -
1770 --line_length; -
1771 -
1772 if (!line_length)
never evaluated: !line_length
0
1773 return;
never executed: return;
0
1774 -
1775 int firstItem = findItem(line.from); -
1776 int nItems = findItem(line.from + line_length - 1) - firstItem + 1; -
1777 -
1778 QVarLengthArray<QJustificationPoint> justificationPoints; -
1779 int nPoints = 0; -
1780 -
1781 QFixed minKashida = 0x100000; -
1782 -
1783 -
1784 -
1785 -
1786 for (int i = 0; i < nItems; ++i) {
never evaluated: i < nItems
0
1787 QScriptItem &si = layoutData->items[firstItem + i]; -
1788 if (!si.num_glyphs)
never evaluated: !si.num_glyphs
0
1789 shape(firstItem + i);
never executed: shape(firstItem + i);
0
1790 }
never executed: }
0
1791 -
1792 for (int i = 0; i < nItems; ++i) {
never evaluated: i < nItems
0
1793 QScriptItem &si = layoutData->items[firstItem + i]; -
1794 -
1795 int kashida_type = HB_Arabic_Normal; -
1796 int kashida_pos = -1; -
1797 -
1798 int start = qMax(line.from - si.position, 0); -
1799 int end = qMin(line.from + line_length - (int)si.position, length(firstItem+i)); -
1800 -
1801 unsigned short *log_clusters = logClusters(&si); -
1802 -
1803 int gs = log_clusters[start]; -
1804 int ge = (end == length(firstItem+i) ? si.num_glyphs : log_clusters[end]);
never evaluated: end == length(firstItem+i)
0
1805 -
1806 qt_noop(); -
1807 -
1808 const QGlyphLayout g = shapedGlyphs(&si); -
1809 -
1810 for (int i = gs; i < ge; ++i) {
never evaluated: i < ge
0
1811 g.justifications[i].type = QGlyphJustification::JustifyNone; -
1812 g.justifications[i].nKashidas = 0; -
1813 g.justifications[i].space_18d6 = 0; -
1814 -
1815 justificationPoints.resize(nPoints+3); -
1816 int justification = g.attributes[i].justification; -
1817 -
1818 switch(justification) { -
1819 case HB_NoJustification: -
1820 break;
never executed: break;
0
1821 case HB_Space : -
1822 -
1823 case HB_Arabic_Space : -
1824 if (kashida_pos >= 0) {
never evaluated: kashida_pos >= 0
0
1825 -
1826 set(&justificationPoints[nPoints], kashida_type, g.mid(kashida_pos), fontEngine(si)); -
1827 if (justificationPoints[nPoints].kashidaWidth > 0) {
never evaluated: justificationPoints[nPoints].kashidaWidth > 0
0
1828 minKashida = qMin(minKashida, justificationPoints[nPoints].kashidaWidth); -
1829 maxJustify = qMax(maxJustify, justificationPoints[nPoints].type); -
1830 ++nPoints; -
1831 }
never executed: }
0
1832 }
never executed: }
0
1833 kashida_pos = -1; -
1834 kashida_type = HB_Arabic_Normal; -
1835 -
1836 case HB_Character :
code before this statement never executed: case HB_Character :
0
1837 set(&justificationPoints[nPoints++], justification, g.mid(i), fontEngine(si)); -
1838 maxJustify = qMax(maxJustify, justification); -
1839 break;
never executed: break;
0
1840 case HB_Arabic_Normal : -
1841 case HB_Arabic_Waw : -
1842 case HB_Arabic_BaRa : -
1843 case HB_Arabic_Alef : -
1844 case HB_Arabic_HaaDal : -
1845 case HB_Arabic_Seen : -
1846 case HB_Arabic_Kashida : -
1847 if (justification >= kashida_type) {
never evaluated: justification >= kashida_type
0
1848 kashida_pos = i; -
1849 kashida_type = justification; -
1850 }
never executed: }
0
1851 }
never executed: }
0
1852 }
never executed: }
0
1853 if (kashida_pos >= 0) {
never evaluated: kashida_pos >= 0
0
1854 set(&justificationPoints[nPoints], kashida_type, g.mid(kashida_pos), fontEngine(si)); -
1855 if (justificationPoints[nPoints].kashidaWidth > 0) {
never evaluated: justificationPoints[nPoints].kashidaWidth > 0
0
1856 minKashida = qMin(minKashida, justificationPoints[nPoints].kashidaWidth); -
1857 maxJustify = qMax(maxJustify, justificationPoints[nPoints].type); -
1858 ++nPoints; -
1859 }
never executed: }
0
1860 }
never executed: }
0
1861 }
never executed: }
0
1862 -
1863 QFixed leading = leadingSpaceWidth(line); -
1864 QFixed need = line.width - line.textWidth - leading; -
1865 if (need < 0) {
never evaluated: need < 0
0
1866 -
1867 const_cast<QScriptLine &>(line).justified = true; -
1868 return;
never executed: return;
0
1869 } -
1870 -
1871 -
1872 -
1873 -
1874 -
1875 if (maxJustify >= HB_Arabic_Normal) {
never evaluated: maxJustify >= HB_Arabic_Normal
0
1876 while (need >= minKashida) {
never evaluated: need >= minKashida
0
1877 for (int type = maxJustify; need >= minKashida && type >= HB_Arabic_Normal; --type) {
never evaluated: need >= minKashida
never evaluated: type >= HB_Arabic_Normal
0
1878 for (int i = 0; need >= minKashida && i < nPoints; ++i) {
never evaluated: need >= minKashida
never evaluated: i < nPoints
0
1879 if (justificationPoints[i].type == type && justificationPoints[i].kashidaWidth <= need) {
never evaluated: justificationPoints[i].type == type
never evaluated: justificationPoints[i].kashidaWidth <= need
0
1880 justificationPoints[i].glyph.justifications->nKashidas++; -
1881 -
1882 justificationPoints[i].glyph.justifications->space_18d6 += justificationPoints[i].kashidaWidth.value(); -
1883 need -= justificationPoints[i].kashidaWidth; -
1884 -
1885 }
never executed: }
0
1886 }
never executed: }
0
1887 }
never executed: }
0
1888 }
never executed: }
0
1889 }
never executed: }
0
1890 qt_noop(); -
1891 if (!need)
never evaluated: !need
0
1892 goto end;
never executed: goto end;
0
1893 -
1894 maxJustify = qMin(maxJustify, (int)HB_Space); -
1895 for (int type = maxJustify; need != 0 && type > 0; --type) {
never evaluated: need != 0
never evaluated: type > 0
0
1896 int n = 0; -
1897 for (int i = 0; i < nPoints; ++i) {
never evaluated: i < nPoints
0
1898 if (justificationPoints[i].type == type)
never evaluated: justificationPoints[i].type == type
0
1899 ++n;
never executed: ++n;
0
1900 }
never executed: }
0
1901 -
1902 -
1903 -
1904 if (!n)
never evaluated: !n
0
1905 continue;
never executed: continue;
0
1906 -
1907 for (int i = 0; i < nPoints; ++i) {
never evaluated: i < nPoints
0
1908 if (justificationPoints[i].type == type) {
never evaluated: justificationPoints[i].type == type
0
1909 QFixed add = need/n; -
1910 -
1911 justificationPoints[i].glyph.justifications[0].space_18d6 = add.value(); -
1912 need -= add; -
1913 --n; -
1914 }
never executed: }
0
1915 }
never executed: }
0
1916 -
1917 qt_noop(); -
1918 }
never executed: }
0
1919 end:
code before this statement never executed: end:
0
1920 const_cast<QScriptLine &>(line).justified = true; -
1921}
never executed: }
0
1922 -
1923void QScriptLine::setDefaultHeight(QTextEngine *eng) -
1924{ -
1925 QFont f; -
1926 QFontEngine *e; -
1927 -
1928 if (eng->block.docHandle() && eng->block.docHandle()->layout()) {
evaluated: eng->block.docHandle()
TRUEFALSE
yes
Evaluation Count:4622
yes
Evaluation Count:4611
partially evaluated: eng->block.docHandle()->layout()
TRUEFALSE
yes
Evaluation Count:4622
no
Evaluation Count:0
0-4622
1929 f = eng->block.charFormat().font(); -
1930 -
1931 QPaintDevice *pdev = eng->block.docHandle()->layout()->paintDevice(); -
1932 if (pdev)
evaluated: pdev
TRUEFALSE
yes
Evaluation Count:373
yes
Evaluation Count:4249
373-4249
1933 f = QFont(f, pdev);
executed: f = QFont(f, pdev);
Execution Count:373
373
1934 e = f.d->engineForScript(QUnicodeTables::Common); -
1935 } else {
executed: }
Execution Count:4622
4622
1936 e = eng->fnt.d->engineForScript(QUnicodeTables::Common); -
1937 }
executed: }
Execution Count:4611
4611
1938 -
1939 QFixed other_ascent = e->ascent(); -
1940 QFixed other_descent = e->descent(); -
1941 QFixed other_leading = e->leading(); -
1942 leading = qMax(leading + ascent, other_leading + other_ascent) - qMax(ascent, other_ascent); -
1943 ascent = qMax(ascent, other_ascent); -
1944 descent = qMax(descent, other_descent); -
1945}
executed: }
Execution Count:9233
9233
1946 -
1947QTextEngine::LayoutData::LayoutData() -
1948{ -
1949 memory = 0; -
1950 allocated = 0; -
1951 memory_on_stack = false; -
1952 used = 0; -
1953 hasBidi = false; -
1954 layoutState = LayoutEmpty; -
1955 haveCharAttributes = false; -
1956 logClustersPtr = 0; -
1957 available_glyphs = 0; -
1958}
executed: }
Execution Count:198182
198182
1959 -
1960QTextEngine::LayoutData::LayoutData(const QString &str, void **stack_memory, int _allocated) -
1961 : string(str) -
1962{ -
1963 allocated = _allocated; -
1964 -
1965 int space_charAttributes = sizeof(QCharAttributes)*string.length()/sizeof(void*) + 1; -
1966 int space_logClusters = sizeof(unsigned short)*string.length()/sizeof(void*) + 1; -
1967 available_glyphs = ((int)allocated - space_charAttributes - space_logClusters)*(int)sizeof(void*)/(int)QGlyphLayout::spaceNeededForGlyphLayout(1); -
1968 -
1969 if (available_glyphs < str.length()) {
evaluated: available_glyphs < str.length()
TRUEFALSE
yes
Evaluation Count:12
yes
Evaluation Count:49249
12-49249
1970 -
1971 allocated = 0; -
1972 -
1973 memory_on_stack = false; -
1974 memory = 0; -
1975 logClustersPtr = 0; -
1976 } else {
executed: }
Execution Count:12
12
1977 memory_on_stack = true; -
1978 memory = stack_memory; -
1979 logClustersPtr = (unsigned short *)(memory + space_charAttributes); -
1980 -
1981 void *m = memory + space_charAttributes + space_logClusters; -
1982 glyphLayout = QGlyphLayout(reinterpret_cast<char *>(m), str.length()); -
1983 glyphLayout.clear(); -
1984 memset(memory, 0, space_charAttributes*sizeof(void *)); -
1985 }
executed: }
Execution Count:49249
49249
1986 used = 0; -
1987 hasBidi = false; -
1988 layoutState = LayoutEmpty; -
1989 haveCharAttributes = false; -
1990}
executed: }
Execution Count:49261
49261
1991 -
1992QTextEngine::LayoutData::~LayoutData() -
1993{ -
1994 if (!memory_on_stack)
evaluated: !memory_on_stack
TRUEFALSE
yes
Evaluation Count:198186
yes
Evaluation Count:49249
49249-198186
1995 free(memory);
executed: free(memory);
Execution Count:198186
198186
1996 memory = 0; -
1997}
executed: }
Execution Count:247435
247435
1998 -
1999bool QTextEngine::LayoutData::reallocate(int totalGlyphs) -
2000{ -
2001 qt_noop(); -
2002 if (memory_on_stack && available_glyphs >= totalGlyphs) {
evaluated: memory_on_stack
TRUEFALSE
yes
Evaluation Count:1162
yes
Evaluation Count:175771
partially evaluated: available_glyphs >= totalGlyphs
TRUEFALSE
yes
Evaluation Count:1162
no
Evaluation Count:0
0-175771
2003 glyphLayout.grow(glyphLayout.data(), totalGlyphs); -
2004 return true;
executed: return true;
Execution Count:1162
1162
2005 } -
2006 -
2007 int space_charAttributes = sizeof(QCharAttributes)*string.length()/sizeof(void*) + 1; -
2008 int space_logClusters = sizeof(unsigned short)*string.length()/sizeof(void*) + 1; -
2009 int space_glyphs = QGlyphLayout::spaceNeededForGlyphLayout(totalGlyphs)/sizeof(void*) + 2; -
2010 -
2011 int newAllocated = space_charAttributes + space_glyphs + space_logClusters; -
2012 -
2013 -
2014 -
2015 if (space_charAttributes < 0 || space_logClusters < 0 || space_glyphs < 0 || newAllocated < allocated) {
partially evaluated: space_charAttributes < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:175771
partially evaluated: space_logClusters < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:175771
partially evaluated: space_glyphs < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:175771
partially evaluated: newAllocated < allocated
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:175771
0-175771
2016 layoutState = LayoutFailed; -
2017 return false;
never executed: return false;
0
2018 } -
2019 -
2020 void **newMem = memory; -
2021 newMem = (void **)::realloc(memory_on_stack ? 0 : memory, newAllocated*sizeof(void *)); -
2022 if (!newMem) {
partially evaluated: !newMem
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:175771
0-175771
2023 layoutState = LayoutFailed; -
2024 return false;
never executed: return false;
0
2025 } -
2026 if (memory_on_stack)
partially evaluated: memory_on_stack
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:175771
0-175771
2027 memcpy(newMem, memory, allocated*sizeof(void *));
never executed: memcpy(newMem, memory, allocated*sizeof(void *));
0
2028 memory = newMem; -
2029 memory_on_stack = false; -
2030 -
2031 void **m = memory; -
2032 m += space_charAttributes; -
2033 logClustersPtr = (unsigned short *) m; -
2034 m += space_logClusters; -
2035 -
2036 const int space_preGlyphLayout = space_charAttributes + space_logClusters; -
2037 if (allocated < space_preGlyphLayout)
evaluated: allocated < space_preGlyphLayout
TRUEFALSE
yes
Evaluation Count:175682
yes
Evaluation Count:89
89-175682
2038 memset(memory + allocated, 0, (space_preGlyphLayout - allocated)*sizeof(void *));
executed: memset(memory + allocated, 0, (space_preGlyphLayout - allocated)*sizeof(void *));
Execution Count:175682
175682
2039 -
2040 glyphLayout.grow(reinterpret_cast<char *>(m), totalGlyphs); -
2041 -
2042 allocated = newAllocated; -
2043 return true;
executed: return true;
Execution Count:175771
175771
2044} -
2045 -
2046 -
2047void QGlyphLayout::grow(char *address, int totalGlyphs) -
2048{ -
2049 QGlyphLayout oldLayout(address, numGlyphs); -
2050 QGlyphLayout newLayout(address, totalGlyphs); -
2051 -
2052 if (numGlyphs) {
evaluated: numGlyphs
TRUEFALSE
yes
Evaluation Count:1251
yes
Evaluation Count:175682
1251-175682
2053 -
2054 memmove(newLayout.attributes, oldLayout.attributes, numGlyphs * sizeof(HB_GlyphAttributes)); -
2055 memmove(newLayout.justifications, oldLayout.justifications, numGlyphs * sizeof(QGlyphJustification)); -
2056 memmove(newLayout.advances_y, oldLayout.advances_y, numGlyphs * sizeof(QFixed)); -
2057 memmove(newLayout.advances_x, oldLayout.advances_x, numGlyphs * sizeof(QFixed)); -
2058 memmove(newLayout.glyphs, oldLayout.glyphs, numGlyphs * sizeof(HB_Glyph)); -
2059 }
executed: }
Execution Count:1251
1251
2060 -
2061 -
2062 newLayout.clear(numGlyphs); -
2063 -
2064 *this = newLayout; -
2065}
executed: }
Execution Count:176933
176933
2066 -
2067void QTextEngine::freeMemory() -
2068{ -
2069 if (!stackEngine) {
evaluated: !stackEngine
TRUEFALSE
yes
Evaluation Count:354410
yes
Evaluation Count:35389
35389-354410
2070 delete layoutData; -
2071 layoutData = 0; -
2072 } else {
executed: }
Execution Count:354410
354410
2073 layoutData->used = 0; -
2074 layoutData->hasBidi = false; -
2075 layoutData->layoutState = LayoutEmpty; -
2076 layoutData->haveCharAttributes = false; -
2077 }
executed: }
Execution Count:35389
35389
2078 for (int i = 0; i < lines.size(); ++i) {
evaluated: i < lines.size()
TRUEFALSE
yes
Evaluation Count:219176
yes
Evaluation Count:389799
219176-389799
2079 lines[i].justified = 0; -
2080 lines[i].gridfitted = 0; -
2081 }
executed: }
Execution Count:219176
219176
2082}
executed: }
Execution Count:389799
389799
2083 -
2084int QTextEngine::formatIndex(const QScriptItem *si) const -
2085{ -
2086 if (specialData && !specialData->resolvedFormatIndices.isEmpty())
evaluated: specialData
TRUEFALSE
yes
Evaluation Count:11
yes
Evaluation Count:11329
partially evaluated: !specialData->resolvedFormatIndices.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:11
0-11329
2087 return specialData->resolvedFormatIndices.at(si - &layoutData->items[0]);
never executed: return specialData->resolvedFormatIndices.at(si - &layoutData->items[0]);
0
2088 QTextDocumentPrivate *p = block.docHandle(); -
2089 if (!p)
partially evaluated: !p
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:11340
0-11340
2090 return -1;
never executed: return -1;
0
2091 int pos = si->position; -
2092 if (specialData && si->position >= specialData->preeditPosition) {
evaluated: specialData
TRUEFALSE
yes
Evaluation Count:11
yes
Evaluation Count:11329
evaluated: si->position >= specialData->preeditPosition
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:5
5-11329
2093 if (si->position < specialData->preeditPosition + specialData->preeditText.length())
partially evaluated: si->position < specialData->preeditPosition + specialData->preeditText.length()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:6
0-6
2094 pos = qMax(qMin(block.length(), specialData->preeditPosition) - 1, 0);
never executed: pos = qMax(qMin(block.length(), specialData->preeditPosition) - 1, 0);
0
2095 else -
2096 pos -= specialData->preeditText.length();
executed: pos -= specialData->preeditText.length();
Execution Count:6
6
2097 } -
2098 QTextDocumentPrivate::FragmentIterator it = p->find(block.position() + pos); -
2099 return it.value()->format;
executed: return it.value()->format;
Execution Count:11340
11340
2100} -
2101 -
2102 -
2103QTextCharFormat QTextEngine::format(const QScriptItem *si) const -
2104{ -
2105 QTextCharFormat format; -
2106 const QTextFormatCollection *formats = this->formats(); -
2107 -
2108 if (formats)
evaluated: formats
TRUEFALSE
yes
Evaluation Count:11310
yes
Evaluation Count:54
54-11310
2109 format = formats->charFormat(formatIndex(si));
executed: format = formats->charFormat(formatIndex(si));
Execution Count:11310
11310
2110 -
2111 if (specialData && specialData->resolvedFormatIndices.isEmpty()) {
evaluated: specialData
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:11356
partially evaluated: specialData->resolvedFormatIndices.isEmpty()
TRUEFALSE
yes
Evaluation Count:8
no
Evaluation Count:0
0-11356
2112 int end = si->position + length(si); -
2113 for (int i = 0; i < specialData->addFormats.size(); ++i) {
partially evaluated: i < specialData->addFormats.size()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8
0-8
2114 const QTextLayout::FormatRange &r = specialData->addFormats.at(i); -
2115 if (r.start <= si->position && r.start + r.length >= end) {
never evaluated: r.start <= si->position
never evaluated: r.start + r.length >= end
0
2116 if (!specialData->addFormatIndices.isEmpty())
never evaluated: !specialData->addFormatIndices.isEmpty()
0
2117 format.merge(formats->format(specialData->addFormatIndices.at(i)));
never executed: format.merge(formats->format(specialData->addFormatIndices.at(i)));
0
2118 else -
2119 format.merge(r.format);
never executed: format.merge(r.format);
0
2120 } -
2121 }
never executed: }
0
2122 }
executed: }
Execution Count:8
8
2123 return format;
executed: return format;
Execution Count:11364
11364
2124} -
2125 -
2126void QTextEngine::addRequiredBoundaries() const -
2127{ -
2128 if (specialData) {
evaluated: specialData
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:226647
5-226647
2129 for (int i = 0; i < specialData->addFormats.size(); ++i) {
evaluated: i < specialData->addFormats.size()
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:5
3-5
2130 const QTextLayout::FormatRange &r = specialData->addFormats.at(i); -
2131 setBoundary(r.start); -
2132 setBoundary(r.start + r.length); -
2133 -
2134 }
executed: }
Execution Count:3
3
2135 }
executed: }
Execution Count:5
5
2136}
executed: }
Execution Count:226652
226652
2137 -
2138bool QTextEngine::atWordSeparator(int position) const -
2139{ -
2140 const QChar c = layoutData->string.at(position); -
2141 switch (c.unicode()) { -
2142 case '.': -
2143 case ',': -
2144 case '?': -
2145 case '!': -
2146 case '@': -
2147 case '#': -
2148 case '$': -
2149 case ':': -
2150 case ';': -
2151 case '-': -
2152 case '<': -
2153 case '>': -
2154 case '[': -
2155 case ']': -
2156 case '(': -
2157 case ')': -
2158 case '{': -
2159 case '}': -
2160 case '=': -
2161 case '/': -
2162 case '+': -
2163 case '%': -
2164 case '&': -
2165 case '^': -
2166 case '*': -
2167 case '\'': -
2168 case '"': -
2169 case '`': -
2170 case '~': -
2171 case '|': -
2172 return true;
executed: return true;
Execution Count:28
28
2173 default: -
2174 break;
executed: break;
Execution Count:409
409
2175 } -
2176 return false;
executed: return false;
Execution Count:409
409
2177} -
2178 -
2179bool QTextEngine::atSpace(int position) const -
2180{ -
2181 const QChar c = layoutData->string.at(position); -
2182 switch (c.unicode()) { -
2183 case QChar::Tabulation: -
2184 case QChar::Space: -
2185 case QChar::Nbsp: -
2186 case QChar::LineSeparator: -
2187 return true;
executed: return true;
Execution Count:97
97
2188 default: -
2189 break;
executed: break;
Execution Count:389
389
2190 } -
2191 return false;
executed: return false;
Execution Count:389
389
2192} -
2193 -
2194 -
2195void QTextEngine::indexAdditionalFormats() -
2196{ -
2197 specialData->addFormatIndices.resize(specialData->addFormats.count()); -
2198 -
2199 QTextFormatCollection *formats = this->formats(); -
2200 -
2201 if (!formats) {
partially evaluated: !formats
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:7
0-7
2202 qt_noop(); -
2203 specialData->formats.reset(new QTextFormatCollection); -
2204 formats = specialData->formats.data(); -
2205 }
never executed: }
0
2206 -
2207 for (int i = 0; i < specialData->addFormats.count(); ++i) {
evaluated: i < specialData->addFormats.count()
TRUEFALSE
yes
Evaluation Count:12
yes
Evaluation Count:7
7-12
2208 specialData->addFormatIndices[i] = formats->indexForFormat(specialData->addFormats.at(i).format); -
2209 specialData->addFormats[i].format = QTextCharFormat(); -
2210 }
executed: }
Execution Count:12
12
2211}
executed: }
Execution Count:7
7
2212 -
2213 -
2214 -
2215 -
2216 -
2217static inline bool nextCharJoins(const QString &string, int pos) -
2218{ -
2219 while (pos < string.length() && string.at(pos).category() == QChar::Mark_NonSpacing)
partially evaluated: pos < string.length()
TRUEFALSE
yes
Evaluation Count:1171
no
Evaluation Count:0
partially evaluated: string.at(pos).category() == QChar::Mark_NonSpacing
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1171
0-1171
2220 ++pos;
never executed: ++pos;
0
2221 if (pos == string.length())
partially evaluated: pos == string.length()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1171
0-1171
2222 return false;
never executed: return false;
0
2223 return string.at(pos).joining() != QChar::OtherJoining;
executed: return string.at(pos).joining() != QChar::OtherJoining;
Execution Count:1171
1171
2224} -
2225 -
2226static inline bool prevCharJoins(const QString &string, int pos) -
2227{ -
2228 while (pos > 0 && string.at(pos - 1).category() == QChar::Mark_NonSpacing)
partially evaluated: pos > 0
TRUEFALSE
yes
Evaluation Count:135
no
Evaluation Count:0
partially evaluated: string.at(pos - 1).category() == QChar::Mark_NonSpacing
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:135
0-135
2229 --pos;
never executed: --pos;
0
2230 if (pos == 0)
partially evaluated: pos == 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:135
0-135
2231 return false;
never executed: return false;
0
2232 QChar::Joining joining = string.at(pos - 1).joining(); -
2233 return (joining == QChar::Dual || joining == QChar::Center);
executed: return (joining == QChar::Dual || joining == QChar::Center);
Execution Count:135
135
2234} -
2235 -
2236static inline bool isRetainableControlCode(QChar c) -
2237{ -
2238 return (c.unicode() == 0x202a 14350
2239 || c.unicode() == 0x202b 14350
2240 || c.unicode() == 0x202c 14350
2241 || c.unicode() == 0x202d 14350
2242 || c.unicode() == 0x202e 14350
2243 || c.unicode() == 0x200e 14350
2244 || c.unicode() == 0x200f);
executed: return (c.unicode() == 0x202a || c.unicode() == 0x202b || c.unicode() == 0x202c || c.unicode() == 0x202d || c.unicode() == 0x202e || c.unicode() == 0x200e || c.unicode() == 0x200f);
Execution Count:14350
14350
2245} -
2246 -
2247static QString stringMidRetainingBidiCC(const QString &string, -
2248 const QString &ellidePrefix, -
2249 const QString &ellideSuffix, -
2250 int subStringFrom, -
2251 int subStringTo, -
2252 int midStart, -
2253 int midLength) -
2254{ -
2255 QString prefix; -
2256 for (int i=subStringFrom; i<midStart; ++i) {
partially evaluated: i<midStart
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1036
0-1036
2257 QChar c = string.at(i); -
2258 if (isRetainableControlCode(c))
never evaluated: isRetainableControlCode(c)
0
2259 prefix += c;
never executed: prefix += c;
0
2260 }
never executed: }
0
2261 -
2262 QString suffix; -
2263 for (int i=midStart + midLength; i<subStringTo; ++i) {
evaluated: i<subStringTo
TRUEFALSE
yes
Evaluation Count:14350
yes
Evaluation Count:1036
1036-14350
2264 QChar c = string.at(i); -
2265 if (isRetainableControlCode(c))
partially evaluated: isRetainableControlCode(c)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:14350
0-14350
2266 suffix += c;
never executed: suffix += c;
0
2267 }
executed: }
Execution Count:14350
14350
2268 -
2269 return prefix + ellidePrefix + string.mid(midStart, midLength) + ellideSuffix + suffix;
executed: return prefix + ellidePrefix + string.mid(midStart, midLength) + ellideSuffix + suffix;
Execution Count:1036
1036
2270} -
2271 -
2272QString QTextEngine::elidedText(Qt::TextElideMode mode, const QFixed &width, int flags, int from, int count) const -
2273{ -
2274 -
2275 -
2276 if (flags & Qt::TextShowMnemonic) {
evaluated: flags & Qt::TextShowMnemonic
TRUEFALSE
yes
Evaluation Count:686
yes
Evaluation Count:3583
686-3583
2277 itemize(); -
2278 QCharAttributes *attributes = const_cast<QCharAttributes *>(this->attributes()); -
2279 if (!attributes)
partially evaluated: !attributes
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:686
0-686
2280 return QString();
never executed: return QString();
0
2281 for (int i = 0; i < layoutData->items.size(); ++i) {
evaluated: i < layoutData->items.size()
TRUEFALSE
yes
Evaluation Count:630
yes
Evaluation Count:686
630-686
2282 QScriptItem &si = layoutData->items[i]; -
2283 if (!si.num_glyphs)
partially evaluated: !si.num_glyphs
TRUEFALSE
yes
Evaluation Count:630
no
Evaluation Count:0
0-630
2284 shape(i);
executed: shape(i);
Execution Count:630
630
2285 -
2286 unsigned short *logClusters = this->logClusters(&si); -
2287 QGlyphLayout glyphs = shapedGlyphs(&si); -
2288 -
2289 const int end = si.position + length(&si); -
2290 for (int i = si.position; i < end - 1; ++i) {
evaluated: i < end - 1
TRUEFALSE
yes
Evaluation Count:2212
yes
Evaluation Count:630
630-2212
2291 if (layoutData->string.at(i) == QLatin1Char('&')) {
partially evaluated: layoutData->string.at(i) == QLatin1Char('&')
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2212
0-2212
2292 const int gp = logClusters[i - si.position]; -
2293 glyphs.attributes[gp].dontPrint = true; -
2294 attributes[i + 1].graphemeBoundary = false; -
2295 attributes[i + 1].lineBreak = false; -
2296 attributes[i + 1].whiteSpace = false; -
2297 if (layoutData->string.at(i + 1) == QLatin1Char('&'))
never evaluated: layoutData->string.at(i + 1) == QLatin1Char('&')
0
2298 ++i;
never executed: ++i;
0
2299 }
never executed: }
0
2300 }
executed: }
Execution Count:2212
2212
2301 }
executed: }
Execution Count:630
630
2302 }
executed: }
Execution Count:686
686
2303 -
2304 validate(); -
2305 -
2306 const int to = count >= 0 && count <= layoutData->string.length() - from
partially evaluated: count >= 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4269
never evaluated: count <= layoutData->string.length() - from
0-4269
2307 ? from + count -
2308 : layoutData->string.length(); -
2309 -
2310 if (mode == Qt::ElideNone
evaluated: mode == Qt::ElideNone
TRUEFALSE
yes
Evaluation Count:616
yes
Evaluation Count:3653
616-3653
2311 || this->width(from, layoutData->string.length()) <= width
evaluated: this->width(from, layoutData->string.length()) <= width
TRUEFALSE
yes
Evaluation Count:2260
yes
Evaluation Count:1393
1393-2260
2312 || to - from <= 1)
evaluated: to - from <= 1
TRUEFALSE
yes
Evaluation Count:217
yes
Evaluation Count:1176
217-1176
2313 return layoutData->string.mid(from, from - to);
executed: return layoutData->string.mid(from, from - to);
Execution Count:3093
3093
2314 -
2315 QFixed ellipsisWidth; -
2316 QString ellipsisText; -
2317 { -
2318 QChar ellipsisChar(0x2026); -
2319 -
2320 QFontEngine *fe = fnt.d->engineForScript(QUnicodeTables::Common); -
2321 -
2322 QGlyphLayoutArray<1> ellipsisGlyph; -
2323 { -
2324 QFontEngine *feForEllipsis = (fe->type() == QFontEngine::Multi)
partially evaluated: (fe->type() == QFontEngine::Multi)
TRUEFALSE
yes
Evaluation Count:1176
no
Evaluation Count:0
0-1176
2325 ? static_cast<QFontEngineMulti *>(fe)->engine(0) -
2326 : fe; -
2327 -
2328 if (feForEllipsis->type() == QFontEngine::Mac)
partially evaluated: feForEllipsis->type() == QFontEngine::Mac
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1176
0-1176
2329 feForEllipsis = fe;
never executed: feForEllipsis = fe;
0
2330 -
2331 if (feForEllipsis->canRender(&ellipsisChar, 1)) {
partially evaluated: feForEllipsis->canRender(&ellipsisChar, 1)
TRUEFALSE
yes
Evaluation Count:1176
no
Evaluation Count:0
0-1176
2332 int nGlyphs = 1; -
2333 feForEllipsis->stringToCMap(&ellipsisChar, 1, &ellipsisGlyph, &nGlyphs, 0); -
2334 }
executed: }
Execution Count:1176
1176
2335 } -
2336 -
2337 if (ellipsisGlyph.glyphs[0]) {
partially evaluated: ellipsisGlyph.glyphs[0]
TRUEFALSE
yes
Evaluation Count:1176
no
Evaluation Count:0
0-1176
2338 ellipsisWidth = ellipsisGlyph.advances_x[0]; -
2339 ellipsisText = ellipsisChar; -
2340 } else {
executed: }
Execution Count:1176
1176
2341 QString dotDotDot(QLatin1String("...")); -
2342 -
2343 QGlyphLayoutArray<3> glyphs; -
2344 int nGlyphs = 3; -
2345 if (!fe->stringToCMap(dotDotDot.constData(), 3, &glyphs, &nGlyphs, 0))
never evaluated: !fe->stringToCMap(dotDotDot.constData(), 3, &glyphs, &nGlyphs, 0)
0
2346 -
2347 return layoutData->string;
never executed: return layoutData->string;
0
2348 for (int i = 0; i < nGlyphs; ++i)
never evaluated: i < nGlyphs
0
2349 ellipsisWidth += glyphs.advances_x[i];
never executed: ellipsisWidth += glyphs.advances_x[i];
0
2350 ellipsisText = dotDotDot; -
2351 }
never executed: }
0
2352 } -
2353 -
2354 const QFixed availableWidth = width - ellipsisWidth; -
2355 if (availableWidth < 0)
evaluated: availableWidth < 0
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:1171
5-1171
2356 return QString();
executed: return QString();
Execution Count:5
5
2357 -
2358 const QCharAttributes *attributes = this->attributes(); -
2359 if (!attributes)
partially evaluated: !attributes
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1171
0-1171
2360 return QString();
never executed: return QString();
0
2361 -
2362 if (mode == Qt::ElideRight) {
evaluated: mode == Qt::ElideRight
TRUEFALSE
yes
Evaluation Count:1036
yes
Evaluation Count:135
135-1036
2363 QFixed currentWidth; -
2364 int pos; -
2365 int nextBreak = from; -
2366 -
2367 do { -
2368 pos = nextBreak; -
2369 -
2370 ++nextBreak; -
2371 while (nextBreak < layoutData->string.length() && !attributes[nextBreak].graphemeBoundary)
partially evaluated: nextBreak < layoutData->string.length()
TRUEFALSE
yes
Evaluation Count:9622
no
Evaluation Count:0
partially evaluated: !attributes[nextBreak].graphemeBoundary
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:9622
0-9622
2372 ++nextBreak;
never executed: ++nextBreak;
0
2373 -
2374 currentWidth += this->width(pos, nextBreak - pos); -
2375 } while (nextBreak < to
partially evaluated: nextBreak < to
TRUEFALSE
yes
Evaluation Count:9622
no
Evaluation Count:0
executed: }
Execution Count:9622
0-9622
2376 && currentWidth < availableWidth);
evaluated: currentWidth < availableWidth
TRUEFALSE
yes
Evaluation Count:8586
yes
Evaluation Count:1036
1036-8586
2377 -
2378 if (nextCharJoins(layoutData->string, pos))
partially evaluated: nextCharJoins(layoutData->string, pos)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1036
0-1036
2379 ellipsisText.prepend(QChar(0x200d) );
never executed: ellipsisText.prepend(QChar(0x200d) );
0
2380 -
2381 return stringMidRetainingBidiCC(layoutData->string, 1036
2382 QString(), ellipsisText, 1036
2383 from, to, 1036
2384 from, pos - from);
executed: return stringMidRetainingBidiCC(layoutData->string, QString(), ellipsisText, from, to, from, pos - from);
Execution Count:1036
1036
2385 } else if (mode == Qt::ElideLeft) {
partially evaluated: mode == Qt::ElideLeft
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:135
0-135
2386 QFixed currentWidth; -
2387 int pos; -
2388 int nextBreak = to; -
2389 -
2390 do { -
2391 pos = nextBreak; -
2392 -
2393 --nextBreak; -
2394 while (nextBreak > 0 && !attributes[nextBreak].graphemeBoundary)
never evaluated: nextBreak > 0
never evaluated: !attributes[nextBreak].graphemeBoundary
0
2395 --nextBreak;
never executed: --nextBreak;
0
2396 -
2397 currentWidth += this->width(nextBreak, pos - nextBreak); -
2398 } while (nextBreak > from
never evaluated: nextBreak > from
never executed: }
0
2399 && currentWidth < availableWidth);
never evaluated: currentWidth < availableWidth
0
2400 -
2401 if (prevCharJoins(layoutData->string, pos))
never evaluated: prevCharJoins(layoutData->string, pos)
0
2402 ellipsisText.append(QChar(0x200d) );
never executed: ellipsisText.append(QChar(0x200d) );
0
2403 -
2404 return stringMidRetainingBidiCC(layoutData->string, 0
2405 ellipsisText, QString(), 0
2406 from, to, 0
2407 pos, to - pos);
never executed: return stringMidRetainingBidiCC(layoutData->string, ellipsisText, QString(), from, to, pos, to - pos);
0
2408 } else if (mode == Qt::ElideMiddle) {
partially evaluated: mode == Qt::ElideMiddle
TRUEFALSE
yes
Evaluation Count:135
no
Evaluation Count:0
0-135
2409 QFixed leftWidth; -
2410 QFixed rightWidth; -
2411 -
2412 int leftPos = from; -
2413 int nextLeftBreak = from; -
2414 -
2415 int rightPos = to; -
2416 int nextRightBreak = to; -
2417 -
2418 do { -
2419 leftPos = nextLeftBreak; -
2420 rightPos = nextRightBreak; -
2421 -
2422 ++nextLeftBreak; -
2423 while (nextLeftBreak < layoutData->string.length() && !attributes[nextLeftBreak].graphemeBoundary)
partially evaluated: nextLeftBreak < layoutData->string.length()
TRUEFALSE
yes
Evaluation Count:1384
no
Evaluation Count:0
partially evaluated: !attributes[nextLeftBreak].graphemeBoundary
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1384
0-1384
2424 ++nextLeftBreak;
never executed: ++nextLeftBreak;
0
2425 -
2426 --nextRightBreak; -
2427 while (nextRightBreak > from && !attributes[nextRightBreak].graphemeBoundary)
partially evaluated: nextRightBreak > from
TRUEFALSE
yes
Evaluation Count:1384
no
Evaluation Count:0
partially evaluated: !attributes[nextRightBreak].graphemeBoundary
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1384
0-1384
2428 --nextRightBreak;
never executed: --nextRightBreak;
0
2429 -
2430 leftWidth += this->width(leftPos, nextLeftBreak - leftPos); -
2431 rightWidth += this->width(nextRightBreak, rightPos - nextRightBreak); -
2432 } while (nextLeftBreak < to
partially evaluated: nextLeftBreak < to
TRUEFALSE
yes
Evaluation Count:1384
no
Evaluation Count:0
executed: }
Execution Count:1384
0-1384
2433 && nextRightBreak > from
partially evaluated: nextRightBreak > from
TRUEFALSE
yes
Evaluation Count:1384
no
Evaluation Count:0
0-1384
2434 && leftWidth + rightWidth < availableWidth);
evaluated: leftWidth + rightWidth < availableWidth
TRUEFALSE
yes
Evaluation Count:1249
yes
Evaluation Count:135
135-1249
2435 -
2436 if (nextCharJoins(layoutData->string, leftPos))
partially evaluated: nextCharJoins(layoutData->string, leftPos)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:135
0-135
2437 ellipsisText.prepend(QChar(0x200d) );
never executed: ellipsisText.prepend(QChar(0x200d) );
0
2438 if (prevCharJoins(layoutData->string, rightPos))
partially evaluated: prevCharJoins(layoutData->string, rightPos)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:135
0-135
2439 ellipsisText.append(QChar(0x200d) );
never executed: ellipsisText.append(QChar(0x200d) );
0
2440 -
2441 return layoutData->string.mid(from, leftPos - from) + ellipsisText + layoutData->string.mid(rightPos, to - rightPos);
executed: return layoutData->string.mid(from, leftPos - from) + ellipsisText + layoutData->string.mid(rightPos, to - rightPos);
Execution Count:135
135
2442 } -
2443 -
2444 return layoutData->string.mid(from, to - from);
never executed: return layoutData->string.mid(from, to - from);
0
2445} -
2446 -
2447namespace { -
2448struct QScriptItemComparator { -
2449 bool operator()(const QScriptItem &a, const QScriptItem &b) { return a.position < b.position; }
never executed: return a.position < b.position;
0
2450 bool operator()(int p, const QScriptItem &b) { return p < b.position; }
executed: return p < b.position;
Execution Count:5
5
2451 -
2452 -
2453 -
2454 -
2455}; -
2456} -
2457 -
2458void QTextEngine::setBoundary(int strPos) const -
2459{ -
2460 if (strPos <= 0 || strPos >= layoutData->string.length())
evaluated: strPos <= 0
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:4
partially evaluated: strPos >= layoutData->string.length()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
0-4
2461 return;
executed: return;
Execution Count:2
2
2462 -
2463 const QScriptItem* it = std::upper_bound(layoutData->items.constBegin(), layoutData->items.constEnd(), -
2464 strPos, QScriptItemComparator()); -
2465 qt_noop(); -
2466 --it; -
2467 if (it->position == strPos) {
partially evaluated: it->position == strPos
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
0-4
2468 -
2469 return;
never executed: return;
0
2470 } -
2471 splitItem(it - layoutData->items.constBegin(), strPos - it->position); -
2472}
executed: }
Execution Count:4
4
2473 -
2474void QTextEngine::splitItem(int item, int pos) const -
2475{ -
2476 if (pos <= 0)
partially evaluated: pos <= 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
0-4
2477 return;
never executed: return;
0
2478 -
2479 layoutData->items.insert(item + 1, layoutData->items[item]); -
2480 QScriptItem &oldItem = layoutData->items[item]; -
2481 QScriptItem &newItem = layoutData->items[item+1]; -
2482 newItem.position += pos; -
2483 -
2484 if (oldItem.num_glyphs) {
partially evaluated: oldItem.num_glyphs
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
0-4
2485 -
2486 int breakGlyph = logClusters(&oldItem)[pos]; -
2487 -
2488 newItem.num_glyphs = oldItem.num_glyphs - breakGlyph; -
2489 oldItem.num_glyphs = breakGlyph; -
2490 newItem.glyph_data_offset = oldItem.glyph_data_offset + breakGlyph; -
2491 -
2492 for (int i = 0; i < newItem.num_glyphs; i++)
never evaluated: i < newItem.num_glyphs
0
2493 logClusters(&newItem)[i] -= breakGlyph;
never executed: logClusters(&newItem)[i] -= breakGlyph;
0
2494 -
2495 QFixed w = 0; -
2496 const QGlyphLayout g = shapedGlyphs(&oldItem); -
2497 for(int j = 0; j < breakGlyph; ++j)
never evaluated: j < breakGlyph
0
2498 w += g.advances_x[j] * !g.attributes[j].dontPrint;
never executed: w += g.advances_x[j] * !g.attributes[j].dontPrint;
0
2499 -
2500 newItem.width = oldItem.width - w; -
2501 oldItem.width = w; -
2502 }
never executed: }
0
2503 -
2504 -
2505}
executed: }
Execution Count:4
4
2506 -
2507QFixed QTextEngine::calculateTabWidth(int item, QFixed x) const -
2508{ -
2509 const QScriptItem &si = layoutData->items[item]; -
2510 -
2511 QFixed dpiScale = 1; -
2512 if (block.docHandle() && block.docHandle()->layout()) {
partially evaluated: block.docHandle()
TRUEFALSE
yes
Evaluation Count:17
no
Evaluation Count:0
partially evaluated: block.docHandle()->layout()
TRUEFALSE
yes
Evaluation Count:17
no
Evaluation Count:0
0-17
2513 QPaintDevice *pdev = block.docHandle()->layout()->paintDevice(); -
2514 if (pdev)
evaluated: pdev
TRUEFALSE
yes
Evaluation Count:14
yes
Evaluation Count:3
3-14
2515 dpiScale = QFixed::fromReal(pdev->logicalDpiY() / qreal(qt_defaultDpiY()));
executed: dpiScale = QFixed::fromReal(pdev->logicalDpiY() / qreal(qt_defaultDpiY()));
Execution Count:14
14
2516 } else {
executed: }
Execution Count:17
17
2517 dpiScale = QFixed::fromReal(fnt.d->dpi / qreal(qt_defaultDpiY())); -
2518 }
never executed: }
0
2519 -
2520 QList<QTextOption::Tab> tabArray = option.tabs(); -
2521 if (!tabArray.isEmpty()) {
evaluated: !tabArray.isEmpty()
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:14
3-14
2522 if (isRightToLeft()) {
partially evaluated: isRightToLeft()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3
0-3
2523 QList<QTextOption::Tab> newTabs; -
2524 QList<QTextOption::Tab>::Iterator iter = tabArray.begin(); -
2525 while(iter != tabArray.end()) {
never evaluated: iter != tabArray.end()
0
2526 QTextOption::Tab tab = *iter; -
2527 if (tab.type == QTextOption::LeftTab)
never evaluated: tab.type == QTextOption::LeftTab
0
2528 tab.type = QTextOption::RightTab;
never executed: tab.type = QTextOption::RightTab;
0
2529 else if (tab.type == QTextOption::RightTab)
never evaluated: tab.type == QTextOption::RightTab
0
2530 tab.type = QTextOption::LeftTab;
never executed: tab.type = QTextOption::LeftTab;
0
2531 newTabs << tab; -
2532 ++iter; -
2533 }
never executed: }
0
2534 tabArray = newTabs; -
2535 }
never executed: }
0
2536 for (int i = 0; i < tabArray.size(); ++i) {
partially evaluated: i < tabArray.size()
TRUEFALSE
yes
Evaluation Count:3
no
Evaluation Count:0
0-3
2537 QFixed tab = QFixed::fromReal(tabArray[i].position) * dpiScale; -
2538 if (tab > x) {
partially evaluated: tab > x
TRUEFALSE
yes
Evaluation Count:3
no
Evaluation Count:0
0-3
2539 QTextOption::Tab tabSpec = tabArray[i]; -
2540 int tabSectionEnd = layoutData->string.count(); -
2541 if (tabSpec.type == QTextOption::RightTab || tabSpec.type == QTextOption::CenterTab) {
partially evaluated: tabSpec.type == QTextOption::RightTab
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3
partially evaluated: tabSpec.type == QTextOption::CenterTab
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3
0-3
2542 -
2543 tab = QFixed::fromReal(tabSpec.position); -
2544 for (int i=item + 1; i < layoutData->items.count(); i++) {
never evaluated: i < layoutData->items.count()
0
2545 const QScriptItem &item = layoutData->items[i]; -
2546 if (item.analysis.flags == QScriptAnalysis::TabOrObject) {
never evaluated: item.analysis.flags == QScriptAnalysis::TabOrObject
0
2547 tabSectionEnd = item.position; -
2548 break;
never executed: break;
0
2549 } -
2550 }
never executed: }
0
2551 }
never executed: }
0
2552 else if (tabSpec.type == QTextOption::DelimiterTab)
partially evaluated: tabSpec.type == QTextOption::DelimiterTab
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3
0-3
2553 -
2554 tabSectionEnd = qMax(si.position, layoutData->string.indexOf(tabSpec.delimiter, si.position) + 1);
never executed: tabSectionEnd = qMax(si.position, layoutData->string.indexOf(tabSpec.delimiter, si.position) + 1);
0
2555 -
2556 if (tabSectionEnd > si.position) {
partially evaluated: tabSectionEnd > si.position
TRUEFALSE
yes
Evaluation Count:3
no
Evaluation Count:0
0-3
2557 QFixed length; -
2558 -
2559 for (int i=item; i < layoutData->items.count(); i++) {
evaluated: i < layoutData->items.count()
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:3
3-6
2560 QScriptItem &item = layoutData->items[i]; -
2561 if (item.position > tabSectionEnd || item.position <= si.position)
partially evaluated: item.position > tabSectionEnd
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:6
evaluated: item.position <= si.position
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:3
0-6
2562 continue;
executed: continue;
Execution Count:3
3
2563 shape(i); -
2564 QGlyphLayout glyphs = this->shapedGlyphs(&item); -
2565 const int end = qMin(item.position + item.num_glyphs, tabSectionEnd) - item.position; -
2566 for (int i=0; i < end; i++)
evaluated: i < end
TRUEFALSE
yes
Evaluation Count:9
yes
Evaluation Count:3
3-9
2567 length += glyphs.advances_x[i] * !glyphs.attributes[i].dontPrint;
executed: length += glyphs.advances_x[i] * !glyphs.attributes[i].dontPrint;
Execution Count:9
9
2568 if (end + item.position == tabSectionEnd && tabSpec.type == QTextOption::DelimiterTab)
partially evaluated: end + item.position == tabSectionEnd
TRUEFALSE
yes
Evaluation Count:3
no
Evaluation Count:0
partially evaluated: tabSpec.type == QTextOption::DelimiterTab
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3
0-3
2569 length -= glyphs.advances_x[end] / 2 * !glyphs.attributes[end].dontPrint;
never executed: length -= glyphs.advances_x[end] / 2 * !glyphs.attributes[end].dontPrint;
0
2570 }
executed: }
Execution Count:3
3
2571 -
2572 switch (tabSpec.type) { -
2573 case QTextOption::CenterTab: -
2574 length /= 2; -
2575 -
2576 case QTextOption::DelimiterTab:
code before this statement never executed: case QTextOption::DelimiterTab:
0
2577 -
2578 case QTextOption::RightTab: -
2579 tab = QFixed::fromReal(tabSpec.position) * dpiScale - length; -
2580 if (tab < x)
never evaluated: tab < x
0
2581 return QFixed();
never executed: return QFixed();
0
2582 break;
never executed: break;
0
2583 case QTextOption::LeftTab: -
2584 break;
executed: break;
Execution Count:3
3
2585 } -
2586 }
executed: }
Execution Count:3
3
2587 return tab - x;
executed: return tab - x;
Execution Count:3
3
2588 } -
2589 }
never executed: }
0
2590 }
never executed: }
0
2591 QFixed tab = QFixed::fromReal(option.tabStop()); -
2592 if (tab <= 0)
partially evaluated: tab <= 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:14
0-14
2593 tab = 80;
never executed: tab = 80;
0
2594 tab *= dpiScale; -
2595 QFixed nextTabPos = ((x / tab).truncate() + 1) * tab; -
2596 QFixed tabWidth = nextTabPos - x; -
2597 -
2598 return tabWidth;
executed: return tabWidth;
Execution Count:14
14
2599} -
2600 -
2601namespace { -
2602class FormatRangeComparatorByStart { -
2603 const QList<QTextLayout::FormatRange> &list; -
2604public: -
2605 FormatRangeComparatorByStart(const QList<QTextLayout::FormatRange> &list) : list(list) { }
executed: }
Execution Count:2
2
2606 bool operator()(int a, int b) { -
2607 return list.at(a).start < list.at(b).start;
executed: return list.at(a).start < list.at(b).start;
Execution Count:1
1
2608 } -
2609}; -
2610class FormatRangeComparatorByEnd { -
2611 const QList<QTextLayout::FormatRange> &list; -
2612public: -
2613 FormatRangeComparatorByEnd(const QList<QTextLayout::FormatRange> &list) : list(list) { }
executed: }
Execution Count:2
2
2614 bool operator()(int a, int b) { -
2615 return list.at(a).start + list.at(a).length < list.at(b).start + list.at(b).length;
executed: return list.at(a).start + list.at(a).length < list.at(b).start + list.at(b).length;
Execution Count:1
1
2616 } -
2617}; -
2618} -
2619 -
2620void QTextEngine::resolveAdditionalFormats() const -
2621{ -
2622 if (!specialData || specialData->addFormats.isEmpty()
evaluated: !specialData
TRUEFALSE
yes
Evaluation Count:226647
yes
Evaluation Count:5
evaluated: specialData->addFormats.isEmpty()
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:2
2-226647
2623 || !specialData->resolvedFormatIndices.isEmpty())
partially evaluated: !specialData->resolvedFormatIndices.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
2624 return;
executed: return;
Execution Count:226650
226650
2625 -
2626 QTextFormatCollection *collection = formats(); -
2627 -
2628 specialData->resolvedFormatIndices.clear(); -
2629 QVector<int> indices(layoutData->items.count()); -
2630 -
2631 -
2632 QVarLengthArray<int, 64> addFormatSortedByStart; -
2633 addFormatSortedByStart.reserve(specialData->addFormats.count()); -
2634 for (int i = 0; i < specialData->addFormats.count(); ++i) {
evaluated: i < specialData->addFormats.count()
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:2
2-3
2635 if (specialData->addFormats.at(i).length >= 0)
partially evaluated: specialData->addFormats.at(i).length >= 0
TRUEFALSE
yes
Evaluation Count:3
no
Evaluation Count:0
0-3
2636 addFormatSortedByStart.append(i);
executed: addFormatSortedByStart.append(i);
Execution Count:3
3
2637 }
executed: }
Execution Count:3
3
2638 QVarLengthArray<int, 64> addFormatSortedByEnd = addFormatSortedByStart; -
2639 qSort(addFormatSortedByStart.begin(), addFormatSortedByStart.end(), -
2640 FormatRangeComparatorByStart(specialData->addFormats)); -
2641 qSort(addFormatSortedByEnd.begin(), addFormatSortedByEnd.end(), -
2642 FormatRangeComparatorByEnd(specialData->addFormats)); -
2643 -
2644 QVarLengthArray<int, 16> currentFormats; -
2645 const int *startIt = addFormatSortedByStart.constBegin(); -
2646 const int *endIt = addFormatSortedByEnd.constBegin(); -
2647 -
2648 for (int i = 0; i < layoutData->items.count(); ++i) {
evaluated: i < layoutData->items.count()
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:2
2-6
2649 const QScriptItem *si = &layoutData->items.at(i); -
2650 int end = si->position + length(si); -
2651 -
2652 while (startIt != addFormatSortedByStart.constEnd() &&
evaluated: startIt != addFormatSortedByStart.constEnd()
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:4
4-5
2653 specialData->addFormats.at(*startIt).start <= si->position) {
evaluated: specialData->addFormats.at(*startIt).start <= si->position
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:2
2-3
2654 currentFormats.insert(std::upper_bound(currentFormats.begin(), currentFormats.end(), *startIt), -
2655 *startIt); -
2656 ++startIt; -
2657 }
executed: }
Execution Count:3
3
2658 while (endIt != addFormatSortedByEnd.constEnd() &&
evaluated: endIt != addFormatSortedByEnd.constEnd()
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:2
2-7
2659 specialData->addFormats.at(*endIt).start + specialData->addFormats.at(*endIt).length < end) {
evaluated: specialData->addFormats.at(*endIt).start + specialData->addFormats.at(*endIt).length < end
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:4
3-4
2660 currentFormats.remove(qBinaryFind(currentFormats, *endIt) - currentFormats.begin()); -
2661 ++endIt; -
2662 }
executed: }
Execution Count:3
3
2663 QTextCharFormat format; -
2664 if (block.docHandle()) {
partially evaluated: block.docHandle()
TRUEFALSE
yes
Evaluation Count:6
no
Evaluation Count:0
0-6
2665 -
2666 -
2667 format = collection->charFormat(formatIndex(si)); -
2668 }
executed: }
Execution Count:6
6
2669 -
2670 for (QForeachContainer<__typeof__(currentFormats)> _container_(currentFormats); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (int cur = *_container_.i;; __extension__ ({--_container_.brk; break;})) { -
2671 const QTextLayout::FormatRange &r = specialData->addFormats.at(cur); -
2672 qt_noop(); -
2673 if (!specialData->addFormatIndices.isEmpty()) {
partially evaluated: !specialData->addFormatIndices.isEmpty()
TRUEFALSE
yes
Evaluation Count:3
no
Evaluation Count:0
0-3
2674 format.merge(collection->format(specialData->addFormatIndices.at(cur))); -
2675 } else {
executed: }
Execution Count:3
3
2676 format.merge(r.format); -
2677 }
never executed: }
0
2678 } -
2679 indices[i] = collection->indexForFormat(format); -
2680 }
executed: }
Execution Count:6
6
2681 specialData->resolvedFormatIndices = indices; -
2682}
executed: }
Execution Count:2
2
2683 -
2684QFixed QTextEngine::leadingSpaceWidth(const QScriptLine &line) -
2685{ -
2686 if (!line.hasTrailingSpaces
evaluated: !line.hasTrailingSpaces
TRUEFALSE
yes
Evaluation Count:12272
yes
Evaluation Count:57
57-12272
2687 || (option.flags() & QTextOption::IncludeTrailingSpaces)
partially evaluated: (option.flags() & QTextOption::IncludeTrailingSpaces)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:57
0-57
2688 || !isRightToLeft())
partially evaluated: !isRightToLeft()
TRUEFALSE
yes
Evaluation Count:57
no
Evaluation Count:0
0-57
2689 return QFixed();
executed: return QFixed();
Execution Count:12329
12329
2690 -
2691 return width(line.from + line.length, line.trailingSpaces);
never executed: return width(line.from + line.length, line.trailingSpaces);
0
2692} -
2693 -
2694QFixed QTextEngine::alignLine(const QScriptLine &line) -
2695{ -
2696 QFixed x = 0; -
2697 justify(line); -
2698 -
2699 if (!line.justified && line.width != (2147483647/256)) {
partially evaluated: !line.justified
TRUEFALSE
yes
Evaluation Count:35086
no
Evaluation Count:0
evaluated: line.width != (2147483647/256)
TRUEFALSE
yes
Evaluation Count:19290
yes
Evaluation Count:15796
0-35086
2700 int align = option.alignment(); -
2701 if (align & Qt::AlignJustify && isRightToLeft())
evaluated: align & Qt::AlignJustify
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:19288
partially evaluated: isRightToLeft()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-19288
2702 align = Qt::AlignRight;
never executed: align = Qt::AlignRight;
0
2703 if (align & Qt::AlignRight)
evaluated: align & Qt::AlignRight
TRUEFALSE
yes
Evaluation Count:215
yes
Evaluation Count:19075
215-19075
2704 x = line.width - (line.textAdvance);
executed: x = line.width - (line.textAdvance);
Execution Count:215
215
2705 else if (align & Qt::AlignHCenter)
evaluated: align & Qt::AlignHCenter
TRUEFALSE
yes
Evaluation Count:2889
yes
Evaluation Count:16186
2889-16186
2706 x = (line.width - line.textAdvance)/2;
executed: x = (line.width - line.textAdvance)/2;
Execution Count:2889
2889
2707 } -
2708 return x;
executed: return x;
Execution Count:35086
35086
2709} -
2710 -
2711QFixed QTextEngine::offsetInLigature(const QScriptItem *si, int pos, int max, int glyph_pos) -
2712{ -
2713 unsigned short *logClusters = this->logClusters(si); -
2714 const QGlyphLayout &glyphs = shapedGlyphs(si); -
2715 -
2716 int offsetInCluster = 0; -
2717 for (int i = pos - 1; i >= 0; i--) {
evaluated: i >= 0
TRUEFALSE
yes
Evaluation Count:7977
yes
Evaluation Count:1926
1926-7977
2718 if (logClusters[i] == glyph_pos)
evaluated: logClusters[i] == glyph_pos
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:7972
5-7972
2719 offsetInCluster++;
executed: offsetInCluster++;
Execution Count:5
5
2720 else -
2721 break;
executed: break;
Execution Count:7972
7972
2722 } -
2723 -
2724 -
2725 -
2726 if (offsetInCluster > 0) {
evaluated: offsetInCluster > 0
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:9893
5-9893
2727 int clusterLength = 0; -
2728 for (int i = pos - offsetInCluster; i < max; i++) {
partially evaluated: i < max
TRUEFALSE
yes
Evaluation Count:15
no
Evaluation Count:0
0-15
2729 if (logClusters[i] == glyph_pos)
evaluated: logClusters[i] == glyph_pos
TRUEFALSE
yes
Evaluation Count:10
yes
Evaluation Count:5
5-10
2730 clusterLength++;
executed: clusterLength++;
Execution Count:10
10
2731 else -
2732 break;
executed: break;
Execution Count:5
5
2733 } -
2734 if (clusterLength)
partially evaluated: clusterLength
TRUEFALSE
yes
Evaluation Count:5
no
Evaluation Count:0
0-5
2735 return glyphs.advances_x[glyph_pos] * offsetInCluster / clusterLength;
executed: return glyphs.advances_x[glyph_pos] * offsetInCluster / clusterLength;
Execution Count:5
5
2736 }
never executed: }
0
2737 -
2738 return 0;
executed: return 0;
Execution Count:9893
9893
2739} -
2740 -
2741 -
2742int QTextEngine::getClusterLength(unsigned short *logClusters, -
2743 const QCharAttributes *attributes, -
2744 int from, int to, int glyph_pos, int *start) -
2745{ -
2746 int clusterLength = 0; -
2747 for (int i = from; i < to; i++) {
partially evaluated: i < to
TRUEFALSE
yes
Evaluation Count:187
no
Evaluation Count:0
0-187
2748 if (logClusters[i] == glyph_pos && attributes[i].graphemeBoundary) {
evaluated: logClusters[i] == glyph_pos
TRUEFALSE
yes
Evaluation Count:10
yes
Evaluation Count:177
partially evaluated: attributes[i].graphemeBoundary
TRUEFALSE
yes
Evaluation Count:10
no
Evaluation Count:0
0-177
2749 if (*start < 0)
partially evaluated: *start < 0
TRUEFALSE
yes
Evaluation Count:10
no
Evaluation Count:0
0-10
2750 *start = i;
executed: *start = i;
Execution Count:10
10
2751 clusterLength++; -
2752 }
executed: }
Execution Count:10
10
2753 else if (clusterLength)
evaluated: clusterLength
TRUEFALSE
yes
Evaluation Count:10
yes
Evaluation Count:167
10-167
2754 break;
executed: break;
Execution Count:10
10
2755 } -
2756 return clusterLength;
executed: return clusterLength;
Execution Count:10
10
2757} -
2758 -
2759int QTextEngine::positionInLigature(const QScriptItem *si, int end, -
2760 QFixed x, QFixed edge, int glyph_pos, -
2761 bool cursorOnCharacter) -
2762{ -
2763 unsigned short *logClusters = this->logClusters(si); -
2764 int clusterStart = -1; -
2765 int clusterLength = 0; -
2766 -
2767 if (si->analysis.script != QUnicodeTables::Common &&
partially evaluated: si->analysis.script != QUnicodeTables::Common
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:10
0-10
2768 si->analysis.script != QUnicodeTables::Greek) {
never evaluated: si->analysis.script != QUnicodeTables::Greek
0
2769 if (glyph_pos == -1)
never evaluated: glyph_pos == -1
0
2770 return si->position + end;
never executed: return si->position + end;
0
2771 else { -
2772 int i; -
2773 for (i = 0; i < end; i++)
never evaluated: i < end
0
2774 if (logClusters[i] == glyph_pos)
never evaluated: logClusters[i] == glyph_pos
0
2775 break;
never executed: break;
0
2776 return si->position + i;
never executed: return si->position + i;
0
2777 } -
2778 } -
2779 -
2780 if (glyph_pos == -1 && end > 0)
partially evaluated: glyph_pos == -1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:10
never evaluated: end > 0
0-10
2781 glyph_pos = logClusters[end - 1];
never executed: glyph_pos = logClusters[end - 1];
0
2782 else { -
2783 if (x <= edge)
evaluated: x <= edge
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:3
3-7
2784 glyph_pos--;
executed: glyph_pos--;
Execution Count:7
7
2785 }
executed: }
Execution Count:10
10
2786 -
2787 const QCharAttributes *attrs = attributes(); -
2788 logClusters = this->logClusters(si); -
2789 clusterLength = getClusterLength(logClusters, attrs, 0, end, glyph_pos, &clusterStart); -
2790 -
2791 if (clusterLength) {
partially evaluated: clusterLength
TRUEFALSE
yes
Evaluation Count:10
no
Evaluation Count:0
0-10
2792 const QGlyphLayout &glyphs = shapedGlyphs(si); -
2793 QFixed glyphWidth = glyphs.effectiveAdvance(glyph_pos); -
2794 -
2795 QFixed perItemWidth = glyphWidth / clusterLength; -
2796 if (perItemWidth <= 0)
partially evaluated: perItemWidth <= 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:10
0-10
2797 return si->position + clusterStart;
never executed: return si->position + clusterStart;
0
2798 QFixed left = x > edge ? edge : edge - glyphWidth;
evaluated: x > edge
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:7
3-7
2799 int n = ((x - left) / perItemWidth).floor().toInt(); -
2800 QFixed dist = x - left - n * perItemWidth; -
2801 int closestItem = dist > (perItemWidth / 2) ? n + 1 : n;
evaluated: dist > (perItemWidth / 2)
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:5
5
2802 if (cursorOnCharacter && closestItem > 0)
evaluated: cursorOnCharacter
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:6
evaluated: closestItem > 0
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:2
2-6
2803 closestItem--;
executed: closestItem--;
Execution Count:2
2
2804 int pos = si->position + clusterStart + closestItem; -
2805 -
2806 while (pos < end && !attrs[pos].graphemeBoundary)
partially evaluated: pos < end
TRUEFALSE
yes
Evaluation Count:10
no
Evaluation Count:0
partially evaluated: !attrs[pos].graphemeBoundary
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:10
0-10
2807 pos++;
never executed: pos++;
0
2808 return pos;
executed: return pos;
Execution Count:10
10
2809 } -
2810 return si->position + end;
never executed: return si->position + end;
0
2811} -
2812 -
2813int QTextEngine::previousLogicalPosition(int oldPos) const -
2814{ -
2815 const QCharAttributes *attrs = attributes(); -
2816 if (!attrs || oldPos < 0)
partially evaluated: !attrs
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
partially evaluated: oldPos < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
0-4
2817 return oldPos;
never executed: return oldPos;
0
2818 -
2819 if (oldPos <= 0)
evaluated: oldPos <= 0
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:3
1-3
2820 return 0;
executed: return 0;
Execution Count:1
1
2821 oldPos--; -
2822 while (oldPos && !attrs[oldPos].graphemeBoundary)
evaluated: oldPos
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:1
partially evaluated: !attrs[oldPos].graphemeBoundary
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
2823 oldPos--;
never executed: oldPos--;
0
2824 return oldPos;
executed: return oldPos;
Execution Count:3
3
2825} -
2826 -
2827int QTextEngine::nextLogicalPosition(int oldPos) const -
2828{ -
2829 const QCharAttributes *attrs = attributes(); -
2830 int len = block.isValid() ? block.length() - 1
partially evaluated: block.isValid()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:60
0-60
2831 : layoutData->string.length(); -
2832 qt_noop(); -
2833 if (!attrs || oldPos < 0 || oldPos >= len)
partially evaluated: !attrs
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:60
partially evaluated: oldPos < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:60
evaluated: oldPos >= len
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:52
0-60
2834 return oldPos;
executed: return oldPos;
Execution Count:8
8
2835 -
2836 oldPos++; -
2837 while (oldPos < len && !attrs[oldPos].graphemeBoundary)
evaluated: oldPos < len
TRUEFALSE
yes
Evaluation Count:44
yes
Evaluation Count:8
partially evaluated: !attrs[oldPos].graphemeBoundary
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:44
0-44
2838 oldPos++;
never executed: oldPos++;
0
2839 return oldPos;
executed: return oldPos;
Execution Count:52
52
2840} -
2841 -
2842int QTextEngine::lineNumberForTextPosition(int pos) -
2843{ -
2844 if (!layoutData)
evaluated: !layoutData
TRUEFALSE
yes
Evaluation Count:15768
yes
Evaluation Count:5219
5219-15768
2845 itemize();
executed: itemize();
Execution Count:15768
15768
2846 if (pos == layoutData->string.length() && lines.size())
evaluated: pos == layoutData->string.length()
TRUEFALSE
yes
Evaluation Count:17055
yes
Evaluation Count:3932
evaluated: lines.size()
TRUEFALSE
yes
Evaluation Count:2054
yes
Evaluation Count:15001
2054-17055
2847 return lines.size() - 1;
executed: return lines.size() - 1;
Execution Count:2054
2054
2848 for (int i = 0; i < lines.size(); ++i) {
evaluated: i < lines.size()
TRUEFALSE
yes
Evaluation Count:2435
yes
Evaluation Count:16591
2435-16591
2849 const QScriptLine& line = lines[i]; -
2850 if (line.from + line.length + line.trailingSpaces > pos)
evaluated: line.from + line.length + line.trailingSpaces > pos
TRUEFALSE
yes
Evaluation Count:2342
yes
Evaluation Count:93
93-2342
2851 return i;
executed: return i;
Execution Count:2342
2342
2852 }
executed: }
Execution Count:93
93
2853 return -1;
executed: return -1;
Execution Count:16591
16591
2854} -
2855 -
2856void QTextEngine::insertionPointsForLine(int lineNum, QVector<int> &insertionPoints) -
2857{ -
2858 QTextLineItemIterator iterator(this, lineNum); -
2859 bool rtl = isRightToLeft(); -
2860 bool lastLine = lineNum >= lines.size() - 1; -
2861 -
2862 while (!iterator.atEnd()) {
evaluated: !iterator.atEnd()
TRUEFALSE
yes
Evaluation Count:6245
yes
Evaluation Count:1052
1052-6245
2863 iterator.next(); -
2864 const QScriptItem *si = &layoutData->items[iterator.item]; -
2865 if (si->analysis.bidiLevel % 2) {
evaluated: si->analysis.bidiLevel % 2
TRUEFALSE
yes
Evaluation Count:4265
yes
Evaluation Count:1980
1980-4265
2866 int i = iterator.itemEnd - 1, min = iterator.itemStart; -
2867 if (lastLine && (rtl ? iterator.atBeginning() : iterator.atEnd()))
partially evaluated: lastLine
TRUEFALSE
yes
Evaluation Count:4265
no
Evaluation Count:0
evaluated: rtl
TRUEFALSE
yes
Evaluation Count:2889
yes
Evaluation Count:1376
0-4265
2868 i++;
executed: i++;
Execution Count:473
473
2869 for (; i >= min; i--)
evaluated: i >= min
TRUEFALSE
yes
Evaluation Count:10341
yes
Evaluation Count:4265
4265-10341
2870 insertionPoints.push_back(i);
executed: insertionPoints.push_back(i);
Execution Count:10341
10341
2871 } else {
executed: }
Execution Count:4265
4265
2872 int i = iterator.itemStart, max = iterator.itemEnd; -
2873 if (lastLine && (rtl ? iterator.atBeginning() : iterator.atEnd()))
partially evaluated: lastLine
TRUEFALSE
yes
Evaluation Count:1980
no
Evaluation Count:0
evaluated: rtl
TRUEFALSE
yes
Evaluation Count:1043
yes
Evaluation Count:937
0-1980
2874 max++;
executed: max++;
Execution Count:579
579
2875 for (; i < max; i++)
evaluated: i < max
TRUEFALSE
yes
Evaluation Count:9294
yes
Evaluation Count:1980
1980-9294
2876 insertionPoints.push_back(i);
executed: insertionPoints.push_back(i);
Execution Count:9294
9294
2877 }
executed: }
Execution Count:1980
1980
2878 } -
2879}
executed: }
Execution Count:1052
1052
2880 -
2881int QTextEngine::endOfLine(int lineNum) -
2882{ -
2883 QVector<int> insertionPoints; -
2884 insertionPointsForLine(lineNum, insertionPoints); -
2885 -
2886 if (insertionPoints.size() > 0)
never evaluated: insertionPoints.size() > 0
0
2887 return insertionPoints.last();
never executed: return insertionPoints.last();
0
2888 return 0;
never executed: return 0;
0
2889} -
2890 -
2891int QTextEngine::beginningOfLine(int lineNum) -
2892{ -
2893 QVector<int> insertionPoints; -
2894 insertionPointsForLine(lineNum, insertionPoints); -
2895 -
2896 if (insertionPoints.size() > 0)
never evaluated: insertionPoints.size() > 0
0
2897 return insertionPoints.first();
never executed: return insertionPoints.first();
0
2898 return 0;
never executed: return 0;
0
2899} -
2900 -
2901int QTextEngine::positionAfterVisualMovement(int pos, QTextCursor::MoveOperation op) -
2902{ -
2903 if (!layoutData)
partially evaluated: !layoutData
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1116
0-1116
2904 itemize();
never executed: itemize();
0
2905 -
2906 bool moveRight = (op == QTextCursor::Right); -
2907 bool alignRight = isRightToLeft(); -
2908 if (!layoutData->hasBidi)
evaluated: !layoutData->hasBidi
TRUEFALSE
yes
Evaluation Count:64
yes
Evaluation Count:1052
64-1052
2909 return moveRight ^ alignRight ? nextLogicalPosition(pos) : previousLogicalPosition(pos);
executed: return moveRight ^ alignRight ? nextLogicalPosition(pos) : previousLogicalPosition(pos);
Execution Count:64
64
2910 -
2911 int lineNum = lineNumberForTextPosition(pos); -
2912 qt_noop(); -
2913 -
2914 QVector<int> insertionPoints; -
2915 insertionPointsForLine(lineNum, insertionPoints); -
2916 int i, max = insertionPoints.size(); -
2917 for (i = 0; i < max; i++)
evaluated: i < max
TRUEFALSE
yes
Evaluation Count:10987
yes
Evaluation Count:93
93-10987
2918 if (pos == insertionPoints[i]) {
evaluated: pos == insertionPoints[i]
TRUEFALSE
yes
Evaluation Count:1052
yes
Evaluation Count:9935
1052-9935
2919 if (moveRight) {
evaluated: moveRight
TRUEFALSE
yes
Evaluation Count:393
yes
Evaluation Count:659
393-659
2920 if (i + 1 < max)
evaluated: i + 1 < max
TRUEFALSE
yes
Evaluation Count:360
yes
Evaluation Count:33
33-360
2921 return insertionPoints[i + 1];
executed: return insertionPoints[i + 1];
Execution Count:360
360
2922 } else {
executed: }
Execution Count:33
33
2923 if (i > 0)
evaluated: i > 0
TRUEFALSE
yes
Evaluation Count:599
yes
Evaluation Count:60
60-599
2924 return insertionPoints[i - 1];
executed: return insertionPoints[i - 1];
Execution Count:599
599
2925 }
executed: }
Execution Count:60
60
2926 -
2927 if (moveRight ^ alignRight) {
evaluated: moveRight ^ alignRight
TRUEFALSE
yes
Evaluation Count:86
yes
Evaluation Count:7
7-86
2928 if (lineNum + 1 < lines.size())
partially evaluated: lineNum + 1 < lines.size()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:86
0-86
2929 return alignRight ? endOfLine(lineNum + 1) : beginningOfLine(lineNum + 1);
never executed: return alignRight ? endOfLine(lineNum + 1) : beginningOfLine(lineNum + 1);
0
2930 }
executed: }
Execution Count:86
86
2931 else { -
2932 if (lineNum > 0)
partially evaluated: lineNum > 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:7
0-7
2933 return alignRight ? beginningOfLine(lineNum - 1) : endOfLine(lineNum - 1);
never executed: return alignRight ? beginningOfLine(lineNum - 1) : endOfLine(lineNum - 1);
0
2934 }
executed: }
Execution Count:7
7
2935 } -
2936 -
2937 return pos;
executed: return pos;
Execution Count:93
93
2938} -
2939 -
2940void QTextEngine::addItemDecoration(QPainter *painter, const QLineF &line, ItemDecorationList *decorationList) -
2941{ -
2942 if (delayDecorations) {
partially evaluated: delayDecorations
TRUEFALSE
yes
Evaluation Count:540
no
Evaluation Count:0
0-540
2943 decorationList->append(ItemDecoration(line.x1(), line.x2(), line.y1(), painter->pen())); -
2944 } else {
executed: }
Execution Count:540
540
2945 painter->drawLine(line); -
2946 }
never executed: }
0
2947} -
2948 -
2949void QTextEngine::addUnderline(QPainter *painter, const QLineF &line) -
2950{ -
2951 -
2952 addItemDecoration(painter, line, &underlineList); -
2953}
executed: }
Execution Count:538
538
2954 -
2955void QTextEngine::addStrikeOut(QPainter *painter, const QLineF &line) -
2956{ -
2957 addItemDecoration(painter, line, &strikeOutList); -
2958}
executed: }
Execution Count:1
1
2959 -
2960void QTextEngine::addOverline(QPainter *painter, const QLineF &line) -
2961{ -
2962 addItemDecoration(painter, line, &overlineList); -
2963}
executed: }
Execution Count:1
1
2964 -
2965void QTextEngine::drawItemDecorationList(QPainter *painter, const ItemDecorationList &decorationList) -
2966{ -
2967 -
2968 if (decorationList.isEmpty())
evaluated: decorationList.isEmpty()
TRUEFALSE
yes
Evaluation Count:75247
yes
Evaluation Count:539
539-75247
2969 return;
executed: return;
Execution Count:75247
75247
2970 -
2971 for (QForeachContainer<__typeof__(decorationList)> _container_(decorationList); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (const ItemDecoration &decoration = *_container_.i;; __extension__ ({--_container_.brk; break;})) { -
2972 painter->setPen(decoration.pen); -
2973 painter->drawLine(QLineF(decoration.x1, decoration.y, decoration.x2, decoration.y)); -
2974 }
executed: }
Execution Count:540
540
2975}
executed: }
Execution Count:539
539
2976 -
2977void QTextEngine::drawDecorations(QPainter *painter) -
2978{ -
2979 QPen oldPen = painter->pen(); -
2980 -
2981 bool wasCompatiblePainting = painter->renderHints() -
2982 & QPainter::Qt4CompatiblePainting; -
2983 -
2984 if (wasCompatiblePainting)
partially evaluated: wasCompatiblePainting
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:25262
0-25262
2985 painter->setRenderHint(QPainter::Qt4CompatiblePainting, false);
never executed: painter->setRenderHint(QPainter::Qt4CompatiblePainting, false);
0
2986 -
2987 adjustUnderlines(); -
2988 drawItemDecorationList(painter, underlineList); -
2989 drawItemDecorationList(painter, strikeOutList); -
2990 drawItemDecorationList(painter, overlineList); -
2991 -
2992 clearDecorations(); -
2993 -
2994 if (wasCompatiblePainting)
partially evaluated: wasCompatiblePainting
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:25262
0-25262
2995 painter->setRenderHint(QPainter::Qt4CompatiblePainting);
never executed: painter->setRenderHint(QPainter::Qt4CompatiblePainting);
0
2996 -
2997 painter->setPen(oldPen); -
2998}
executed: }
Execution Count:25262
25262
2999 -
3000void QTextEngine::clearDecorations() -
3001{ -
3002 underlineList.clear(); -
3003 strikeOutList.clear(); -
3004 overlineList.clear(); -
3005}
executed: }
Execution Count:46707
46707
3006 -
3007void QTextEngine::adjustUnderlines() -
3008{ -
3009 -
3010 if (underlineList.isEmpty())
evaluated: underlineList.isEmpty()
TRUEFALSE
yes
Evaluation Count:24725
yes
Evaluation Count:537
537-24725
3011 return;
executed: return;
Execution Count:24725
24725
3012 -
3013 ItemDecorationList::iterator start = underlineList.begin(); -
3014 ItemDecorationList::iterator end = underlineList.end(); -
3015 ItemDecorationList::iterator it = start; -
3016 qreal underlinePos = start->y; -
3017 qreal penWidth = start->pen.widthF(); -
3018 qreal lastLineEnd = start->x1; -
3019 -
3020 while (it != end) {
evaluated: it != end
TRUEFALSE
yes
Evaluation Count:538
yes
Evaluation Count:537
537-538
3021 if (qFuzzyCompare(lastLineEnd, it->x1)) {
partially evaluated: qFuzzyCompare(lastLineEnd, it->x1)
TRUEFALSE
yes
Evaluation Count:538
no
Evaluation Count:0
0-538
3022 underlinePos = qMax(underlinePos, it->y); -
3023 penWidth = qMax(penWidth, it->pen.widthF()); -
3024 } else {
executed: }
Execution Count:538
538
3025 adjustUnderlines(start, it, underlinePos, penWidth); -
3026 start = it; -
3027 underlinePos = start->y; -
3028 penWidth = start->pen.widthF(); -
3029 }
never executed: }
0
3030 lastLineEnd = it->x2; -
3031 ++it; -
3032 }
executed: }
Execution Count:538
538
3033 -
3034 adjustUnderlines(start, end, underlinePos, penWidth); -
3035}
executed: }
Execution Count:537
537
3036 -
3037void QTextEngine::adjustUnderlines(ItemDecorationList::iterator start, -
3038 ItemDecorationList::iterator end, -
3039 qreal underlinePos, qreal penWidth) -
3040{ -
3041 for (ItemDecorationList::iterator it = start; it != end; ++it) {
evaluated: it != end
TRUEFALSE
yes
Evaluation Count:538
yes
Evaluation Count:537
537-538
3042 it->y = underlinePos; -
3043 it->pen.setWidthF(penWidth); -
3044 }
executed: }
Execution Count:538
538
3045}
executed: }
Execution Count:537
537
3046 -
3047QStackTextEngine::QStackTextEngine(const QString &string, const QFont &f) -
3048 : QTextEngine(string, f), -
3049 _layoutData(string, _memory, MemSize) -
3050{ -
3051 stackEngine = true; -
3052 layoutData = &_layoutData; -
3053}
executed: }
Execution Count:49261
49261
3054 -
3055QTextItemInt::QTextItemInt(const QScriptItem &si, QFont *font, const QTextCharFormat &format) -
3056 : justified(false), underlineStyle(QTextCharFormat::NoUnderline), charFormat(format), -
3057 num_chars(0), chars(0), logClusters(0), f(0), fontEngine(0) -
3058{ -
3059 f = font; -
3060 fontEngine = f->d->engineForScript(si.analysis.script); -
3061 qt_noop(); -
3062 -
3063 initWithScriptItem(si); -
3064}
executed: }
Execution Count:898
898
3065 -
3066QTextItemInt::QTextItemInt(const QGlyphLayout &g, QFont *font, const QChar *chars_, int numChars, QFontEngine *fe, const QTextCharFormat &format) -
3067 : flags(0), justified(false), underlineStyle(QTextCharFormat::NoUnderline), charFormat(format), -
3068 num_chars(numChars), chars(chars_), logClusters(0), f(font), glyphs(g), fontEngine(fe) -
3069{ -
3070}
executed: }
Execution Count:21530
21530
3071 -
3072 -
3073void QTextItemInt::initWithScriptItem(const QScriptItem &si) -
3074{ -
3075 -
3076 -
3077 flags = 0; -
3078 if (si.analysis.bidiLevel %2)
evaluated: si.analysis.bidiLevel %2
TRUEFALSE
yes
Evaluation Count:13
yes
Evaluation Count:22415
13-22415
3079 flags |= QTextItem::RightToLeft;
executed: flags |= QTextItem::RightToLeft;
Execution Count:13
13
3080 ascent = si.ascent; -
3081 descent = si.descent; -
3082 -
3083 if (charFormat.hasProperty(QTextFormat::TextUnderlineStyle)) {
evaluated: charFormat.hasProperty(QTextFormat::TextUnderlineStyle)
TRUEFALSE
yes
Evaluation Count:17
yes
Evaluation Count:22411
17-22411
3084 underlineStyle = charFormat.underlineStyle(); -
3085 } else if (charFormat.boolProperty(QTextFormat::FontUnderline)
partially evaluated: charFormat.boolProperty(QTextFormat::FontUnderline)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:22411
executed: }
Execution Count:17
0-22411
3086 || f->d->underline) {
evaluated: f->d->underline
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:22409
2-22409
3087 underlineStyle = QTextCharFormat::SingleUnderline; -
3088 }
executed: }
Execution Count:2
2
3089 -
3090 -
3091 if (underlineStyle == QTextCharFormat::SingleUnderline)
evaluated: underlineStyle == QTextCharFormat::SingleUnderline
TRUEFALSE
yes
Evaluation Count:19
yes
Evaluation Count:22409
19-22409
3092 flags |= QTextItem::Underline;
executed: flags |= QTextItem::Underline;
Execution Count:19
19
3093 -
3094 if (f->d->overline || charFormat.fontOverline())
evaluated: f->d->overline
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:22427
partially evaluated: charFormat.fontOverline()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:22427
0-22427
3095 flags |= QTextItem::Overline;
executed: flags |= QTextItem::Overline;
Execution Count:1
1
3096 if (f->d->strikeOut || charFormat.fontStrikeOut())
evaluated: f->d->strikeOut
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:22427
partially evaluated: charFormat.fontStrikeOut()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:22427
0-22427
3097 flags |= QTextItem::StrikeOut;
executed: flags |= QTextItem::StrikeOut;
Execution Count:1
1
3098}
executed: }
Execution Count:22428
22428
3099 -
3100QTextItemInt QTextItemInt::midItem(QFontEngine *fontEngine, int firstGlyphIndex, int numGlyphs) const -
3101{ -
3102 QTextItemInt ti = *this; -
3103 const int end = firstGlyphIndex + numGlyphs; -
3104 ti.glyphs = glyphs.mid(firstGlyphIndex, numGlyphs); -
3105 ti.fontEngine = fontEngine; -
3106 -
3107 if (logClusters && chars) {
partially evaluated: logClusters
TRUEFALSE
yes
Evaluation Count:23009
no
Evaluation Count:0
partially evaluated: chars
TRUEFALSE
yes
Evaluation Count:23009
no
Evaluation Count:0
0-23009
3108 const int logClusterOffset = logClusters[0]; -
3109 while (logClusters[ti.chars - chars] - logClusterOffset < firstGlyphIndex)
partially evaluated: logClusters[ti.chars - chars] - logClusterOffset < firstGlyphIndex
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:23009
0-23009
3110 ++ti.chars;
never executed: ++ti.chars;
0
3111 -
3112 ti.logClusters += (ti.chars - chars); -
3113 -
3114 ti.num_chars = 0; -
3115 int char_start = ti.chars - chars; -
3116 while (char_start + ti.num_chars < num_chars && ti.logClusters[ti.num_chars] - logClusterOffset < end)
evaluated: char_start + ti.num_chars < num_chars
TRUEFALSE
yes
Evaluation Count:145876
yes
Evaluation Count:23009
partially evaluated: ti.logClusters[ti.num_chars] - logClusterOffset < end
TRUEFALSE
yes
Evaluation Count:145876
no
Evaluation Count:0
0-145876
3117 ++ti.num_chars;
executed: ++ti.num_chars;
Execution Count:145876
145876
3118 }
executed: }
Execution Count:23009
23009
3119 return ti;
executed: return ti;
Execution Count:23009
23009
3120} -
3121 -
3122 -
3123QTransform qt_true_matrix(qreal w, qreal h, QTransform x) -
3124{ -
3125 QRectF rect = x.mapRect(QRectF(0, 0, w, h)); -
3126 return x * QTransform::fromTranslate(-rect.x(), -rect.y());
never executed: return x * QTransform::fromTranslate(-rect.x(), -rect.y());
0
3127} -
3128 -
3129 -
3130glyph_metrics_t glyph_metrics_t::transformed(const QTransform &matrix) const -
3131{ -
3132 if (matrix.type() < QTransform::TxTranslate)
never evaluated: matrix.type() < QTransform::TxTranslate
0
3133 return *this;
never executed: return *this;
0
3134 -
3135 glyph_metrics_t m = *this; -
3136 -
3137 qreal w = width.toReal(); -
3138 qreal h = height.toReal(); -
3139 QTransform xform = qt_true_matrix(w, h, matrix); -
3140 -
3141 QRectF rect(0, 0, w, h); -
3142 rect = xform.mapRect(rect); -
3143 m.width = QFixed::fromReal(rect.width()); -
3144 m.height = QFixed::fromReal(rect.height()); -
3145 -
3146 QLineF l = xform.map(QLineF(x.toReal(), y.toReal(), xoff.toReal(), yoff.toReal())); -
3147 -
3148 m.x = QFixed::fromReal(l.x1()); -
3149 m.y = QFixed::fromReal(l.y1()); -
3150 -
3151 -
3152 m.xoff = QFixed::fromReal(l.dx()); -
3153 m.yoff = QFixed::fromReal(l.dy()); -
3154 -
3155 return m;
never executed: return m;
0
3156} -
3157 -
3158QTextLineItemIterator::QTextLineItemIterator(QTextEngine *_eng, int _lineNum, const QPointF &pos, -
3159 const QTextLayout::FormatRange *_selection) -
3160 : eng(_eng), -
3161 line(eng->lines[_lineNum]), -
3162 si(0), -
3163 lineNum(_lineNum), -
3164 lineEnd(line.from + line.length), -
3165 firstItem(eng->findItem(line.from)), -
3166 lastItem(eng->findItem(lineEnd - 1)), -
3167 nItems((firstItem >= 0 && lastItem >= firstItem)? (lastItem-firstItem+1) : 0), -
3168 logicalItem(-1), -
3169 item(-1), -
3170 visualOrder(nItems), -
3171 levels(nItems), -
3172 selection(_selection) -
3173{ -
3174 pos_x = x = QFixed::fromReal(pos.x()); -
3175 -
3176 x += line.x; -
3177 -
3178 x += eng->alignLine(line); -
3179 -
3180 for (int i = 0; i < nItems; ++i)
evaluated: i < nItems
TRUEFALSE
yes
Evaluation Count:28583
yes
Evaluation Count:22570
22570-28583
3181 levels[i] = eng->layoutData->items[i+firstItem].analysis.bidiLevel;
executed: levels[i] = eng->layoutData->items[i+firstItem].analysis.bidiLevel;
Execution Count:28583
28583
3182 QTextEngine::bidiReorder(nItems, levels.data(), visualOrder.data()); -
3183 -
3184 eng->shapeLine(line); -
3185}
executed: }
Execution Count:22570
22570
3186 -
3187QScriptItem &QTextLineItemIterator::next() -
3188{ -
3189 x += itemWidth; -
3190 -
3191 ++logicalItem; -
3192 item = visualOrder[logicalItem] + firstItem; -
3193 itemLength = eng->length(item); -
3194 si = &eng->layoutData->items[item]; -
3195 if (!si->num_glyphs)
evaluated: !si->num_glyphs
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:28580
3-28580
3196 eng->shape(item);
executed: eng->shape(item);
Execution Count:3
3
3197 -
3198 if (si->analysis.flags >= QScriptAnalysis::TabOrObject) {
evaluated: si->analysis.flags >= QScriptAnalysis::TabOrObject
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:28580
3-28580
3199 itemWidth = si->width; -
3200 return *si;
executed: return *si;
Execution Count:3
3
3201 } -
3202 -
3203 unsigned short *logClusters = eng->logClusters(si); -
3204 QGlyphLayout glyphs = eng->shapedGlyphs(si); -
3205 -
3206 itemStart = qMax(line.from, si->position); -
3207 glyphsStart = logClusters[itemStart - si->position]; -
3208 if (lineEnd < si->position + itemLength) {
evaluated: lineEnd < si->position + itemLength
TRUEFALSE
yes
Evaluation Count:142
yes
Evaluation Count:28438
142-28438
3209 itemEnd = lineEnd; -
3210 glyphsEnd = logClusters[itemEnd-si->position]; -
3211 } else {
executed: }
Execution Count:142
142
3212 itemEnd = si->position + itemLength; -
3213 glyphsEnd = si->num_glyphs; -
3214 }
executed: }
Execution Count:28438
28438
3215 -
3216 if (si->position + itemLength >= lineEnd
evaluated: si->position + itemLength >= lineEnd
TRUEFALSE
yes
Evaluation Count:22568
yes
Evaluation Count:6012
6012-22568
3217 && eng->layoutData->string.at(lineEnd - 1).unicode() == QChar::SoftHyphen)
partially evaluated: eng->layoutData->string.at(lineEnd - 1).unicode() == QChar::SoftHyphen
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:22568
0-22568
3218 glyphs.attributes[glyphsEnd - 1].dontPrint = false;
never executed: glyphs.attributes[glyphsEnd - 1].dontPrint = false;
0
3219 -
3220 itemWidth = 0; -
3221 for (int g = glyphsStart; g < glyphsEnd; ++g)
evaluated: g < glyphsEnd
TRUEFALSE
yes
Evaluation Count:155470
yes
Evaluation Count:28580
28580-155470
3222 itemWidth += glyphs.effectiveAdvance(g);
executed: itemWidth += glyphs.effectiveAdvance(g);
Execution Count:155470
155470
3223 -
3224 return *si;
executed: return *si;
Execution Count:28580
28580
3225} -
3226 -
3227bool QTextLineItemIterator::getSelectionBounds(QFixed *selectionX, QFixed *selectionWidth) const -
3228{ -
3229 *selectionX = *selectionWidth = 0; -
3230 -
3231 if (!selection)
partially evaluated: !selection
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:125
0-125
3232 return false;
never executed: return false;
0
3233 -
3234 if (si->analysis.flags >= QScriptAnalysis::TabOrObject) {
partially evaluated: si->analysis.flags >= QScriptAnalysis::TabOrObject
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:125
0-125
3235 if (si->position >= selection->start + selection->length
never evaluated: si->position >= selection->start + selection->length
0
3236 || si->position + itemLength <= selection->start)
never evaluated: si->position + itemLength <= selection->start
0
3237 return false;
never executed: return false;
0
3238 -
3239 *selectionX = x; -
3240 *selectionWidth = itemWidth; -
3241 } else {
never executed: }
0
3242 unsigned short *logClusters = eng->logClusters(si); -
3243 QGlyphLayout glyphs = eng->shapedGlyphs(si); -
3244 -
3245 int from = qMax(itemStart, selection->start) - si->position; -
3246 int to = qMin(itemEnd, selection->start + selection->length) - si->position; -
3247 if (from >= to)
partially evaluated: from >= to
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:125
0-125
3248 return false;
never executed: return false;
0
3249 -
3250 int start_glyph = logClusters[from]; -
3251 int end_glyph = (to == eng->length(item)) ? si->num_glyphs : logClusters[to];
evaluated: (to == eng->length(item))
TRUEFALSE
yes
Evaluation Count:111
yes
Evaluation Count:14
14-111
3252 QFixed soff; -
3253 QFixed swidth; -
3254 if (si->analysis.bidiLevel %2) {
evaluated: si->analysis.bidiLevel %2
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:118
7-118
3255 for (int g = glyphsEnd - 1; g >= end_glyph; --g)
partially evaluated: g >= end_glyph
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:7
0-7
3256 soff += glyphs.effectiveAdvance(g);
never executed: soff += glyphs.effectiveAdvance(g);
0
3257 for (int g = end_glyph - 1; g >= start_glyph; --g)
evaluated: g >= start_glyph
TRUEFALSE
yes
Evaluation Count:21
yes
Evaluation Count:7
7-21
3258 swidth += glyphs.effectiveAdvance(g);
executed: swidth += glyphs.effectiveAdvance(g);
Execution Count:21
21
3259 } else {
executed: }
Execution Count:7
7
3260 for (int g = glyphsStart; g < start_glyph; ++g)
evaluated: g < start_glyph
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:118
2-118
3261 soff += glyphs.effectiveAdvance(g);
executed: soff += glyphs.effectiveAdvance(g);
Execution Count:2
2
3262 for (int g = start_glyph; g < end_glyph; ++g)
evaluated: g < end_glyph
TRUEFALSE
yes
Evaluation Count:642
yes
Evaluation Count:118
118-642
3263 swidth += glyphs.effectiveAdvance(g);
executed: swidth += glyphs.effectiveAdvance(g);
Execution Count:642
642
3264 }
executed: }
Execution Count:118
118
3265 -
3266 -
3267 -
3268 -
3269 -
3270 QFixed leftOffsetInLigature = eng->offsetInLigature(si, from, to, start_glyph); -
3271 *selectionX = x + soff + leftOffsetInLigature; -
3272 *selectionWidth = swidth - leftOffsetInLigature; -
3273 -
3274 -
3275 -
3276 *selectionWidth += eng->offsetInLigature(si, to, eng->length(item), end_glyph); -
3277 }
executed: }
Execution Count:125
125
3278 return true;
executed: return true;
Execution Count:125
125
3279} -
3280 -
3281 -
3282 -
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial