Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/gui/text/qtextengine.cpp |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | - | |||||||||||||||||||||||||
2 | - | |||||||||||||||||||||||||
3 | - | |||||||||||||||||||||||||
4 | - | |||||||||||||||||||||||||
5 | - | |||||||||||||||||||||||||
6 | static const float smallCapsFraction = 0.7f; | - | ||||||||||||||||||||||||
7 | - | |||||||||||||||||||||||||
8 | namespace { | - | ||||||||||||||||||||||||
9 | - | |||||||||||||||||||||||||
10 | - | |||||||||||||||||||||||||
11 | class Itemizer { | - | ||||||||||||||||||||||||
12 | public: | - | ||||||||||||||||||||||||
13 | Itemizer(const QString &string, const QScriptAnalysis *analysis, QScriptItemArray &items) | - | ||||||||||||||||||||||||
14 | : m_string(string), | - | ||||||||||||||||||||||||
15 | m_analysis(analysis), | - | ||||||||||||||||||||||||
16 | m_items(items), | - | ||||||||||||||||||||||||
17 | m_splitter(0) | - | ||||||||||||||||||||||||
18 | { | - | ||||||||||||||||||||||||
19 | } never executed: end of block | 0 | ||||||||||||||||||||||||
20 | ~Itemizer() | - | ||||||||||||||||||||||||
21 | { | - | ||||||||||||||||||||||||
22 | delete m_splitter; | - | ||||||||||||||||||||||||
23 | } never executed: end of block | 0 | ||||||||||||||||||||||||
24 | - | |||||||||||||||||||||||||
25 | - | |||||||||||||||||||||||||
26 | - | |||||||||||||||||||||||||
27 | void generate(int start, int length, QFont::Capitalization caps) | - | ||||||||||||||||||||||||
28 | { | - | ||||||||||||||||||||||||
29 | if (caps == QFont::SmallCaps
| 0 | ||||||||||||||||||||||||
30 | generateScriptItemsSmallCaps(reinterpret_cast<const ushort *>(m_string.unicode()), start, length); never executed: generateScriptItemsSmallCaps(reinterpret_cast<const ushort *>(m_string.unicode()), start, length); | 0 | ||||||||||||||||||||||||
31 | else if(caps == QFont::Capitalize
| 0 | ||||||||||||||||||||||||
32 | generateScriptItemsCapitalize(start, length); never executed: generateScriptItemsCapitalize(start, length); | 0 | ||||||||||||||||||||||||
33 | else if(caps != QFont::MixedCase
| 0 | ||||||||||||||||||||||||
34 | generateScriptItemsAndChangeCase(start, length, | - | ||||||||||||||||||||||||
35 | caps == QFont::AllLowercase ? QScriptAnalysis::Lowercase : QScriptAnalysis::Uppercase); | - | ||||||||||||||||||||||||
36 | } never executed: end of block | 0 | ||||||||||||||||||||||||
37 | else | - | ||||||||||||||||||||||||
38 | generateScriptItems(start, length); never executed: generateScriptItems(start, length); | 0 | ||||||||||||||||||||||||
39 | } | - | ||||||||||||||||||||||||
40 | - | |||||||||||||||||||||||||
41 | private: | - | ||||||||||||||||||||||||
42 | enum { MaxItemLength = 4096 }; | - | ||||||||||||||||||||||||
43 | - | |||||||||||||||||||||||||
44 | void generateScriptItemsAndChangeCase(int start, int length, QScriptAnalysis::Flags flags) | - | ||||||||||||||||||||||||
45 | { | - | ||||||||||||||||||||||||
46 | generateScriptItems(start, length); | - | ||||||||||||||||||||||||
47 | if (m_items.isEmpty()
| 0 | ||||||||||||||||||||||||
48 | return; never executed: return; | 0 | ||||||||||||||||||||||||
49 | QScriptItemArray::Iterator iter = m_items.end(); | - | ||||||||||||||||||||||||
50 | do { | - | ||||||||||||||||||||||||
51 | iter--; | - | ||||||||||||||||||||||||
52 | if (iter->analysis.flags < QScriptAnalysis::LineOrParagraphSeparator
| 0 | ||||||||||||||||||||||||
53 | iter->analysis.flags = flags; never executed: iter->analysis.flags = flags; | 0 | ||||||||||||||||||||||||
54 | } never executed: while (iter->position > startend of block
| 0 | ||||||||||||||||||||||||
55 | } never executed: end of block | 0 | ||||||||||||||||||||||||
56 | - | |||||||||||||||||||||||||
57 | void generateScriptItems(int start, int length) | - | ||||||||||||||||||||||||
58 | { | - | ||||||||||||||||||||||||
59 | if (!length
| 0 | ||||||||||||||||||||||||
60 | return; never executed: return; | 0 | ||||||||||||||||||||||||
61 | const int end = start + length; | - | ||||||||||||||||||||||||
62 | for (int i = start + 1; i < end
| 0 | ||||||||||||||||||||||||
63 | if (m_analysis[i].bidiLevel == m_analysis[start].bidiLevel
| 0 | ||||||||||||||||||||||||
64 | && m_analysis[i].flags == m_analysis[start].flags
| 0 | ||||||||||||||||||||||||
65 | && (m_analysis[i].script == m_analysis[start].script
| 0 | ||||||||||||||||||||||||
66 | && m_analysis[i].flags < QScriptAnalysis::SpaceTabOrObject
| 0 | ||||||||||||||||||||||||
67 | && i - start < MaxItemLength
| 0 | ||||||||||||||||||||||||
68 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||
69 | m_items.append(QScriptItem(start, m_analysis[start])); | - | ||||||||||||||||||||||||
70 | start = i; | - | ||||||||||||||||||||||||
71 | } never executed: end of block | 0 | ||||||||||||||||||||||||
72 | m_items.append(QScriptItem(start, m_analysis[start])); | - | ||||||||||||||||||||||||
73 | } never executed: end of block | 0 | ||||||||||||||||||||||||
74 | - | |||||||||||||||||||||||||
75 | void generateScriptItemsCapitalize(int start, int length) | - | ||||||||||||||||||||||||
76 | { | - | ||||||||||||||||||||||||
77 | if (!length
| 0 | ||||||||||||||||||||||||
78 | return; never executed: return; | 0 | ||||||||||||||||||||||||
79 | - | |||||||||||||||||||||||||
80 | if (!m_splitter
| 0 | ||||||||||||||||||||||||
81 | m_splitter = new QTextBoundaryFinder(QTextBoundaryFinder::Word, never executed: m_splitter = new QTextBoundaryFinder(QTextBoundaryFinder::Word, m_string.constData(), m_string.length(), 0, 0); | 0 | ||||||||||||||||||||||||
82 | m_string.constData(), m_string.length(), never executed: m_splitter = new QTextBoundaryFinder(QTextBoundaryFinder::Word, m_string.constData(), m_string.length(), 0, 0); | 0 | ||||||||||||||||||||||||
83 | 0, 0); never executed: m_splitter = new QTextBoundaryFinder(QTextBoundaryFinder::Word, m_string.constData(), m_string.length(), 0, 0); | 0 | ||||||||||||||||||||||||
84 | - | |||||||||||||||||||||||||
85 | m_splitter->setPosition(start); | - | ||||||||||||||||||||||||
86 | QScriptAnalysis itemAnalysis = m_analysis[start]; | - | ||||||||||||||||||||||||
87 | - | |||||||||||||||||||||||||
88 | if (m_splitter->boundaryReasons() & QTextBoundaryFinder::StartOfItem
| 0 | ||||||||||||||||||||||||
89 | itemAnalysis.flags = QScriptAnalysis::Uppercase; never executed: itemAnalysis.flags = QScriptAnalysis::Uppercase; | 0 | ||||||||||||||||||||||||
90 | - | |||||||||||||||||||||||||
91 | m_splitter->toNextBoundary(); | - | ||||||||||||||||||||||||
92 | - | |||||||||||||||||||||||||
93 | const int end = start + length; | - | ||||||||||||||||||||||||
94 | for (int i = start + 1; i < end
| 0 | ||||||||||||||||||||||||
95 | bool atWordStart = false; | - | ||||||||||||||||||||||||
96 | - | |||||||||||||||||||||||||
97 | if (i == m_splitter->position()
| 0 | ||||||||||||||||||||||||
98 | if (m_splitter->boundaryReasons() & QTextBoundaryFinder::StartOfItem
| 0 | ||||||||||||||||||||||||
99 | ((!(m_analysis[i].flags < QScriptAnalysis::TabOrObject)) ? qt_assert("m_analysis[i].flags < QScriptAnalysis::TabOrObject",__FILE__,155) : qt_noop()); | - | ||||||||||||||||||||||||
100 | atWordStart = true; | - | ||||||||||||||||||||||||
101 | } never executed: end of block | 0 | ||||||||||||||||||||||||
102 | - | |||||||||||||||||||||||||
103 | m_splitter->toNextBoundary(); | - | ||||||||||||||||||||||||
104 | } never executed: end of block | 0 | ||||||||||||||||||||||||
105 | - | |||||||||||||||||||||||||
106 | if (m_analysis[i] == itemAnalysis
| 0 | ||||||||||||||||||||||||
107 | && m_analysis[i].flags < QScriptAnalysis::TabOrObject
| 0 | ||||||||||||||||||||||||
108 | && !atWordStart
| 0 | ||||||||||||||||||||||||
109 | && i - start < MaxItemLength
| 0 | ||||||||||||||||||||||||
110 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||
111 | - | |||||||||||||||||||||||||
112 | m_items.append(QScriptItem(start, itemAnalysis)); | - | ||||||||||||||||||||||||
113 | start = i; | - | ||||||||||||||||||||||||
114 | itemAnalysis = m_analysis[start]; | - | ||||||||||||||||||||||||
115 | - | |||||||||||||||||||||||||
116 | if (atWordStart
| 0 | ||||||||||||||||||||||||
117 | itemAnalysis.flags = QScriptAnalysis::Uppercase; never executed: itemAnalysis.flags = QScriptAnalysis::Uppercase; | 0 | ||||||||||||||||||||||||
118 | } never executed: end of block | 0 | ||||||||||||||||||||||||
119 | m_items.append(QScriptItem(start, itemAnalysis)); | - | ||||||||||||||||||||||||
120 | } never executed: end of block | 0 | ||||||||||||||||||||||||
121 | - | |||||||||||||||||||||||||
122 | void generateScriptItemsSmallCaps(const ushort *uc, int start, int length) | - | ||||||||||||||||||||||||
123 | { | - | ||||||||||||||||||||||||
124 | if (!length
| 0 | ||||||||||||||||||||||||
125 | return; never executed: return; | 0 | ||||||||||||||||||||||||
126 | bool lower = (QChar::category(uc[start]) == QChar::Letter_Lowercase); | - | ||||||||||||||||||||||||
127 | const int end = start + length; | - | ||||||||||||||||||||||||
128 | - | |||||||||||||||||||||||||
129 | for (int i = start + 1; i < end
| 0 | ||||||||||||||||||||||||
130 | bool l = (QChar::category(uc[i]) == QChar::Letter_Lowercase); | - | ||||||||||||||||||||||||
131 | if ((
| 0 | ||||||||||||||||||||||||
132 | && m_analysis[i].flags < QScriptAnalysis::TabOrObject
| 0 | ||||||||||||||||||||||||
133 | && l == lower
| 0 | ||||||||||||||||||||||||
134 | && i - start < MaxItemLength
| 0 | ||||||||||||||||||||||||
135 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||
136 | m_items.append(QScriptItem(start, m_analysis[start])); | - | ||||||||||||||||||||||||
137 | if (lower
| 0 | ||||||||||||||||||||||||
138 | m_items.last().analysis.flags = QScriptAnalysis::SmallCaps; never executed: m_items.last().analysis.flags = QScriptAnalysis::SmallCaps; | 0 | ||||||||||||||||||||||||
139 | - | |||||||||||||||||||||||||
140 | start = i; | - | ||||||||||||||||||||||||
141 | lower = l; | - | ||||||||||||||||||||||||
142 | } never executed: end of block | 0 | ||||||||||||||||||||||||
143 | m_items.append(QScriptItem(start, m_analysis[start])); | - | ||||||||||||||||||||||||
144 | if (lower
| 0 | ||||||||||||||||||||||||
145 | m_items.last().analysis.flags = QScriptAnalysis::SmallCaps; never executed: m_items.last().analysis.flags = QScriptAnalysis::SmallCaps; | 0 | ||||||||||||||||||||||||
146 | } never executed: end of block | 0 | ||||||||||||||||||||||||
147 | - | |||||||||||||||||||||||||
148 | const QString &m_string; | - | ||||||||||||||||||||||||
149 | const QScriptAnalysis * const m_analysis; | - | ||||||||||||||||||||||||
150 | QScriptItemArray &m_items; | - | ||||||||||||||||||||||||
151 | QTextBoundaryFinder *m_splitter; | - | ||||||||||||||||||||||||
152 | }; | - | ||||||||||||||||||||||||
153 | } | - | ||||||||||||||||||||||||
154 | struct QBidiStatus { | - | ||||||||||||||||||||||||
155 | QBidiStatus() { | - | ||||||||||||||||||||||||
156 | eor = QChar::DirON; | - | ||||||||||||||||||||||||
157 | lastStrong = QChar::DirON; | - | ||||||||||||||||||||||||
158 | last = QChar:: DirON; | - | ||||||||||||||||||||||||
159 | dir = QChar::DirON; | - | ||||||||||||||||||||||||
160 | } never executed: end of block | 0 | ||||||||||||||||||||||||
161 | QChar::Direction eor; | - | ||||||||||||||||||||||||
162 | QChar::Direction lastStrong; | - | ||||||||||||||||||||||||
163 | QChar::Direction last; | - | ||||||||||||||||||||||||
164 | QChar::Direction dir; | - | ||||||||||||||||||||||||
165 | }; | - | ||||||||||||||||||||||||
166 | - | |||||||||||||||||||||||||
167 | enum { MaxBidiLevel = 61 }; | - | ||||||||||||||||||||||||
168 | - | |||||||||||||||||||||||||
169 | struct QBidiControl { | - | ||||||||||||||||||||||||
170 | inline QBidiControl(bool rtl) | - | ||||||||||||||||||||||||
171 | : cCtx(0), base(rtl ? 1 : 0), level(rtl ? 1 : 0), override(false) {} never executed: end of block | 0 | ||||||||||||||||||||||||
172 | - | |||||||||||||||||||||||||
173 | inline void embed(bool rtl, bool o = false) { | - | ||||||||||||||||||||||||
174 | unsigned int toAdd = 1; | - | ||||||||||||||||||||||||
175 | if((
| 0 | ||||||||||||||||||||||||
176 | ++toAdd; | - | ||||||||||||||||||||||||
177 | } never executed: end of block | 0 | ||||||||||||||||||||||||
178 | if (level + toAdd <= MaxBidiLevel
| 0 | ||||||||||||||||||||||||
179 | ctx[cCtx].level = level; | - | ||||||||||||||||||||||||
180 | ctx[cCtx].override = override; | - | ||||||||||||||||||||||||
181 | cCtx++; | - | ||||||||||||||||||||||||
182 | override = o; | - | ||||||||||||||||||||||||
183 | level += toAdd; | - | ||||||||||||||||||||||||
184 | } never executed: end of block | 0 | ||||||||||||||||||||||||
185 | } never executed: end of block | 0 | ||||||||||||||||||||||||
186 | inline bool canPop() const { return never executed: cCtx != 0;return cCtx != 0; never executed: }return cCtx != 0; | 0 | ||||||||||||||||||||||||
187 | inline void pdf() { | - | ||||||||||||||||||||||||
188 | ((!(cCtx)) ? qt_assert("cCtx",__FILE__,267) : qt_noop()); | - | ||||||||||||||||||||||||
189 | --cCtx; | - | ||||||||||||||||||||||||
190 | level = ctx[cCtx].level; | - | ||||||||||||||||||||||||
191 | override = ctx[cCtx].override; | - | ||||||||||||||||||||||||
192 | } never executed: end of block | 0 | ||||||||||||||||||||||||
193 | - | |||||||||||||||||||||||||
194 | inline QChar::Direction basicDirection() const { | - | ||||||||||||||||||||||||
195 | return never executed: (base ? QChar::DirR : QChar:: DirL);return (base ? QChar::DirR : QChar:: DirL); never executed: return (base ? QChar::DirR : QChar:: DirL); | 0 | ||||||||||||||||||||||||
196 | } | - | ||||||||||||||||||||||||
197 | inline unsigned int baseLevel() const { | - | ||||||||||||||||||||||||
198 | return never executed: base;return base; never executed: return base; | 0 | ||||||||||||||||||||||||
199 | } | - | ||||||||||||||||||||||||
200 | inline QChar::Direction direction() const { | - | ||||||||||||||||||||||||
201 | return never executed: ((level%2) ? QChar::DirR : QChar:: DirL);return ((level%2) ? QChar::DirR : QChar:: DirL); never executed: return ((level%2) ? QChar::DirR : QChar:: DirL); | 0 | ||||||||||||||||||||||||
202 | } | - | ||||||||||||||||||||||||
203 | - | |||||||||||||||||||||||||
204 | struct { | - | ||||||||||||||||||||||||
205 | unsigned int level; | - | ||||||||||||||||||||||||
206 | bool override; | - | ||||||||||||||||||||||||
207 | } ctx[MaxBidiLevel]; | - | ||||||||||||||||||||||||
208 | unsigned int cCtx; | - | ||||||||||||||||||||||||
209 | const unsigned int base; | - | ||||||||||||||||||||||||
210 | unsigned int level; | - | ||||||||||||||||||||||||
211 | bool override; | - | ||||||||||||||||||||||||
212 | }; | - | ||||||||||||||||||||||||
213 | - | |||||||||||||||||||||||||
214 | - | |||||||||||||||||||||||||
215 | static void appendItems(QScriptAnalysis *analysis, int &start, int &stop, const QBidiControl &control, QChar::Direction dir) | - | ||||||||||||||||||||||||
216 | { | - | ||||||||||||||||||||||||
217 | if (start > stop
| 0 | ||||||||||||||||||||||||
218 | return; never executed: return; | 0 | ||||||||||||||||||||||||
219 | - | |||||||||||||||||||||||||
220 | int level = control.level; | - | ||||||||||||||||||||||||
221 | - | |||||||||||||||||||||||||
222 | if(dir != QChar::DirON
| 0 | ||||||||||||||||||||||||
223 | - | |||||||||||||||||||||||||
224 | if(level % 2
| 0 | ||||||||||||||||||||||||
225 | if(dir == QChar::DirL
| 0 | ||||||||||||||||||||||||
226 | level++; never executed: level++; | 0 | ||||||||||||||||||||||||
227 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
228 | if(dir == QChar::DirR
| 0 | ||||||||||||||||||||||||
229 | level++; never executed: level++; | 0 | ||||||||||||||||||||||||
230 | else if(dir == QChar::DirAN
| 0 | ||||||||||||||||||||||||
231 | level += 2; never executed: level += 2; | 0 | ||||||||||||||||||||||||
232 | } never executed: end of block | 0 | ||||||||||||||||||||||||
233 | } | - | ||||||||||||||||||||||||
234 | - | |||||||||||||||||||||||||
235 | - | |||||||||||||||||||||||||
236 | - | |||||||||||||||||||||||||
237 | - | |||||||||||||||||||||||||
238 | QScriptAnalysis *s = analysis + start; | - | ||||||||||||||||||||||||
239 | const QScriptAnalysis *e = analysis + stop; | - | ||||||||||||||||||||||||
240 | while (s <= e
| 0 | ||||||||||||||||||||||||
241 | s->bidiLevel = level; | - | ||||||||||||||||||||||||
242 | ++s; | - | ||||||||||||||||||||||||
243 | } never executed: end of block | 0 | ||||||||||||||||||||||||
244 | ++stop; | - | ||||||||||||||||||||||||
245 | start = stop; | - | ||||||||||||||||||||||||
246 | } never executed: end of block | 0 | ||||||||||||||||||||||||
247 | - | |||||||||||||||||||||||||
248 | static QChar::Direction skipBoundryNeutrals(QScriptAnalysis *analysis, | - | ||||||||||||||||||||||||
249 | const ushort *unicode, int length, | - | ||||||||||||||||||||||||
250 | int &sor, int &eor, QBidiControl &control) | - | ||||||||||||||||||||||||
251 | { | - | ||||||||||||||||||||||||
252 | QChar::Direction dir = control.basicDirection(); | - | ||||||||||||||||||||||||
253 | int level = sor > 0
| 0 | ||||||||||||||||||||||||
254 | while (sor < length
| 0 | ||||||||||||||||||||||||
255 | dir = QChar::direction(unicode[sor]); | - | ||||||||||||||||||||||||
256 | - | |||||||||||||||||||||||||
257 | if (dir != QChar::DirBN
| 0 | ||||||||||||||||||||||||
258 | break; never executed: break; | 0 | ||||||||||||||||||||||||
259 | analysis[sor++].bidiLevel = level; | - | ||||||||||||||||||||||||
260 | } never executed: end of block | 0 | ||||||||||||||||||||||||
261 | - | |||||||||||||||||||||||||
262 | eor = sor; | - | ||||||||||||||||||||||||
263 | if (eor == length
| 0 | ||||||||||||||||||||||||
264 | dir = control.basicDirection(); never executed: dir = control.basicDirection(); | 0 | ||||||||||||||||||||||||
265 | - | |||||||||||||||||||||||||
266 | return never executed: dir;return dir; never executed: return dir; | 0 | ||||||||||||||||||||||||
267 | } | - | ||||||||||||||||||||||||
268 | - | |||||||||||||||||||||||||
269 | - | |||||||||||||||||||||||||
270 | static bool bidiItemize(QTextEngine *engine, QScriptAnalysis *analysis, QBidiControl &control) | - | ||||||||||||||||||||||||
271 | { | - | ||||||||||||||||||||||||
272 | bool rightToLeft = (control.basicDirection() == 1); | - | ||||||||||||||||||||||||
273 | bool hasBidi = rightToLeft; | - | ||||||||||||||||||||||||
274 | - | |||||||||||||||||||||||||
275 | - | |||||||||||||||||||||||||
276 | - | |||||||||||||||||||||||||
277 | - | |||||||||||||||||||||||||
278 | int sor = 0; | - | ||||||||||||||||||||||||
279 | int eor = -1; | - | ||||||||||||||||||||||||
280 | - | |||||||||||||||||||||||||
281 | - | |||||||||||||||||||||||||
282 | int length = engine->layoutData->string.length(); | - | ||||||||||||||||||||||||
283 | - | |||||||||||||||||||||||||
284 | const ushort *unicode = (const ushort *)engine->layoutData->string.unicode(); | - | ||||||||||||||||||||||||
285 | int current = 0; | - | ||||||||||||||||||||||||
286 | - | |||||||||||||||||||||||||
287 | QChar::Direction dir = rightToLeft
| 0 | ||||||||||||||||||||||||
288 | QBidiStatus status; | - | ||||||||||||||||||||||||
289 | - | |||||||||||||||||||||||||
290 | QChar::Direction sdir = QChar::direction(*unicode); | - | ||||||||||||||||||||||||
291 | if (sdir != QChar::DirL
| 0 | ||||||||||||||||||||||||
292 | sdir = QChar::DirON; never executed: sdir = QChar::DirON; | 0 | ||||||||||||||||||||||||
293 | else | - | ||||||||||||||||||||||||
294 | dir = QChar::DirON; never executed: dir = QChar::DirON; | 0 | ||||||||||||||||||||||||
295 | status.eor = sdir; | - | ||||||||||||||||||||||||
296 | status.lastStrong = rightToLeft
| 0 | ||||||||||||||||||||||||
297 | status.last = status.lastStrong; | - | ||||||||||||||||||||||||
298 | status.dir = sdir; | - | ||||||||||||||||||||||||
299 | - | |||||||||||||||||||||||||
300 | - | |||||||||||||||||||||||||
301 | while (current <= length
| 0 | ||||||||||||||||||||||||
302 | - | |||||||||||||||||||||||||
303 | QChar::Direction dirCurrent; | - | ||||||||||||||||||||||||
304 | if (current == (int)length
| 0 | ||||||||||||||||||||||||
305 | dirCurrent = control.basicDirection(); never executed: dirCurrent = control.basicDirection(); | 0 | ||||||||||||||||||||||||
306 | else | - | ||||||||||||||||||||||||
307 | dirCurrent = QChar::direction(unicode[current]); never executed: dirCurrent = QChar::direction(unicode[current]); | 0 | ||||||||||||||||||||||||
308 | switch(dirCurrent) { | - | ||||||||||||||||||||||||
309 | - | |||||||||||||||||||||||||
310 | - | |||||||||||||||||||||||||
311 | case never executed: QChar::DirRLE:case QChar::DirRLE: never executed: case QChar::DirRLE: | 0 | ||||||||||||||||||||||||
312 | case never executed: QChar::DirRLO:case QChar::DirRLO: never executed: case QChar::DirRLO: | 0 | ||||||||||||||||||||||||
313 | case never executed: QChar::DirLRE:case QChar::DirLRE: never executed: case QChar::DirLRE: | 0 | ||||||||||||||||||||||||
314 | case never executed: QChar::DirLRO:case QChar::DirLRO: never executed: case QChar::DirLRO: | 0 | ||||||||||||||||||||||||
315 | { | - | ||||||||||||||||||||||||
316 | bool rtl = (dirCurrent == QChar::DirRLE
| 0 | ||||||||||||||||||||||||
317 | hasBidi |= rtl; | - | ||||||||||||||||||||||||
318 | bool override = (dirCurrent == QChar::DirLRO
| 0 | ||||||||||||||||||||||||
319 | - | |||||||||||||||||||||||||
320 | unsigned int level = control.level+1; | - | ||||||||||||||||||||||||
321 | if ((
never executed: level;++level; never executed: ++level; | 0 | ||||||||||||||||||||||||
322 | if(level < MaxBidiLevel
| 0 | ||||||||||||||||||||||||
323 | eor = current-1; | - | ||||||||||||||||||||||||
324 | appendItems(analysis, sor, eor, control, dir); | - | ||||||||||||||||||||||||
325 | eor = current; | - | ||||||||||||||||||||||||
326 | control.embed(rtl, override); | - | ||||||||||||||||||||||||
327 | QChar::Direction edir = (rtl
| 0 | ||||||||||||||||||||||||
328 | dir = status.eor = edir; | - | ||||||||||||||||||||||||
329 | status.lastStrong = edir; | - | ||||||||||||||||||||||||
330 | } never executed: end of block | 0 | ||||||||||||||||||||||||
331 | break; never executed: break; | 0 | ||||||||||||||||||||||||
332 | } | - | ||||||||||||||||||||||||
333 | case never executed: QChar::DirPDF:case QChar::DirPDF: never executed: case QChar::DirPDF: | 0 | ||||||||||||||||||||||||
334 | { | - | ||||||||||||||||||||||||
335 | if (control.canPop()
| 0 | ||||||||||||||||||||||||
336 | if (dir != control.direction()
| 0 | ||||||||||||||||||||||||
337 | eor = current-1; | - | ||||||||||||||||||||||||
338 | appendItems(analysis, sor, eor, control, dir); | - | ||||||||||||||||||||||||
339 | dir = control.direction(); | - | ||||||||||||||||||||||||
340 | } never executed: end of block | 0 | ||||||||||||||||||||||||
341 | eor = current; | - | ||||||||||||||||||||||||
342 | appendItems(analysis, sor, eor, control, dir); | - | ||||||||||||||||||||||||
343 | control.pdf(); | - | ||||||||||||||||||||||||
344 | dir = QChar::DirON; status.eor = QChar::DirON; | - | ||||||||||||||||||||||||
345 | status.last = control.direction(); | - | ||||||||||||||||||||||||
346 | if (control.override
| 0 | ||||||||||||||||||||||||
347 | dir = control.direction(); never executed: dir = control.direction(); | 0 | ||||||||||||||||||||||||
348 | else | - | ||||||||||||||||||||||||
349 | dir = QChar::DirON; never executed: dir = QChar::DirON; | 0 | ||||||||||||||||||||||||
350 | status.lastStrong = control.direction(); | - | ||||||||||||||||||||||||
351 | } never executed: end of block | 0 | ||||||||||||||||||||||||
352 | break; never executed: break; | 0 | ||||||||||||||||||||||||
353 | } | - | ||||||||||||||||||||||||
354 | - | |||||||||||||||||||||||||
355 | - | |||||||||||||||||||||||||
356 | case never executed: QChar::DirL:case QChar::DirL: never executed: case QChar::DirL: | 0 | ||||||||||||||||||||||||
357 | if(dir == QChar::DirON
| 0 | ||||||||||||||||||||||||
358 | dir = QChar::DirL; never executed: dir = QChar::DirL; | 0 | ||||||||||||||||||||||||
359 | switch(status.last) | - | ||||||||||||||||||||||||
360 | { | - | ||||||||||||||||||||||||
361 | case never executed: QChar::DirL:case QChar::DirL: never executed: case QChar::DirL: | 0 | ||||||||||||||||||||||||
362 | eor = current; status.eor = QChar::DirL; break; never executed: break; | 0 | ||||||||||||||||||||||||
363 | case never executed: QChar::DirR:case QChar::DirR: never executed: case QChar::DirR: | 0 | ||||||||||||||||||||||||
364 | case never executed: QChar::DirAL:case QChar::DirAL: never executed: case QChar::DirAL: | 0 | ||||||||||||||||||||||||
365 | case never executed: QChar::DirEN:case QChar::DirEN: never executed: case QChar::DirEN: | 0 | ||||||||||||||||||||||||
366 | case never executed: QChar::DirAN:case QChar::DirAN: never executed: case QChar::DirAN: | 0 | ||||||||||||||||||||||||
367 | if (eor >= 0
| 0 | ||||||||||||||||||||||||
368 | appendItems(analysis, sor, eor, control, dir); | - | ||||||||||||||||||||||||
369 | status.eor = dir = skipBoundryNeutrals(analysis, unicode, length, sor, eor, control); | - | ||||||||||||||||||||||||
370 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
371 | eor = current; status.eor = dir; | - | ||||||||||||||||||||||||
372 | } never executed: end of block | 0 | ||||||||||||||||||||||||
373 | break; never executed: break; | 0 | ||||||||||||||||||||||||
374 | case never executed: QChar::DirES:case QChar::DirES: never executed: case QChar::DirES: | 0 | ||||||||||||||||||||||||
375 | case never executed: QChar::DirET:case QChar::DirET: never executed: case QChar::DirET: | 0 | ||||||||||||||||||||||||
376 | case never executed: QChar::DirCS:case QChar::DirCS: never executed: case QChar::DirCS: | 0 | ||||||||||||||||||||||||
377 | case never executed: QChar::DirBN:case QChar::DirBN: never executed: case QChar::DirBN: | 0 | ||||||||||||||||||||||||
378 | case never executed: QChar::DirB:case QChar::DirB: never executed: case QChar::DirB: | 0 | ||||||||||||||||||||||||
379 | case never executed: QChar::DirS:case QChar::DirS: never executed: case QChar::DirS: | 0 | ||||||||||||||||||||||||
380 | case never executed: QChar::DirWS:case QChar::DirWS: never executed: case QChar::DirWS: | 0 | ||||||||||||||||||||||||
381 | case never executed: QChar::DirON:case QChar::DirON: never executed: case QChar::DirON: | 0 | ||||||||||||||||||||||||
382 | if(dir != QChar::DirL
| 0 | ||||||||||||||||||||||||
383 | - | |||||||||||||||||||||||||
384 | if(control.direction() == QChar::DirR
| 0 | ||||||||||||||||||||||||
385 | if(status.eor != QChar::DirR
| 0 | ||||||||||||||||||||||||
386 | - | |||||||||||||||||||||||||
387 | appendItems(analysis, sor, eor, control, dir); | - | ||||||||||||||||||||||||
388 | status.eor = QChar::DirON; | - | ||||||||||||||||||||||||
389 | dir = QChar::DirR; | - | ||||||||||||||||||||||||
390 | } never executed: end of block | 0 | ||||||||||||||||||||||||
391 | eor = current - 1; | - | ||||||||||||||||||||||||
392 | appendItems(analysis, sor, eor, control, dir); | - | ||||||||||||||||||||||||
393 | status.eor = dir = skipBoundryNeutrals(analysis, unicode, length, sor, eor, control); | - | ||||||||||||||||||||||||
394 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
395 | if(status.eor != QChar::DirL
| 0 | ||||||||||||||||||||||||
396 | appendItems(analysis, sor, eor, control, dir); | - | ||||||||||||||||||||||||
397 | status.eor = QChar::DirON; | - | ||||||||||||||||||||||||
398 | dir = QChar::DirL; | - | ||||||||||||||||||||||||
399 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
400 | eor = current; status.eor = QChar::DirL; break; never executed: break; | 0 | ||||||||||||||||||||||||
401 | } | - | ||||||||||||||||||||||||
402 | } | - | ||||||||||||||||||||||||
403 | } else { | - | ||||||||||||||||||||||||
404 | eor = current; status.eor = QChar::DirL; | - | ||||||||||||||||||||||||
405 | } never executed: end of block | 0 | ||||||||||||||||||||||||
406 | default never executed: :default: never executed: default: code before this statement never executed: default: | 0 | ||||||||||||||||||||||||
407 | break; never executed: break; | 0 | ||||||||||||||||||||||||
408 | } | - | ||||||||||||||||||||||||
409 | status.lastStrong = QChar::DirL; | - | ||||||||||||||||||||||||
410 | break; never executed: break; | 0 | ||||||||||||||||||||||||
411 | case never executed: QChar::DirAL:case QChar::DirAL: never executed: case QChar::DirAL: | 0 | ||||||||||||||||||||||||
412 | case never executed: QChar::DirR:case QChar::DirR: never executed: case QChar::DirR: | 0 | ||||||||||||||||||||||||
413 | hasBidi = true; | - | ||||||||||||||||||||||||
414 | if(dir == QChar::DirON
never executed: dir = QChar::DirR; | 0 | ||||||||||||||||||||||||
415 | switch(status.last) | - | ||||||||||||||||||||||||
416 | { | - | ||||||||||||||||||||||||
417 | case never executed: QChar::DirL:case QChar::DirL: never executed: case QChar::DirL: | 0 | ||||||||||||||||||||||||
418 | case never executed: QChar::DirEN:case QChar::DirEN: never executed: case QChar::DirEN: | 0 | ||||||||||||||||||||||||
419 | case never executed: QChar::DirAN:case QChar::DirAN: never executed: case QChar::DirAN: | 0 | ||||||||||||||||||||||||
420 | if (eor >= 0
| 0 | ||||||||||||||||||||||||
421 | appendItems(analysis, sor, eor, control, dir); never executed: appendItems(analysis, sor, eor, control, dir); | 0 | ||||||||||||||||||||||||
422 | - | |||||||||||||||||||||||||
423 | case never executed: QChar::DirR:case QChar::DirR: never executed: case QChar::DirR: code before this statement never executed: case QChar::DirR: | 0 | ||||||||||||||||||||||||
424 | case never executed: QChar::DirAL:case QChar::DirAL: never executed: case QChar::DirAL: | 0 | ||||||||||||||||||||||||
425 | dir = QChar::DirR; eor = current; status.eor = QChar::DirR; break; never executed: break; | 0 | ||||||||||||||||||||||||
426 | case never executed: QChar::DirES:case QChar::DirES: never executed: case QChar::DirES: | 0 | ||||||||||||||||||||||||
427 | case never executed: QChar::DirET:case QChar::DirET: never executed: case QChar::DirET: | 0 | ||||||||||||||||||||||||
428 | case never executed: QChar::DirCS:case QChar::DirCS: never executed: case QChar::DirCS: | 0 | ||||||||||||||||||||||||
429 | case never executed: QChar::DirBN:case QChar::DirBN: never executed: case QChar::DirBN: | 0 | ||||||||||||||||||||||||
430 | case never executed: QChar::DirB:case QChar::DirB: never executed: case QChar::DirB: | 0 | ||||||||||||||||||||||||
431 | case never executed: QChar::DirS:case QChar::DirS: never executed: case QChar::DirS: | 0 | ||||||||||||||||||||||||
432 | case never executed: QChar::DirWS:case QChar::DirWS: never executed: case QChar::DirWS: | 0 | ||||||||||||||||||||||||
433 | case never executed: QChar::DirON:case QChar::DirON: never executed: case QChar::DirON: | 0 | ||||||||||||||||||||||||
434 | if(status.eor != QChar::DirR
| 0 | ||||||||||||||||||||||||
435 | - | |||||||||||||||||||||||||
436 | if(control.direction() == QChar::DirR
| 0 | ||||||||||||||||||||||||
437 | || status.lastStrong == QChar::DirR
| 0 | ||||||||||||||||||||||||
438 | appendItems(analysis, sor, eor, control, dir); | - | ||||||||||||||||||||||||
439 | dir = QChar::DirR; status.eor = QChar::DirON; | - | ||||||||||||||||||||||||
440 | eor = current; | - | ||||||||||||||||||||||||
441 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
442 | eor = current - 1; | - | ||||||||||||||||||||||||
443 | appendItems(analysis, sor, eor, control, dir); | - | ||||||||||||||||||||||||
444 | dir = QChar::DirR; status.eor = QChar::DirON; | - | ||||||||||||||||||||||||
445 | } never executed: end of block | 0 | ||||||||||||||||||||||||
446 | } else { | - | ||||||||||||||||||||||||
447 | eor = current; status.eor = QChar::DirR; | - | ||||||||||||||||||||||||
448 | } never executed: end of block | 0 | ||||||||||||||||||||||||
449 | default never executed: :default: never executed: default: code before this statement never executed: default: | 0 | ||||||||||||||||||||||||
450 | break; never executed: break; | 0 | ||||||||||||||||||||||||
451 | } | - | ||||||||||||||||||||||||
452 | status.lastStrong = dirCurrent; | - | ||||||||||||||||||||||||
453 | break; never executed: break; | 0 | ||||||||||||||||||||||||
454 | - | |||||||||||||||||||||||||
455 | - | |||||||||||||||||||||||||
456 | - | |||||||||||||||||||||||||
457 | case never executed: QChar::DirNSM:case QChar::DirNSM: never executed: case QChar::DirNSM: | 0 | ||||||||||||||||||||||||
458 | if (eor == current-1
| 0 | ||||||||||||||||||||||||
459 | eor = current; never executed: eor = current; | 0 | ||||||||||||||||||||||||
460 | break; never executed: break; | 0 | ||||||||||||||||||||||||
461 | case never executed: QChar::DirEN:case QChar::DirEN: never executed: case QChar::DirEN: | 0 | ||||||||||||||||||||||||
462 | - | |||||||||||||||||||||||||
463 | if(status.lastStrong != QChar::DirAL
| 0 | ||||||||||||||||||||||||
464 | if(dir == QChar::DirON
| 0 | ||||||||||||||||||||||||
465 | if(status.lastStrong == QChar::DirL
| 0 | ||||||||||||||||||||||||
466 | dir = QChar::DirL; never executed: dir = QChar::DirL; | 0 | ||||||||||||||||||||||||
467 | else | - | ||||||||||||||||||||||||
468 | dir = QChar::DirEN; never executed: dir = QChar::DirEN; | 0 | ||||||||||||||||||||||||
469 | } | - | ||||||||||||||||||||||||
470 | switch(status.last) | - | ||||||||||||||||||||||||
471 | { | - | ||||||||||||||||||||||||
472 | case never executed: QChar::DirET:case QChar::DirET: never executed: case QChar::DirET: | 0 | ||||||||||||||||||||||||
473 | if (status.lastStrong == QChar::DirR
| 0 | ||||||||||||||||||||||||
474 | appendItems(analysis, sor, eor, control, dir); | - | ||||||||||||||||||||||||
475 | status.eor = QChar::DirON; | - | ||||||||||||||||||||||||
476 | dir = QChar::DirAN; | - | ||||||||||||||||||||||||
477 | } never executed: end of block | 0 | ||||||||||||||||||||||||
478 | - | |||||||||||||||||||||||||
479 | case never executed: QChar::DirEN:case QChar::DirEN: never executed: case QChar::DirEN: code before this statement never executed: case QChar::DirEN: | 0 | ||||||||||||||||||||||||
480 | case never executed: QChar::DirL:case QChar::DirL: never executed: case QChar::DirL: | 0 | ||||||||||||||||||||||||
481 | eor = current; | - | ||||||||||||||||||||||||
482 | status.eor = dirCurrent; | - | ||||||||||||||||||||||||
483 | break; never executed: break; | 0 | ||||||||||||||||||||||||
484 | case never executed: QChar::DirR:case QChar::DirR: never executed: case QChar::DirR: | 0 | ||||||||||||||||||||||||
485 | case never executed: QChar::DirAL:case QChar::DirAL: never executed: case QChar::DirAL: | 0 | ||||||||||||||||||||||||
486 | case never executed: QChar::DirAN:case QChar::DirAN: never executed: case QChar::DirAN: | 0 | ||||||||||||||||||||||||
487 | if (eor >= 0
| 0 | ||||||||||||||||||||||||
488 | appendItems(analysis, sor, eor, control, dir); never executed: appendItems(analysis, sor, eor, control, dir); | 0 | ||||||||||||||||||||||||
489 | else | - | ||||||||||||||||||||||||
490 | eor = current; never executed: eor = current; | 0 | ||||||||||||||||||||||||
491 | status.eor = QChar::DirEN; | - | ||||||||||||||||||||||||
492 | dir = QChar::DirAN; break; never executed: break; | 0 | ||||||||||||||||||||||||
493 | case never executed: QChar::DirES:case QChar::DirES: never executed: case QChar::DirES: | 0 | ||||||||||||||||||||||||
494 | case never executed: QChar::DirCS:case QChar::DirCS: never executed: case QChar::DirCS: | 0 | ||||||||||||||||||||||||
495 | if(status.eor == QChar::DirEN
| 0 | ||||||||||||||||||||||||
496 | eor = current; break; never executed: break; | 0 | ||||||||||||||||||||||||
497 | } | - | ||||||||||||||||||||||||
498 | case never executed: QChar::DirBN:case QChar::DirBN: never executed: case QChar::DirBN: code before this statement never executed: case QChar::DirBN: | 0 | ||||||||||||||||||||||||
499 | case never executed: QChar::DirB:case QChar::DirB: never executed: case QChar::DirB: | 0 | ||||||||||||||||||||||||
500 | case never executed: QChar::DirS:case QChar::DirS: never executed: case QChar::DirS: | 0 | ||||||||||||||||||||||||
501 | case never executed: QChar::DirWS:case QChar::DirWS: never executed: case QChar::DirWS: | 0 | ||||||||||||||||||||||||
502 | case never executed: QChar::DirON:case QChar::DirON: never executed: case QChar::DirON: | 0 | ||||||||||||||||||||||||
503 | if(status.eor == QChar::DirR
| 0 | ||||||||||||||||||||||||
504 | - | |||||||||||||||||||||||||
505 | eor = current - 1; | - | ||||||||||||||||||||||||
506 | appendItems(analysis, sor, eor, control, dir); | - | ||||||||||||||||||||||||
507 | dir = QChar::DirON; status.eor = QChar::DirEN; | - | ||||||||||||||||||||||||
508 | dir = QChar::DirAN; | - | ||||||||||||||||||||||||
509 | } never executed: end of block | 0 | ||||||||||||||||||||||||
510 | else if(status.eor == QChar::DirL
| 0 | ||||||||||||||||||||||||
511 | (status.eor == QChar::DirEN
| 0 | ||||||||||||||||||||||||
512 | eor = current; status.eor = dirCurrent; | - | ||||||||||||||||||||||||
513 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
514 | - | |||||||||||||||||||||||||
515 | if(dir != QChar::DirL
| 0 | ||||||||||||||||||||||||
516 | appendItems(analysis, sor, eor, control, dir); | - | ||||||||||||||||||||||||
517 | dir = QChar::DirON; status.eor = QChar::DirON; | - | ||||||||||||||||||||||||
518 | eor = current - 1; | - | ||||||||||||||||||||||||
519 | dir = QChar::DirR; | - | ||||||||||||||||||||||||
520 | appendItems(analysis, sor, eor, control, dir); | - | ||||||||||||||||||||||||
521 | dir = QChar::DirON; status.eor = QChar::DirON; | - | ||||||||||||||||||||||||
522 | dir = QChar::DirAN; | - | ||||||||||||||||||||||||
523 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
524 | eor = current; status.eor = dirCurrent; | - | ||||||||||||||||||||||||
525 | } never executed: end of block | 0 | ||||||||||||||||||||||||
526 | } | - | ||||||||||||||||||||||||
527 | default never executed: :default: never executed: default: code before this statement never executed: default: | 0 | ||||||||||||||||||||||||
528 | break; never executed: break; | 0 | ||||||||||||||||||||||||
529 | } | - | ||||||||||||||||||||||||
530 | break; never executed: break; | 0 | ||||||||||||||||||||||||
531 | } | - | ||||||||||||||||||||||||
532 | case never executed: QChar::DirAN:case QChar::DirAN: never executed: case QChar::DirAN: code before this statement never executed: case QChar::DirAN: | 0 | ||||||||||||||||||||||||
533 | hasBidi = true; | - | ||||||||||||||||||||||||
534 | dirCurrent = QChar::DirAN; | - | ||||||||||||||||||||||||
535 | if(dir == QChar::DirON
never executed: dir = QChar::DirAN; | 0 | ||||||||||||||||||||||||
536 | switch(status.last) | - | ||||||||||||||||||||||||
537 | { | - | ||||||||||||||||||||||||
538 | case never executed: QChar::DirL:case QChar::DirL: never executed: case QChar::DirL: | 0 | ||||||||||||||||||||||||
539 | case never executed: QChar::DirAN:case QChar::DirAN: never executed: case QChar::DirAN: | 0 | ||||||||||||||||||||||||
540 | eor = current; status.eor = QChar::DirAN; break; never executed: break; | 0 | ||||||||||||||||||||||||
541 | case never executed: QChar::DirR:case QChar::DirR: never executed: case QChar::DirR: | 0 | ||||||||||||||||||||||||
542 | case never executed: QChar::DirAL:case QChar::DirAL: never executed: case QChar::DirAL: | 0 | ||||||||||||||||||||||||
543 | case never executed: QChar::DirEN:case QChar::DirEN: never executed: case QChar::DirEN: | 0 | ||||||||||||||||||||||||
544 | if (eor >= 0
| 0 | ||||||||||||||||||||||||
545 | appendItems(analysis, sor, eor, control, dir); | - | ||||||||||||||||||||||||
546 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
547 | eor = current; | - | ||||||||||||||||||||||||
548 | } never executed: end of block | 0 | ||||||||||||||||||||||||
549 | dir = QChar::DirAN; status.eor = QChar::DirAN; | - | ||||||||||||||||||||||||
550 | break; never executed: break; | 0 | ||||||||||||||||||||||||
551 | case never executed: QChar::DirCS:case QChar::DirCS: never executed: case QChar::DirCS: | 0 | ||||||||||||||||||||||||
552 | if(status.eor == QChar::DirAN
| 0 | ||||||||||||||||||||||||
553 | eor = current; break; never executed: break; | 0 | ||||||||||||||||||||||||
554 | } | - | ||||||||||||||||||||||||
555 | case never executed: QChar::DirES:case QChar::DirES: never executed: case QChar::DirES: code before this statement never executed: case QChar::DirES: | 0 | ||||||||||||||||||||||||
556 | case never executed: QChar::DirET:case QChar::DirET: never executed: case QChar::DirET: | 0 | ||||||||||||||||||||||||
557 | case never executed: QChar::DirBN:case QChar::DirBN: never executed: case QChar::DirBN: | 0 | ||||||||||||||||||||||||
558 | case never executed: QChar::DirB:case QChar::DirB: never executed: case QChar::DirB: | 0 | ||||||||||||||||||||||||
559 | case never executed: QChar::DirS:case QChar::DirS: never executed: case QChar::DirS: | 0 | ||||||||||||||||||||||||
560 | case never executed: QChar::DirWS:case QChar::DirWS: never executed: case QChar::DirWS: | 0 | ||||||||||||||||||||||||
561 | case never executed: QChar::DirON:case QChar::DirON: never executed: case QChar::DirON: | 0 | ||||||||||||||||||||||||
562 | if(status.eor == QChar::DirR
| 0 | ||||||||||||||||||||||||
563 | - | |||||||||||||||||||||||||
564 | eor = current - 1; | - | ||||||||||||||||||||||||
565 | appendItems(analysis, sor, eor, control, dir); | - | ||||||||||||||||||||||||
566 | status.eor = QChar::DirAN; | - | ||||||||||||||||||||||||
567 | dir = QChar::DirAN; | - | ||||||||||||||||||||||||
568 | } never executed: else if(status.eor == QChar::DirLend of block
| 0 | ||||||||||||||||||||||||
569 | (status.eor == QChar::DirEN
| 0 | ||||||||||||||||||||||||
570 | eor = current; status.eor = dirCurrent; | - | ||||||||||||||||||||||||
571 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
572 | - | |||||||||||||||||||||||||
573 | if(dir != QChar::DirL
| 0 | ||||||||||||||||||||||||
574 | appendItems(analysis, sor, eor, control, dir); | - | ||||||||||||||||||||||||
575 | status.eor = QChar::DirON; | - | ||||||||||||||||||||||||
576 | eor = current - 1; | - | ||||||||||||||||||||||||
577 | dir = QChar::DirR; | - | ||||||||||||||||||||||||
578 | appendItems(analysis, sor, eor, control, dir); | - | ||||||||||||||||||||||||
579 | status.eor = QChar::DirAN; | - | ||||||||||||||||||||||||
580 | dir = QChar::DirAN; | - | ||||||||||||||||||||||||
581 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
582 | eor = current; status.eor = dirCurrent; | - | ||||||||||||||||||||||||
583 | } never executed: end of block | 0 | ||||||||||||||||||||||||
584 | } | - | ||||||||||||||||||||||||
585 | default never executed: :default: never executed: default: code before this statement never executed: default: | 0 | ||||||||||||||||||||||||
586 | break; never executed: break; | 0 | ||||||||||||||||||||||||
587 | } | - | ||||||||||||||||||||||||
588 | break; never executed: break; | 0 | ||||||||||||||||||||||||
589 | case never executed: QChar::DirES:case QChar::DirES: never executed: case QChar::DirES: | 0 | ||||||||||||||||||||||||
590 | case never executed: QChar::DirCS:case QChar::DirCS: never executed: case QChar::DirCS: | 0 | ||||||||||||||||||||||||
591 | break; never executed: break; | 0 | ||||||||||||||||||||||||
592 | case never executed: QChar::DirET:case QChar::DirET: never executed: case QChar::DirET: | 0 | ||||||||||||||||||||||||
593 | if(status.last == QChar::DirEN
| 0 | ||||||||||||||||||||||||
594 | dirCurrent = QChar::DirEN; | - | ||||||||||||||||||||||||
595 | eor = current; status.eor = dirCurrent; | - | ||||||||||||||||||||||||
596 | } never executed: end of block | 0 | ||||||||||||||||||||||||
597 | break; never executed: break; | 0 | ||||||||||||||||||||||||
598 | - | |||||||||||||||||||||||||
599 | - | |||||||||||||||||||||||||
600 | case never executed: QChar::DirBN:case QChar::DirBN: never executed: case QChar::DirBN: | 0 | ||||||||||||||||||||||||
601 | break; never executed: break; | 0 | ||||||||||||||||||||||||
602 | - | |||||||||||||||||||||||||
603 | case never executed: QChar::DirB:case QChar::DirB: never executed: case QChar::DirB: | 0 | ||||||||||||||||||||||||
604 | - | |||||||||||||||||||||||||
605 | break; never executed: break; | 0 | ||||||||||||||||||||||||
606 | case never executed: QChar::DirS:case QChar::DirS: never executed: case QChar::DirS: | 0 | ||||||||||||||||||||||||
607 | - | |||||||||||||||||||||||||
608 | break; never executed: break; | 0 | ||||||||||||||||||||||||
609 | case never executed: QChar::DirWS:case QChar::DirWS: never executed: case QChar::DirWS: | 0 | ||||||||||||||||||||||||
610 | case never executed: QChar::DirON:case QChar::DirON: never executed: case QChar::DirON: | 0 | ||||||||||||||||||||||||
611 | break; never executed: break; | 0 | ||||||||||||||||||||||||
612 | default never executed: :default: never executed: default: | 0 | ||||||||||||||||||||||||
613 | break; never executed: break; | 0 | ||||||||||||||||||||||||
614 | } | - | ||||||||||||||||||||||||
615 | - | |||||||||||||||||||||||||
616 | - | |||||||||||||||||||||||||
617 | - | |||||||||||||||||||||||||
618 | if(current >= (int)length
never executed: break; | 0 | ||||||||||||||||||||||||
619 | - | |||||||||||||||||||||||||
620 | - | |||||||||||||||||||||||||
621 | switch(dirCurrent) { | - | ||||||||||||||||||||||||
622 | case never executed: QChar::DirET:case QChar::DirET: never executed: case QChar::DirET: | 0 | ||||||||||||||||||||||||
623 | case never executed: QChar::DirES:case QChar::DirES: never executed: case QChar::DirES: | 0 | ||||||||||||||||||||||||
624 | case never executed: QChar::DirCS:case QChar::DirCS: never executed: case QChar::DirCS: | 0 | ||||||||||||||||||||||||
625 | case never executed: QChar::DirS:case QChar::DirS: never executed: case QChar::DirS: | 0 | ||||||||||||||||||||||||
626 | case never executed: QChar::DirWS:case QChar::DirWS: never executed: case QChar::DirWS: | 0 | ||||||||||||||||||||||||
627 | case never executed: QChar::DirON:case QChar::DirON: never executed: case QChar::DirON: | 0 | ||||||||||||||||||||||||
628 | switch(status.last) | - | ||||||||||||||||||||||||
629 | { | - | ||||||||||||||||||||||||
630 | case never executed: QChar::DirL:case QChar::DirL: never executed: case QChar::DirL: | 0 | ||||||||||||||||||||||||
631 | case never executed: QChar::DirR:case QChar::DirR: never executed: case QChar::DirR: | 0 | ||||||||||||||||||||||||
632 | case never executed: QChar::DirAL:case QChar::DirAL: never executed: case QChar::DirAL: | 0 | ||||||||||||||||||||||||
633 | case never executed: QChar::DirEN:case QChar::DirEN: never executed: case QChar::DirEN: | 0 | ||||||||||||||||||||||||
634 | case never executed: QChar::DirAN:case QChar::DirAN: never executed: case QChar::DirAN: | 0 | ||||||||||||||||||||||||
635 | status.last = dirCurrent; | - | ||||||||||||||||||||||||
636 | break; never executed: break; | 0 | ||||||||||||||||||||||||
637 | default never executed: :default: never executed: default: | 0 | ||||||||||||||||||||||||
638 | status.last = QChar::DirON; | - | ||||||||||||||||||||||||
639 | } never executed: end of block | 0 | ||||||||||||||||||||||||
640 | break; never executed: break; | 0 | ||||||||||||||||||||||||
641 | case never executed: QChar::DirNSM:case QChar::DirNSM: never executed: case QChar::DirNSM: | 0 | ||||||||||||||||||||||||
642 | case never executed: QChar::DirBN:case QChar::DirBN: never executed: case QChar::DirBN: | 0 | ||||||||||||||||||||||||
643 | - | |||||||||||||||||||||||||
644 | break; never executed: break; | 0 | ||||||||||||||||||||||||
645 | case never executed: QChar::DirLRO:case QChar::DirLRO: never executed: case QChar::DirLRO: | 0 | ||||||||||||||||||||||||
646 | case never executed: QChar::DirLRE:case QChar::DirLRE: never executed: case QChar::DirLRE: | 0 | ||||||||||||||||||||||||
647 | status.last = QChar::DirL; | - | ||||||||||||||||||||||||
648 | break; never executed: break; | 0 | ||||||||||||||||||||||||
649 | case never executed: QChar::DirRLO:case QChar::DirRLO: never executed: case QChar::DirRLO: | 0 | ||||||||||||||||||||||||
650 | case never executed: QChar::DirRLE:case QChar::DirRLE: never executed: case QChar::DirRLE: | 0 | ||||||||||||||||||||||||
651 | status.last = QChar::DirR; | - | ||||||||||||||||||||||||
652 | break; never executed: break; | 0 | ||||||||||||||||||||||||
653 | case never executed: QChar::DirEN:case QChar::DirEN: never executed: case QChar::DirEN: | 0 | ||||||||||||||||||||||||
654 | if (status.last == QChar::DirL
| 0 | ||||||||||||||||||||||||
655 | status.last = QChar::DirL; | - | ||||||||||||||||||||||||
656 | break; never executed: break; | 0 | ||||||||||||||||||||||||
657 | } | - | ||||||||||||||||||||||||
658 | - | |||||||||||||||||||||||||
659 | default never executed: :default: never executed: default: code before this statement never executed: default: | 0 | ||||||||||||||||||||||||
660 | status.last = dirCurrent; | - | ||||||||||||||||||||||||
661 | } never executed: end of block | 0 | ||||||||||||||||||||||||
662 | - | |||||||||||||||||||||||||
663 | ++current; | - | ||||||||||||||||||||||||
664 | } never executed: end of block | 0 | ||||||||||||||||||||||||
665 | - | |||||||||||||||||||||||||
666 | - | |||||||||||||||||||||||||
667 | - | |||||||||||||||||||||||||
668 | - | |||||||||||||||||||||||||
669 | eor = current - 1; | - | ||||||||||||||||||||||||
670 | - | |||||||||||||||||||||||||
671 | if (sor <= eor
| 0 | ||||||||||||||||||||||||
672 | appendItems(analysis, sor, eor, control, dir); never executed: appendItems(analysis, sor, eor, control, dir); | 0 | ||||||||||||||||||||||||
673 | - | |||||||||||||||||||||||||
674 | return never executed: hasBidi;return hasBidi; never executed: return hasBidi; | 0 | ||||||||||||||||||||||||
675 | } | - | ||||||||||||||||||||||||
676 | - | |||||||||||||||||||||||||
677 | void QTextEngine::bidiReorder(int numItems, const quint8 *levels, int *visualOrder) | - | ||||||||||||||||||||||||
678 | { | - | ||||||||||||||||||||||||
679 | - | |||||||||||||||||||||||||
680 | - | |||||||||||||||||||||||||
681 | quint8 levelLow = 128; | - | ||||||||||||||||||||||||
682 | quint8 levelHigh = 0; | - | ||||||||||||||||||||||||
683 | int i = 0; | - | ||||||||||||||||||||||||
684 | while (i < numItems
| 0 | ||||||||||||||||||||||||
685 | - | |||||||||||||||||||||||||
686 | if (levels[i] > levelHigh
| 0 | ||||||||||||||||||||||||
687 | levelHigh = levels[i]; never executed: levelHigh = levels[i]; | 0 | ||||||||||||||||||||||||
688 | if (levels[i] < levelLow
| 0 | ||||||||||||||||||||||||
689 | levelLow = levels[i]; never executed: levelLow = levels[i]; | 0 | ||||||||||||||||||||||||
690 | i++; | - | ||||||||||||||||||||||||
691 | } never executed: end of block | 0 | ||||||||||||||||||||||||
692 | - | |||||||||||||||||||||||||
693 | - | |||||||||||||||||||||||||
694 | - | |||||||||||||||||||||||||
695 | - | |||||||||||||||||||||||||
696 | - | |||||||||||||||||||||||||
697 | - | |||||||||||||||||||||||||
698 | if(!(levelLow%2)
never executed: levelLow++; | 0 | ||||||||||||||||||||||||
699 | - | |||||||||||||||||||||||||
700 | - | |||||||||||||||||||||||||
701 | - | |||||||||||||||||||||||||
702 | - | |||||||||||||||||||||||||
703 | - | |||||||||||||||||||||||||
704 | int count = numItems - 1; | - | ||||||||||||||||||||||||
705 | for (i = 0; i < numItems
| 0 | ||||||||||||||||||||||||
706 | visualOrder[i] = i; never executed: visualOrder[i] = i; | 0 | ||||||||||||||||||||||||
707 | - | |||||||||||||||||||||||||
708 | while(levelHigh >= levelLow
| 0 | ||||||||||||||||||||||||
709 | int i = 0; | - | ||||||||||||||||||||||||
710 | while (i < count
| 0 | ||||||||||||||||||||||||
711 | while(i < count
never executed: i++; | 0 | ||||||||||||||||||||||||
712 | int start = i; | - | ||||||||||||||||||||||||
713 | while(i <= count
never executed: i++; | 0 | ||||||||||||||||||||||||
714 | int end = i-1; | - | ||||||||||||||||||||||||
715 | - | |||||||||||||||||||||||||
716 | if(start != end
| 0 | ||||||||||||||||||||||||
717 | - | |||||||||||||||||||||||||
718 | for(int j = 0; j < (end-start+1)/2
| 0 | ||||||||||||||||||||||||
719 | int tmp = visualOrder[start+j]; | - | ||||||||||||||||||||||||
720 | visualOrder[start+j] = visualOrder[end-j]; | - | ||||||||||||||||||||||||
721 | visualOrder[end-j] = tmp; | - | ||||||||||||||||||||||||
722 | } never executed: end of block | 0 | ||||||||||||||||||||||||
723 | } never executed: end of block | 0 | ||||||||||||||||||||||||
724 | i++; | - | ||||||||||||||||||||||||
725 | } never executed: end of block | 0 | ||||||||||||||||||||||||
726 | levelHigh--; | - | ||||||||||||||||||||||||
727 | } never executed: end of block | 0 | ||||||||||||||||||||||||
728 | - | |||||||||||||||||||||||||
729 | - | |||||||||||||||||||||||||
730 | - | |||||||||||||||||||||||||
731 | - | |||||||||||||||||||||||||
732 | - | |||||||||||||||||||||||||
733 | - | |||||||||||||||||||||||||
734 | } never executed: end of block | 0 | ||||||||||||||||||||||||
735 | - | |||||||||||||||||||||||||
736 | - | |||||||||||||||||||||||||
737 | enum JustificationClass { | - | ||||||||||||||||||||||||
738 | Justification_Prohibited = 0, | - | ||||||||||||||||||||||||
739 | Justification_Arabic_Space = 1, | - | ||||||||||||||||||||||||
740 | Justification_Character = 2, | - | ||||||||||||||||||||||||
741 | Justification_Space = 4, | - | ||||||||||||||||||||||||
742 | Justification_Arabic_Normal = 7, | - | ||||||||||||||||||||||||
743 | Justification_Arabic_Waw = 8, | - | ||||||||||||||||||||||||
744 | Justification_Arabic_BaRa = 9, | - | ||||||||||||||||||||||||
745 | Justification_Arabic_Alef = 10, | - | ||||||||||||||||||||||||
746 | Justification_Arabic_HahDal = 11, | - | ||||||||||||||||||||||||
747 | Justification_Arabic_Seen = 12, | - | ||||||||||||||||||||||||
748 | Justification_Arabic_Kashida = 13 | - | ||||||||||||||||||||||||
749 | }; | - | ||||||||||||||||||||||||
750 | - | |||||||||||||||||||||||||
751 | - | |||||||||||||||||||||||||
752 | - | |||||||||||||||||||||||||
753 | - | |||||||||||||||||||||||||
754 | - | |||||||||||||||||||||||||
755 | - | |||||||||||||||||||||||||
756 | - | |||||||||||||||||||||||||
757 | static inline void qt_getDefaultJustificationOpportunities(const ushort *string, int length, QGlyphLayout g, ushort *log_clusters, int spaceAs) | - | ||||||||||||||||||||||||
758 | { | - | ||||||||||||||||||||||||
759 | int str_pos = 0; | - | ||||||||||||||||||||||||
760 | while (str_pos < length
| 0 | ||||||||||||||||||||||||
761 | int glyph_pos = log_clusters[str_pos]; | - | ||||||||||||||||||||||||
762 | - | |||||||||||||||||||||||||
763 | ((!(glyph_pos < g.numGlyphs && g.attributes[glyph_pos].clusterStart)) ? qt_assert("glyph_pos < g.numGlyphs && g.attributes[glyph_pos].clusterStart",__FILE__,852) : qt_noop()); | - | ||||||||||||||||||||||||
764 | - | |||||||||||||||||||||||||
765 | uint ucs4 = string[str_pos]; | - | ||||||||||||||||||||||||
766 | if (QChar::isHighSurrogate(ucs4)
| 0 | ||||||||||||||||||||||||
767 | ushort low = string[str_pos + 1]; | - | ||||||||||||||||||||||||
768 | if (QChar::isLowSurrogate(low)
| 0 | ||||||||||||||||||||||||
769 | ++str_pos; | - | ||||||||||||||||||||||||
770 | ucs4 = QChar::surrogateToUcs4(ucs4, low); | - | ||||||||||||||||||||||||
771 | } never executed: end of block | 0 | ||||||||||||||||||||||||
772 | } never executed: end of block | 0 | ||||||||||||||||||||||||
773 | - | |||||||||||||||||||||||||
774 | - | |||||||||||||||||||||||||
775 | do { | - | ||||||||||||||||||||||||
776 | ++str_pos; | - | ||||||||||||||||||||||||
777 | } never executed: while (str_pos < lengthend of block
| 0 | ||||||||||||||||||||||||
778 | do { | - | ||||||||||||||||||||||||
779 | ++glyph_pos; | - | ||||||||||||||||||||||||
780 | } never executed: while (glyph_pos < g.numGlyphsend of block
| 0 | ||||||||||||||||||||||||
781 | --glyph_pos; | - | ||||||||||||||||||||||||
782 | - | |||||||||||||||||||||||||
783 | - | |||||||||||||||||||||||||
784 | if (__builtin_expect(!!(QChar::isLetterOrNumber(ucs4)), true)
| 0 | ||||||||||||||||||||||||
785 | g.attributes[glyph_pos].justification = Justification_Character; never executed: g.attributes[glyph_pos].justification = Justification_Character; | 0 | ||||||||||||||||||||||||
786 | else if (__builtin_expect(!!(QChar::isSpace(ucs4)), true)
| 0 | ||||||||||||||||||||||||
787 | g.attributes[glyph_pos].justification = spaceAs; never executed: g.attributes[glyph_pos].justification = spaceAs; | 0 | ||||||||||||||||||||||||
788 | } never executed: end of block | 0 | ||||||||||||||||||||||||
789 | } never executed: end of block | 0 | ||||||||||||||||||||||||
790 | - | |||||||||||||||||||||||||
791 | static inline void qt_getJustificationOpportunities(const ushort *string, int length, const QScriptItem &si, QGlyphLayout g, ushort *log_clusters) | - | ||||||||||||||||||||||||
792 | { | - | ||||||||||||||||||||||||
793 | ((!(length > 0 && g.numGlyphs > 0)) ? qt_assert("length > 0 && g.numGlyphs > 0",__FILE__,882) : qt_noop()); | - | ||||||||||||||||||||||||
794 | - | |||||||||||||||||||||||||
795 | for (int glyph_pos = 0; glyph_pos < g.numGlyphs
| 0 | ||||||||||||||||||||||||
796 | g.attributes[glyph_pos].justification = Justification_Prohibited; never executed: g.attributes[glyph_pos].justification = Justification_Prohibited; | 0 | ||||||||||||||||||||||||
797 | - | |||||||||||||||||||||||||
798 | int spaceAs; | - | ||||||||||||||||||||||||
799 | - | |||||||||||||||||||||||||
800 | switch (si.analysis.script) { | - | ||||||||||||||||||||||||
801 | case never executed: QChar::Script_Arabic:case QChar::Script_Arabic: never executed: case QChar::Script_Arabic: | 0 | ||||||||||||||||||||||||
802 | case never executed: QChar::Script_Syriac:case QChar::Script_Syriac: never executed: case QChar::Script_Syriac: | 0 | ||||||||||||||||||||||||
803 | case never executed: QChar::Script_Nko:case QChar::Script_Nko: never executed: case QChar::Script_Nko: | 0 | ||||||||||||||||||||||||
804 | case never executed: QChar::Script_Mandaic:case QChar::Script_Mandaic: never executed: case QChar::Script_Mandaic: | 0 | ||||||||||||||||||||||||
805 | case never executed: QChar::Script_Mongolian:case QChar::Script_Mongolian: never executed: case QChar::Script_Mongolian: | 0 | ||||||||||||||||||||||||
806 | case never executed: QChar::Script_PhagsPa:case QChar::Script_PhagsPa: never executed: case QChar::Script_PhagsPa: | 0 | ||||||||||||||||||||||||
807 | case never executed: QChar::Script_Manichaean:case QChar::Script_Manichaean: never executed: case QChar::Script_Manichaean: | 0 | ||||||||||||||||||||||||
808 | case never executed: QChar::Script_PsalterPahlavi:case QChar::Script_PsalterPahlavi: never executed: case QChar::Script_PsalterPahlavi: | 0 | ||||||||||||||||||||||||
809 | - | |||||||||||||||||||||||||
810 | spaceAs = Justification_Arabic_Space; | - | ||||||||||||||||||||||||
811 | break; never executed: break; | 0 | ||||||||||||||||||||||||
812 | - | |||||||||||||||||||||||||
813 | case never executed: QChar::Script_Tibetan:case QChar::Script_Tibetan: never executed: case QChar::Script_Tibetan: | 0 | ||||||||||||||||||||||||
814 | case never executed: QChar::Script_Hiragana:case QChar::Script_Hiragana: never executed: case QChar::Script_Hiragana: | 0 | ||||||||||||||||||||||||
815 | case never executed: QChar::Script_Katakana:case QChar::Script_Katakana: never executed: case QChar::Script_Katakana: | 0 | ||||||||||||||||||||||||
816 | case never executed: QChar::Script_Bopomofo:case QChar::Script_Bopomofo: never executed: case QChar::Script_Bopomofo: | 0 | ||||||||||||||||||||||||
817 | case never executed: QChar::Script_Han:case QChar::Script_Han: never executed: case QChar::Script_Han: | 0 | ||||||||||||||||||||||||
818 | - | |||||||||||||||||||||||||
819 | spaceAs = Justification_Character; | - | ||||||||||||||||||||||||
820 | break; never executed: break; | 0 | ||||||||||||||||||||||||
821 | - | |||||||||||||||||||||||||
822 | default never executed: :default: never executed: default: | 0 | ||||||||||||||||||||||||
823 | spaceAs = Justification_Space; | - | ||||||||||||||||||||||||
824 | break; never executed: break; | 0 | ||||||||||||||||||||||||
825 | } | - | ||||||||||||||||||||||||
826 | - | |||||||||||||||||||||||||
827 | qt_getDefaultJustificationOpportunities(string, length, g, log_clusters, spaceAs); | - | ||||||||||||||||||||||||
828 | } never executed: end of block | 0 | ||||||||||||||||||||||||
829 | - | |||||||||||||||||||||||||
830 | - | |||||||||||||||||||||||||
831 | - | |||||||||||||||||||||||||
832 | - | |||||||||||||||||||||||||
833 | - | |||||||||||||||||||||||||
834 | void QTextEngine::shapeLine(const QScriptLine &line) | - | ||||||||||||||||||||||||
835 | { | - | ||||||||||||||||||||||||
836 | QFixed x; | - | ||||||||||||||||||||||||
837 | bool first = true; | - | ||||||||||||||||||||||||
838 | int item = findItem(line.from); | - | ||||||||||||||||||||||||
839 | if (item == -1
| 0 | ||||||||||||||||||||||||
840 | return; never executed: return; | 0 | ||||||||||||||||||||||||
841 | - | |||||||||||||||||||||||||
842 | const int end = findItem(line.from + line.length + line.trailingSpaces - 1, item); | - | ||||||||||||||||||||||||
843 | for ( ; item <= end
| 0 | ||||||||||||||||||||||||
844 | QScriptItem &si = layoutData->items[item]; | - | ||||||||||||||||||||||||
845 | if (si.analysis.flags == QScriptAnalysis::Tab
| 0 | ||||||||||||||||||||||||
846 | ensureSpace(1); | - | ||||||||||||||||||||||||
847 | si.width = calculateTabWidth(item, x); | - | ||||||||||||||||||||||||
848 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
849 | shape(item); | - | ||||||||||||||||||||||||
850 | } never executed: end of block | 0 | ||||||||||||||||||||||||
851 | if (first
| 0 | ||||||||||||||||||||||||
852 | QGlyphLayout glyphs = shapedGlyphs(&si); | - | ||||||||||||||||||||||||
853 | ((!(line.from > si.position)) ? qt_assert("line.from > si.position",__FILE__,942) : qt_noop()); | - | ||||||||||||||||||||||||
854 | for (int i = line.from - si.position - 1; i >= 0
| 0 | ||||||||||||||||||||||||
855 | x -= glyphs.effectiveAdvance(i); | - | ||||||||||||||||||||||||
856 | } never executed: end of block | 0 | ||||||||||||||||||||||||
857 | } never executed: end of block | 0 | ||||||||||||||||||||||||
858 | first = false; | - | ||||||||||||||||||||||||
859 | - | |||||||||||||||||||||||||
860 | x += si.width; | - | ||||||||||||||||||||||||
861 | } never executed: end of block | 0 | ||||||||||||||||||||||||
862 | } never executed: end of block | 0 | ||||||||||||||||||||||||
863 | - | |||||||||||||||||||||||||
864 | - | |||||||||||||||||||||||||
865 | extern bool qt_useHarfbuzzNG(); | - | ||||||||||||||||||||||||
866 | - | |||||||||||||||||||||||||
867 | - | |||||||||||||||||||||||||
868 | void QTextEngine::shapeText(int item) const | - | ||||||||||||||||||||||||
869 | { | - | ||||||||||||||||||||||||
870 | ((!(item < layoutData->items.size())) ? qt_assert("item < layoutData->items.size()",__FILE__,959) : qt_noop()); | - | ||||||||||||||||||||||||
871 | QScriptItem &si = layoutData->items[item]; | - | ||||||||||||||||||||||||
872 | - | |||||||||||||||||||||||||
873 | if (si.num_glyphs
| 0 | ||||||||||||||||||||||||
874 | return; never executed: return; | 0 | ||||||||||||||||||||||||
875 | - | |||||||||||||||||||||||||
876 | si.width = 0; | - | ||||||||||||||||||||||||
877 | si.glyph_data_offset = layoutData->used; | - | ||||||||||||||||||||||||
878 | - | |||||||||||||||||||||||||
879 | const ushort *string = reinterpret_cast<const ushort *>(layoutData->string.constData()) + si.position; | - | ||||||||||||||||||||||||
880 | const int itemLength = length(item); | - | ||||||||||||||||||||||||
881 | - | |||||||||||||||||||||||||
882 | QString casedString; | - | ||||||||||||||||||||||||
883 | if (si.analysis.flags
| 0 | ||||||||||||||||||||||||
884 | casedString.resize(itemLength); | - | ||||||||||||||||||||||||
885 | ushort *uc = reinterpret_cast<ushort *>(casedString.data()); | - | ||||||||||||||||||||||||
886 | for (int i = 0; i < itemLength
| 0 | ||||||||||||||||||||||||
887 | uint ucs4 = string[i]; | - | ||||||||||||||||||||||||
888 | if (QChar::isHighSurrogate(ucs4)
| 0 | ||||||||||||||||||||||||
889 | uint low = string[i + 1]; | - | ||||||||||||||||||||||||
890 | if (QChar::isLowSurrogate(low)
| 0 | ||||||||||||||||||||||||
891 | ++i; | - | ||||||||||||||||||||||||
892 | ucs4 = QChar::surrogateToUcs4(ucs4, low); | - | ||||||||||||||||||||||||
893 | ucs4 = si.analysis.flags == QScriptAnalysis::Lowercase
| 0 | ||||||||||||||||||||||||
894 | : QChar::toUpper(ucs4); | - | ||||||||||||||||||||||||
895 | - | |||||||||||||||||||||||||
896 | uc[i] = QChar::lowSurrogate(ucs4); | - | ||||||||||||||||||||||||
897 | } never executed: end of block | 0 | ||||||||||||||||||||||||
898 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
899 | uc[i] = si.analysis.flags == QScriptAnalysis::Lowercase
| 0 | ||||||||||||||||||||||||
900 | : QChar::toUpper(ucs4); | - | ||||||||||||||||||||||||
901 | } never executed: end of block | 0 | ||||||||||||||||||||||||
902 | } | - | ||||||||||||||||||||||||
903 | string = reinterpret_cast<const ushort *>(casedString.constData()); | - | ||||||||||||||||||||||||
904 | } never executed: end of block | 0 | ||||||||||||||||||||||||
905 | - | |||||||||||||||||||||||||
906 | if (__builtin_expect(!!(!ensureSpace(itemLength)), false)
| 0 | ||||||||||||||||||||||||
907 | do { ((!(false)) ? qt_assert_x("Q_UNREACHABLE()", "Q_UNREACHABLE was reached",__FILE__,996) : qt_noop()); __builtin_unreachable(); } while (0); | - | ||||||||||||||||||||||||
908 | return; never executed: return; | 0 | ||||||||||||||||||||||||
909 | } | - | ||||||||||||||||||||||||
910 | - | |||||||||||||||||||||||||
911 | QFontEngine *fontEngine = this->fontEngine(si, &si.ascent, &si.descent, &si.leading); | - | ||||||||||||||||||||||||
912 | - | |||||||||||||||||||||||||
913 | - | |||||||||||||||||||||||||
914 | - | |||||||||||||||||||||||||
915 | QVector<uint> itemBoundaries; | - | ||||||||||||||||||||||||
916 | itemBoundaries.reserve(24); | - | ||||||||||||||||||||||||
917 | if (fontEngine->type() == QFontEngine::Multi
| 0 | ||||||||||||||||||||||||
918 | - | |||||||||||||||||||||||||
919 | - | |||||||||||||||||||||||||
920 | QGlyphLayout initialGlyphs = availableGlyphs(&si); | - | ||||||||||||||||||||||||
921 | - | |||||||||||||||||||||||||
922 | int nGlyphs = initialGlyphs.numGlyphs; | - | ||||||||||||||||||||||||
923 | QFontEngine::ShaperFlags shaperFlags(QFontEngine::GlyphIndicesOnly); | - | ||||||||||||||||||||||||
924 | if (!fontEngine->stringToCMap(reinterpret_cast<const QChar *>(string), itemLength, &initialGlyphs, &nGlyphs, shaperFlags)
| 0 | ||||||||||||||||||||||||
925 | do { ((!(false)) ? qt_assert_x("Q_UNREACHABLE()", "Q_UNREACHABLE was reached",__FILE__,1014) : qt_noop()); __builtin_unreachable(); } never executed: while (0);end of block | 0 | ||||||||||||||||||||||||
926 | - | |||||||||||||||||||||||||
927 | uint lastEngine = ~0u; | - | ||||||||||||||||||||||||
928 | for (int i = 0, glyph_pos = 0; i < itemLength
| 0 | ||||||||||||||||||||||||
929 | const uint engineIdx = initialGlyphs.glyphs[glyph_pos] >> 24; | - | ||||||||||||||||||||||||
930 | if (lastEngine != engineIdx
| 0 | ||||||||||||||||||||||||
931 | itemBoundaries.append(i); | - | ||||||||||||||||||||||||
932 | itemBoundaries.append(glyph_pos); | - | ||||||||||||||||||||||||
933 | itemBoundaries.append(engineIdx); | - | ||||||||||||||||||||||||
934 | - | |||||||||||||||||||||||||
935 | if (engineIdx != 0
| 0 | ||||||||||||||||||||||||
936 | QFontEngine *actualFontEngine = static_cast<QFontEngineMulti *>(fontEngine)->engine(engineIdx); | - | ||||||||||||||||||||||||
937 | si.ascent = qMax(actualFontEngine->ascent(), si.ascent); | - | ||||||||||||||||||||||||
938 | si.descent = qMax(actualFontEngine->descent(), si.descent); | - | ||||||||||||||||||||||||
939 | si.leading = qMax(actualFontEngine->leading(), si.leading); | - | ||||||||||||||||||||||||
940 | } never executed: end of block | 0 | ||||||||||||||||||||||||
941 | - | |||||||||||||||||||||||||
942 | lastEngine = engineIdx; | - | ||||||||||||||||||||||||
943 | } never executed: end of block | 0 | ||||||||||||||||||||||||
944 | - | |||||||||||||||||||||||||
945 | if (QChar::isHighSurrogate(string[i])
| 0 | ||||||||||||||||||||||||
946 | ++ never executed: i;++i; never executed: ++i; | 0 | ||||||||||||||||||||||||
947 | } never executed: end of block | 0 | ||||||||||||||||||||||||
948 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
949 | itemBoundaries.append(0); | - | ||||||||||||||||||||||||
950 | itemBoundaries.append(0); | - | ||||||||||||||||||||||||
951 | itemBoundaries.append(0); | - | ||||||||||||||||||||||||
952 | } never executed: end of block | 0 | ||||||||||||||||||||||||
953 | - | |||||||||||||||||||||||||
954 | bool kerningEnabled; | - | ||||||||||||||||||||||||
955 | bool letterSpacingIsAbsolute; | - | ||||||||||||||||||||||||
956 | QFixed letterSpacing, wordSpacing; | - | ||||||||||||||||||||||||
957 | - | |||||||||||||||||||||||||
958 | if (useRawFont
| 0 | ||||||||||||||||||||||||
959 | QTextCharFormat f = format(&si); | - | ||||||||||||||||||||||||
960 | kerningEnabled = f.fontKerning(); | - | ||||||||||||||||||||||||
961 | wordSpacing = QFixed::fromReal(f.fontWordSpacing()); | - | ||||||||||||||||||||||||
962 | letterSpacing = QFixed::fromReal(f.fontLetterSpacing()); | - | ||||||||||||||||||||||||
963 | letterSpacingIsAbsolute = true; | - | ||||||||||||||||||||||||
964 | } never executed: elseend of block | 0 | ||||||||||||||||||||||||
965 | - | |||||||||||||||||||||||||
966 | { | - | ||||||||||||||||||||||||
967 | QFont font = this->font(si); | - | ||||||||||||||||||||||||
968 | kerningEnabled = font.d->kerning; | - | ||||||||||||||||||||||||
969 | letterSpacingIsAbsolute = font.d->letterSpacingIsAbsolute; | - | ||||||||||||||||||||||||
970 | letterSpacing = font.d->letterSpacing; | - | ||||||||||||||||||||||||
971 | wordSpacing = font.d->wordSpacing; | - | ||||||||||||||||||||||||
972 | - | |||||||||||||||||||||||||
973 | if (letterSpacingIsAbsolute
| 0 | ||||||||||||||||||||||||
974 | letterSpacing *= font.d->dpi / qt_defaultDpiY(); never executed: letterSpacing *= font.d->dpi / qt_defaultDpiY(); | 0 | ||||||||||||||||||||||||
975 | } never executed: end of block | 0 | ||||||||||||||||||||||||
976 | - | |||||||||||||||||||||||||
977 | - | |||||||||||||||||||||||||
978 | if (__builtin_expect(!!(qt_useHarfbuzzNG()), true)
| 0 | ||||||||||||||||||||||||
979 | si.num_glyphs = shapeTextWithHarfbuzzNG(si, string, itemLength, fontEngine, itemBoundaries, kerningEnabled, letterSpacing != 0); never executed: si.num_glyphs = shapeTextWithHarfbuzzNG(si, string, itemLength, fontEngine, itemBoundaries, kerningEnabled, letterSpacing != 0); | 0 | ||||||||||||||||||||||||
980 | else | - | ||||||||||||||||||||||||
981 | - | |||||||||||||||||||||||||
982 | si.num_glyphs = shapeTextWithHarfbuzz(si, string, itemLength, fontEngine, itemBoundaries, kerningEnabled); never executed: si.num_glyphs = shapeTextWithHarfbuzz(si, string, itemLength, fontEngine, itemBoundaries, kerningEnabled); | 0 | ||||||||||||||||||||||||
983 | if (__builtin_expect(!!(si.num_glyphs == 0), false)
| 0 | ||||||||||||||||||||||||
984 | do { ((!(false)) ? qt_assert_x("Q_UNREACHABLE()", "Q_UNREACHABLE was reached",__FILE__,1073) : qt_noop()); __builtin_unreachable(); } while (0); | - | ||||||||||||||||||||||||
985 | return; never executed: return; | 0 | ||||||||||||||||||||||||
986 | } | - | ||||||||||||||||||||||||
987 | - | |||||||||||||||||||||||||
988 | - | |||||||||||||||||||||||||
989 | layoutData->used += si.num_glyphs; | - | ||||||||||||||||||||||||
990 | - | |||||||||||||||||||||||||
991 | QGlyphLayout glyphs = shapedGlyphs(&si); | - | ||||||||||||||||||||||||
992 | - | |||||||||||||||||||||||||
993 | - | |||||||||||||||||||||||||
994 | if (__builtin_expect(!!(qt_useHarfbuzzNG()), true)
| 0 | ||||||||||||||||||||||||
995 | qt_getJustificationOpportunities(string, itemLength, si, glyphs, logClusters(&si)); never executed: qt_getJustificationOpportunities(string, itemLength, si, glyphs, logClusters(&si)); | 0 | ||||||||||||||||||||||||
996 | - | |||||||||||||||||||||||||
997 | - | |||||||||||||||||||||||||
998 | if (letterSpacing != 0
| 0 | ||||||||||||||||||||||||
999 | for (int i = 1; i < si.num_glyphs
| 0 | ||||||||||||||||||||||||
1000 | if (glyphs.attributes[i].clusterStart
| 0 | ||||||||||||||||||||||||
1001 | if (letterSpacingIsAbsolute
| 0 | ||||||||||||||||||||||||
1002 | glyphs.advances[i - 1] += letterSpacing; never executed: glyphs.advances[i - 1] += letterSpacing; | 0 | ||||||||||||||||||||||||
1003 | else { | - | ||||||||||||||||||||||||
1004 | QFixed &advance = glyphs.advances[i - 1]; | - | ||||||||||||||||||||||||
1005 | advance += (letterSpacing - 100) * advance / 100; | - | ||||||||||||||||||||||||
1006 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1007 | } | - | ||||||||||||||||||||||||
1008 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1009 | if (letterSpacingIsAbsolute
| 0 | ||||||||||||||||||||||||
1010 | glyphs.advances[si.num_glyphs - 1] += letterSpacing; never executed: glyphs.advances[si.num_glyphs - 1] += letterSpacing; | 0 | ||||||||||||||||||||||||
1011 | else { | - | ||||||||||||||||||||||||
1012 | QFixed &advance = glyphs.advances[si.num_glyphs - 1]; | - | ||||||||||||||||||||||||
1013 | advance += (letterSpacing - 100) * advance / 100; | - | ||||||||||||||||||||||||
1014 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1015 | } | - | ||||||||||||||||||||||||
1016 | if (wordSpacing != 0
| 0 | ||||||||||||||||||||||||
1017 | for (int i = 0; i < si.num_glyphs
| 0 | ||||||||||||||||||||||||
1018 | if (glyphs.attributes[i].justification == Justification_Space
| 0 | ||||||||||||||||||||||||
1019 | || glyphs.attributes[i].justification == Justification_Arabic_Space
| 0 | ||||||||||||||||||||||||
1020 | - | |||||||||||||||||||||||||
1021 | if (i + 1 == si.num_glyphs
| 0 | ||||||||||||||||||||||||
1022 | ||(glyphs.attributes[i+1].justification != Justification_Space
| 0 | ||||||||||||||||||||||||
1023 | && glyphs.attributes[i+1].justification != Justification_Arabic_Space
| 0 | ||||||||||||||||||||||||
1024 | glyphs.advances[i] += wordSpacing; never executed: glyphs.advances[i] += wordSpacing; | 0 | ||||||||||||||||||||||||
1025 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1026 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1027 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1028 | - | |||||||||||||||||||||||||
1029 | for (int i = 0; i < si.num_glyphs
| 0 | ||||||||||||||||||||||||
1030 | si.width += glyphs.advances[i] * !glyphs.attributes[i].dontPrint; never executed: si.width += glyphs.advances[i] * !glyphs.attributes[i].dontPrint; | 0 | ||||||||||||||||||||||||
1031 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1032 | - | |||||||||||||||||||||||||
1033 | - | |||||||||||||||||||||||||
1034 | - | |||||||||||||||||||||||||
1035 | - | |||||||||||||||||||||||||
1036 | - | |||||||||||||||||||||||||
1037 | - | |||||||||||||||||||||||||
1038 | - | |||||||||||||||||||||||||
1039 | - | |||||||||||||||||||||||||
1040 | int QTextEngine::shapeTextWithHarfbuzzNG(const QScriptItem &si, | - | ||||||||||||||||||||||||
1041 | const ushort *string, | - | ||||||||||||||||||||||||
1042 | int itemLength, | - | ||||||||||||||||||||||||
1043 | QFontEngine *fontEngine, | - | ||||||||||||||||||||||||
1044 | const QVector<uint> &itemBoundaries, | - | ||||||||||||||||||||||||
1045 | bool kerningEnabled, | - | ||||||||||||||||||||||||
1046 | bool hasLetterSpacing) const | - | ||||||||||||||||||||||||
1047 | { | - | ||||||||||||||||||||||||
1048 | uint glyphs_shaped = 0; | - | ||||||||||||||||||||||||
1049 | - | |||||||||||||||||||||||||
1050 | hb_buffer_t *buffer = hb_buffer_create(); | - | ||||||||||||||||||||||||
1051 | hb_buffer_set_unicode_funcs(buffer, hb_qt_get_unicode_funcs()); | - | ||||||||||||||||||||||||
1052 | hb_buffer_pre_allocate(buffer, itemLength); | - | ||||||||||||||||||||||||
1053 | if (__builtin_expect(!!(!hb_buffer_allocation_successful(buffer)), false)
| 0 | ||||||||||||||||||||||||
1054 | hb_buffer_destroy(buffer); | - | ||||||||||||||||||||||||
1055 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
1056 | } | - | ||||||||||||||||||||||||
1057 | - | |||||||||||||||||||||||||
1058 | hb_segment_properties_t props = {HB_DIRECTION_INVALID, HB_SCRIPT_INVALID, ((hb_language_t) __null), __null, __null}; | - | ||||||||||||||||||||||||
1059 | props.direction = si.analysis.bidiLevel % 2
| 0 | ||||||||||||||||||||||||
1060 | QChar::Script script = QChar::Script(si.analysis.script); | - | ||||||||||||||||||||||||
1061 | props.script = hb_qt_script_to_script(script); | - | ||||||||||||||||||||||||
1062 | - | |||||||||||||||||||||||||
1063 | - | |||||||||||||||||||||||||
1064 | for (int k = 0; k < itemBoundaries.size()
| 0 | ||||||||||||||||||||||||
1065 | const uint item_pos = itemBoundaries[k]; | - | ||||||||||||||||||||||||
1066 | const uint item_length = (k + 4 < itemBoundaries.size()
| 0 | ||||||||||||||||||||||||
1067 | const uint engineIdx = itemBoundaries[k + 2]; | - | ||||||||||||||||||||||||
1068 | - | |||||||||||||||||||||||||
1069 | QFontEngine *actualFontEngine = fontEngine->type() != QFontEngine::Multi
| 0 | ||||||||||||||||||||||||
1070 | : static_cast<QFontEngineMulti *>(fontEngine)->engine(engineIdx); | - | ||||||||||||||||||||||||
1071 | - | |||||||||||||||||||||||||
1072 | - | |||||||||||||||||||||||||
1073 | - | |||||||||||||||||||||||||
1074 | hb_buffer_clear_contents(buffer); | - | ||||||||||||||||||||||||
1075 | hb_buffer_add_utf16(buffer, reinterpret_cast<const uint16_t *>(string) + item_pos, item_length, 0, item_length); | - | ||||||||||||||||||||||||
1076 | - | |||||||||||||||||||||||||
1077 | hb_buffer_set_segment_properties(buffer, &props); | - | ||||||||||||||||||||||||
1078 | hb_buffer_guess_segment_properties(buffer); | - | ||||||||||||||||||||||||
1079 | - | |||||||||||||||||||||||||
1080 | uint buffer_flags = HB_BUFFER_FLAG_DEFAULT; | - | ||||||||||||||||||||||||
1081 | - | |||||||||||||||||||||||||
1082 | - | |||||||||||||||||||||||||
1083 | if (__builtin_expect(!!(actualFontEngine->symbol), false)
| 0 | ||||||||||||||||||||||||
1084 | buffer_flags |= HB_BUFFER_FLAG_PRESERVE_DEFAULT_IGNORABLES; never executed: buffer_flags |= HB_BUFFER_FLAG_PRESERVE_DEFAULT_IGNORABLES; | 0 | ||||||||||||||||||||||||
1085 | hb_buffer_set_flags(buffer, hb_buffer_flags_t(buffer_flags)); | - | ||||||||||||||||||||||||
1086 | - | |||||||||||||||||||||||||
1087 | - | |||||||||||||||||||||||||
1088 | - | |||||||||||||||||||||||||
1089 | { | - | ||||||||||||||||||||||||
1090 | hb_font_t *hb_font = hb_qt_font_get_for_engine(actualFontEngine); | - | ||||||||||||||||||||||||
1091 | ((!(hb_font)) ? qt_assert("hb_font",__FILE__,1181) : qt_noop()); | - | ||||||||||||||||||||||||
1092 | hb_qt_font_set_use_design_metrics(hb_font, option.useDesignMetrics() ? uint(QFontEngine::DesignMetrics) : 0); | - | ||||||||||||||||||||||||
1093 | - | |||||||||||||||||||||||||
1094 | - | |||||||||||||||||||||||||
1095 | - | |||||||||||||||||||||||||
1096 | bool scriptRequiresOpenType = ((script >= QChar::Script_Syriac
| 0 | ||||||||||||||||||||||||
1097 | || script == QChar::Script_Khmer
| 0 | ||||||||||||||||||||||||
1098 | - | |||||||||||||||||||||||||
1099 | bool dontLigate = hasLetterSpacing
| 0 | ||||||||||||||||||||||||
1100 | const hb_feature_t features[5] = { | - | ||||||||||||||||||||||||
1101 | { ((hb_tag_t)((((uint8_t)('k'))<<24)|(((uint8_t)('e'))<<16)|(((uint8_t)('r'))<<8)|((uint8_t)('n')))), !!kerningEnabled, 0, uint(-1) }, | - | ||||||||||||||||||||||||
1102 | { ((hb_tag_t)((((uint8_t)('l'))<<24)|(((uint8_t)('i'))<<16)|(((uint8_t)('g'))<<8)|((uint8_t)('a')))), !dontLigate, 0, uint(-1) }, | - | ||||||||||||||||||||||||
1103 | { ((hb_tag_t)((((uint8_t)('c'))<<24)|(((uint8_t)('l'))<<16)|(((uint8_t)('i'))<<8)|((uint8_t)('g')))), !dontLigate, 0, uint(-1) }, | - | ||||||||||||||||||||||||
1104 | { ((hb_tag_t)((((uint8_t)('d'))<<24)|(((uint8_t)('l'))<<16)|(((uint8_t)('i'))<<8)|((uint8_t)('g')))), !dontLigate, 0, uint(-1) }, | - | ||||||||||||||||||||||||
1105 | { ((hb_tag_t)((((uint8_t)('h'))<<24)|(((uint8_t)('l'))<<16)|(((uint8_t)('i'))<<8)|((uint8_t)('g')))), !dontLigate, 0, uint(-1) } }; | - | ||||||||||||||||||||||||
1106 | const int num_features = dontLigate
| 0 | ||||||||||||||||||||||||
1107 | - | |||||||||||||||||||||||||
1108 | const char *const *shaper_list = nullptr; | - | ||||||||||||||||||||||||
1109 | bool shapedOk = hb_shape_full(hb_font, buffer, features, num_features, shaper_list); | - | ||||||||||||||||||||||||
1110 | if (__builtin_expect(!!(!shapedOk), false)
| 0 | ||||||||||||||||||||||||
1111 | hb_buffer_destroy(buffer); | - | ||||||||||||||||||||||||
1112 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
1113 | } | - | ||||||||||||||||||||||||
1114 | - | |||||||||||||||||||||||||
1115 | if (__builtin_expect(!!(((((unsigned int) (props.direction)) & ~2U) == 5)), false)
| 0 | ||||||||||||||||||||||||
1116 | hb_buffer_reverse(buffer); never executed: hb_buffer_reverse(buffer); | 0 | ||||||||||||||||||||||||
1117 | } | - | ||||||||||||||||||||||||
1118 | - | |||||||||||||||||||||||||
1119 | const uint num_glyphs = hb_buffer_get_length(buffer); | - | ||||||||||||||||||||||||
1120 | - | |||||||||||||||||||||||||
1121 | if (__builtin_expect(!!(num_glyphs == 0 || !ensureSpace(glyphs_shaped + num_glyphs)), false)
| 0 | ||||||||||||||||||||||||
1122 | hb_buffer_destroy(buffer); | - | ||||||||||||||||||||||||
1123 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
1124 | } | - | ||||||||||||||||||||||||
1125 | - | |||||||||||||||||||||||||
1126 | - | |||||||||||||||||||||||||
1127 | QGlyphLayout g = availableGlyphs(&si).mid(glyphs_shaped, num_glyphs); | - | ||||||||||||||||||||||||
1128 | ushort *log_clusters = logClusters(&si) + item_pos; | - | ||||||||||||||||||||||||
1129 | - | |||||||||||||||||||||||||
1130 | hb_glyph_info_t *infos = hb_buffer_get_glyph_infos(buffer, 0); | - | ||||||||||||||||||||||||
1131 | hb_glyph_position_t *positions = hb_buffer_get_glyph_positions(buffer, 0); | - | ||||||||||||||||||||||||
1132 | uint str_pos = 0; | - | ||||||||||||||||||||||||
1133 | uint last_cluster = ~0u; | - | ||||||||||||||||||||||||
1134 | uint last_glyph_pos = glyphs_shaped; | - | ||||||||||||||||||||||||
1135 | for (uint i = 0; i < num_glyphs
| 0 | ||||||||||||||||||||||||
1136 | g.glyphs[i] = infos->codepoint; | - | ||||||||||||||||||||||||
1137 | - | |||||||||||||||||||||||||
1138 | g.advances[i] = QFixed::fromFixed(positions->x_advance); | - | ||||||||||||||||||||||||
1139 | g.offsets[i].x = QFixed::fromFixed(positions->x_offset); | - | ||||||||||||||||||||||||
1140 | g.offsets[i].y = QFixed::fromFixed(positions->y_offset); | - | ||||||||||||||||||||||||
1141 | - | |||||||||||||||||||||||||
1142 | uint cluster = infos->cluster; | - | ||||||||||||||||||||||||
1143 | if (__builtin_expect(!!(last_cluster != cluster), true)
| 0 | ||||||||||||||||||||||||
1144 | g.attributes[i].clusterStart = true; | - | ||||||||||||||||||||||||
1145 | - | |||||||||||||||||||||||||
1146 | - | |||||||||||||||||||||||||
1147 | - | |||||||||||||||||||||||||
1148 | while (last_cluster++ < cluster
| 0 | ||||||||||||||||||||||||
1149 | log_clusters[str_pos++] = last_glyph_pos; never executed: log_clusters[str_pos++] = last_glyph_pos; | 0 | ||||||||||||||||||||||||
1150 | last_glyph_pos = i + glyphs_shaped; | - | ||||||||||||||||||||||||
1151 | last_cluster = cluster; | - | ||||||||||||||||||||||||
1152 | - | |||||||||||||||||||||||||
1153 | - | |||||||||||||||||||||||||
1154 | switch (string[item_pos + str_pos]) { | - | ||||||||||||||||||||||||
1155 | case never executed: QChar::LineFeed:case QChar::LineFeed: never executed: case QChar::LineFeed: | 0 | ||||||||||||||||||||||||
1156 | case never executed: 0x000c:case 0x000c: never executed: case 0x000c: | 0 | ||||||||||||||||||||||||
1157 | case never executed: QChar::CarriageReturn:case QChar::CarriageReturn: never executed: case QChar::CarriageReturn: | 0 | ||||||||||||||||||||||||
1158 | case never executed: QChar::LineSeparator:case QChar::LineSeparator: never executed: case QChar::LineSeparator: | 0 | ||||||||||||||||||||||||
1159 | case never executed: QChar::ParagraphSeparator:case QChar::ParagraphSeparator: never executed: case QChar::ParagraphSeparator: | 0 | ||||||||||||||||||||||||
1160 | g.attributes[i].dontPrint = true; | - | ||||||||||||||||||||||||
1161 | break; never executed: break; | 0 | ||||||||||||||||||||||||
1162 | case never executed: QChar::SoftHyphen:case QChar::SoftHyphen: never executed: case QChar::SoftHyphen: | 0 | ||||||||||||||||||||||||
1163 | if (!actualFontEngine->symbol
| 0 | ||||||||||||||||||||||||
1164 | - | |||||||||||||||||||||||||
1165 | - | |||||||||||||||||||||||||
1166 | - | |||||||||||||||||||||||||
1167 | g.glyphs[i] = actualFontEngine->glyphIndex('-'); | - | ||||||||||||||||||||||||
1168 | if (__builtin_expect(!!(g.glyphs[i] != 0), true)
| 0 | ||||||||||||||||||||||||
1169 | QGlyphLayout tmp = g.mid(i, 1); | - | ||||||||||||||||||||||||
1170 | actualFontEngine->recalcAdvances(&tmp, 0); | - | ||||||||||||||||||||||||
1171 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1172 | g.attributes[i].dontPrint = true; | - | ||||||||||||||||||||||||
1173 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1174 | break; never executed: break; | 0 | ||||||||||||||||||||||||
1175 | default never executed: :default: never executed: default: | 0 | ||||||||||||||||||||||||
1176 | break; never executed: break; | 0 | ||||||||||||||||||||||||
1177 | } | - | ||||||||||||||||||||||||
1178 | } | - | ||||||||||||||||||||||||
1179 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1180 | while (str_pos < item_length
| 0 | ||||||||||||||||||||||||
1181 | log_clusters[str_pos++] = last_glyph_pos; never executed: log_clusters[str_pos++] = last_glyph_pos; | 0 | ||||||||||||||||||||||||
1182 | - | |||||||||||||||||||||||||
1183 | if (__builtin_expect(!!(engineIdx != 0), false)
| 0 | ||||||||||||||||||||||||
1184 | for (quint32 i = 0; i < num_glyphs
| 0 | ||||||||||||||||||||||||
1185 | g.glyphs[i] |= (engineIdx << 24); never executed: g.glyphs[i] |= (engineIdx << 24); | 0 | ||||||||||||||||||||||||
1186 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1187 | if (!actualFontEngine->supportsSubPixelPositions()
| 0 | ||||||||||||||||||||||||
1188 | for (uint i = 0; i < num_glyphs
| 0 | ||||||||||||||||||||||||
1189 | g.advances[i] = g.advances[i].round(); never executed: g.advances[i] = g.advances[i].round(); | 0 | ||||||||||||||||||||||||
1190 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1191 | - | |||||||||||||||||||||||||
1192 | glyphs_shaped += num_glyphs; | - | ||||||||||||||||||||||||
1193 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1194 | - | |||||||||||||||||||||||||
1195 | hb_buffer_destroy(buffer); | - | ||||||||||||||||||||||||
1196 | - | |||||||||||||||||||||||||
1197 | return never executed: glyphs_shaped;return glyphs_shaped; never executed: return glyphs_shaped; | 0 | ||||||||||||||||||||||||
1198 | } | - | ||||||||||||||||||||||||
1199 | - | |||||||||||||||||||||||||
1200 | - | |||||||||||||||||||||||||
1201 | - | |||||||||||||||||||||||||
1202 | - | |||||||||||||||||||||||||
1203 | - | |||||||||||||||||||||||||
1204 | - | |||||||||||||||||||||||||
1205 | - | |||||||||||||||||||||||||
1206 | - | |||||||||||||||||||||||||
1207 | - | |||||||||||||||||||||||||
1208 | static_assert(bool(sizeof(HB_Glyph) == sizeof(glyph_t)), "sizeof(HB_Glyph) == sizeof(glyph_t)"); | - | ||||||||||||||||||||||||
1209 | static_assert(bool(sizeof(HB_Fixed) == sizeof(QFixed)), "sizeof(HB_Fixed) == sizeof(QFixed)"); | - | ||||||||||||||||||||||||
1210 | static_assert(bool(sizeof(HB_FixedPoint) == sizeof(QFixedPoint)), "sizeof(HB_FixedPoint) == sizeof(QFixedPoint)"); | - | ||||||||||||||||||||||||
1211 | - | |||||||||||||||||||||||||
1212 | static inline void moveGlyphData(const QGlyphLayout &destination, const QGlyphLayout &source, int num) | - | ||||||||||||||||||||||||
1213 | { | - | ||||||||||||||||||||||||
1214 | if (num > 0
| 0 | ||||||||||||||||||||||||
1215 | memmove(destination.glyphs, source.glyphs, num * sizeof(glyph_t)); never executed: memmove(destination.glyphs, source.glyphs, num * sizeof(glyph_t)); | 0 | ||||||||||||||||||||||||
1216 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1217 | - | |||||||||||||||||||||||||
1218 | int QTextEngine::shapeTextWithHarfbuzz(const QScriptItem &si, const ushort *string, int itemLength, QFontEngine *fontEngine, const QVector<uint> &itemBoundaries, bool kerningEnabled) const | - | ||||||||||||||||||||||||
1219 | { | - | ||||||||||||||||||||||||
1220 | HB_ShaperItem entire_shaper_item; | - | ||||||||||||||||||||||||
1221 | memset(&entire_shaper_item, 0, sizeof(entire_shaper_item)); | - | ||||||||||||||||||||||||
1222 | entire_shaper_item.string = reinterpret_cast<const HB_UChar16 *>(string); | - | ||||||||||||||||||||||||
1223 | entire_shaper_item.stringLength = itemLength; | - | ||||||||||||||||||||||||
1224 | entire_shaper_item.item.script = script_to_hbscript(si.analysis.script); | - | ||||||||||||||||||||||||
1225 | entire_shaper_item.item.pos = 0; | - | ||||||||||||||||||||||||
1226 | entire_shaper_item.item.length = itemLength; | - | ||||||||||||||||||||||||
1227 | entire_shaper_item.item.bidiLevel = si.analysis.bidiLevel; | - | ||||||||||||||||||||||||
1228 | - | |||||||||||||||||||||||||
1229 | entire_shaper_item.shaperFlags = 0; | - | ||||||||||||||||||||||||
1230 | if (!kerningEnabled
| 0 | ||||||||||||||||||||||||
1231 | entire_shaper_item.shaperFlags |= HB_ShaperFlag_NoKerning; never executed: entire_shaper_item.shaperFlags |= HB_ShaperFlag_NoKerning; | 0 | ||||||||||||||||||||||||
1232 | if (option.useDesignMetrics()
| 0 | ||||||||||||||||||||||||
1233 | entire_shaper_item.shaperFlags |= HB_ShaperFlag_UseDesignMetrics; never executed: entire_shaper_item.shaperFlags |= HB_ShaperFlag_UseDesignMetrics; | 0 | ||||||||||||||||||||||||
1234 | - | |||||||||||||||||||||||||
1235 | - | |||||||||||||||||||||||||
1236 | entire_shaper_item.num_glyphs = 0; | - | ||||||||||||||||||||||||
1237 | for (int i = 0; i < itemLength
| 0 | ||||||||||||||||||||||||
1238 | if (QChar::isHighSurrogate(string[i])
| 0 | ||||||||||||||||||||||||
1239 | ++ never executed: i;++i; never executed: ++i; | 0 | ||||||||||||||||||||||||
1240 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1241 | - | |||||||||||||||||||||||||
1242 | - | |||||||||||||||||||||||||
1243 | int remaining_glyphs = entire_shaper_item.num_glyphs; | - | ||||||||||||||||||||||||
1244 | int glyph_pos = 0; | - | ||||||||||||||||||||||||
1245 | - | |||||||||||||||||||||||||
1246 | for (int k = 0; k < itemBoundaries.size()
| 0 | ||||||||||||||||||||||||
1247 | HB_ShaperItem shaper_item = entire_shaper_item; | - | ||||||||||||||||||||||||
1248 | shaper_item.item.pos = itemBoundaries[k]; | - | ||||||||||||||||||||||||
1249 | if (k + 4 < itemBoundaries.size()
| 0 | ||||||||||||||||||||||||
1250 | shaper_item.item.length = itemBoundaries[k + 3] - shaper_item.item.pos; | - | ||||||||||||||||||||||||
1251 | shaper_item.num_glyphs = itemBoundaries[k + 4] - itemBoundaries[k + 1]; | - | ||||||||||||||||||||||||
1252 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
1253 | shaper_item.item.length -= shaper_item.item.pos - entire_shaper_item.item.pos; | - | ||||||||||||||||||||||||
1254 | shaper_item.num_glyphs -= itemBoundaries[k + 1]; | - | ||||||||||||||||||||||||
1255 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1256 | shaper_item.initialGlyphCount = shaper_item.num_glyphs; | - | ||||||||||||||||||||||||
1257 | if (shaper_item.num_glyphs < shaper_item.item.length
| 0 | ||||||||||||||||||||||||
1258 | shaper_item.num_glyphs = shaper_item.item.length; never executed: shaper_item.num_glyphs = shaper_item.item.length; | 0 | ||||||||||||||||||||||||
1259 | - | |||||||||||||||||||||||||
1260 | uint engineIdx = itemBoundaries[k + 2]; | - | ||||||||||||||||||||||||
1261 | QFontEngine *actualFontEngine = fontEngine; | - | ||||||||||||||||||||||||
1262 | if (fontEngine->type() == QFontEngine::Multi
| 0 | ||||||||||||||||||||||||
1263 | actualFontEngine = static_cast<QFontEngineMulti *>(fontEngine)->engine(engineIdx); | - | ||||||||||||||||||||||||
1264 | - | |||||||||||||||||||||||||
1265 | if ((
| 0 | ||||||||||||||||||||||||
1266 | shaper_item.glyphIndicesPresent = true; never executed: shaper_item.glyphIndicesPresent = true; | 0 | ||||||||||||||||||||||||
1267 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1268 | - | |||||||||||||||||||||||||
1269 | shaper_item.font = (HB_Font)actualFontEngine->harfbuzzFont(); | - | ||||||||||||||||||||||||
1270 | shaper_item.face = (HB_Face)actualFontEngine->harfbuzzFace(); | - | ||||||||||||||||||||||||
1271 | - | |||||||||||||||||||||||||
1272 | remaining_glyphs -= shaper_item.initialGlyphCount; | - | ||||||||||||||||||||||||
1273 | - | |||||||||||||||||||||||||
1274 | QVarLengthArray<HB_GlyphAttributes, 128> hbGlyphAttributes; | - | ||||||||||||||||||||||||
1275 | do { | - | ||||||||||||||||||||||||
1276 | if (!ensureSpace(glyph_pos + shaper_item.num_glyphs + remaining_glyphs)
| 0 | ||||||||||||||||||||||||
1277 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
1278 | if (hbGlyphAttributes.size() < int(shaper_item.num_glyphs)
| 0 | ||||||||||||||||||||||||
1279 | hbGlyphAttributes.resize(shaper_item.num_glyphs); | - | ||||||||||||||||||||||||
1280 | memset(hbGlyphAttributes.data(), 0, hbGlyphAttributes.size() * sizeof(HB_GlyphAttributes)); | - | ||||||||||||||||||||||||
1281 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1282 | - | |||||||||||||||||||||||||
1283 | const QGlyphLayout g = availableGlyphs(&si).mid(glyph_pos); | - | ||||||||||||||||||||||||
1284 | if (fontEngine->type() == QFontEngine::Multi
| 0 | ||||||||||||||||||||||||
1285 | moveGlyphData(g.mid(shaper_item.num_glyphs), g.mid(shaper_item.initialGlyphCount), remaining_glyphs); never executed: moveGlyphData(g.mid(shaper_item.num_glyphs), g.mid(shaper_item.initialGlyphCount), remaining_glyphs); | 0 | ||||||||||||||||||||||||
1286 | - | |||||||||||||||||||||||||
1287 | shaper_item.glyphs = reinterpret_cast<HB_Glyph *>(g.glyphs); | - | ||||||||||||||||||||||||
1288 | shaper_item.advances = reinterpret_cast<HB_Fixed *>(g.advances); | - | ||||||||||||||||||||||||
1289 | shaper_item.offsets = reinterpret_cast<HB_FixedPoint *>(g.offsets); | - | ||||||||||||||||||||||||
1290 | shaper_item.attributes = hbGlyphAttributes.data(); | - | ||||||||||||||||||||||||
1291 | - | |||||||||||||||||||||||||
1292 | if (engineIdx != 0
| 0 | ||||||||||||||||||||||||
1293 | for (quint32 i = 0; i < shaper_item.initialGlyphCount
| 0 | ||||||||||||||||||||||||
1294 | shaper_item.glyphs[i] &= 0x00ffffff; never executed: shaper_item.glyphs[i] &= 0x00ffffff; | 0 | ||||||||||||||||||||||||
1295 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1296 | - | |||||||||||||||||||||||||
1297 | shaper_item.log_clusters = logClusters(&si) + shaper_item.item.pos - entire_shaper_item.item.pos; | - | ||||||||||||||||||||||||
1298 | } never executed: while (!qShapeItem(&shaper_item)end of block
| 0 | ||||||||||||||||||||||||
1299 | - | |||||||||||||||||||||||||
1300 | QGlyphLayout g = availableGlyphs(&si).mid(glyph_pos, shaper_item.num_glyphs); | - | ||||||||||||||||||||||||
1301 | if (fontEngine->type() == QFontEngine::Multi
| 0 | ||||||||||||||||||||||||
1302 | moveGlyphData(g.mid(shaper_item.num_glyphs), g.mid(shaper_item.initialGlyphCount), remaining_glyphs); never executed: moveGlyphData(g.mid(shaper_item.num_glyphs), g.mid(shaper_item.initialGlyphCount), remaining_glyphs); | 0 | ||||||||||||||||||||||||
1303 | - | |||||||||||||||||||||||||
1304 | for (quint32 i = 0; i < shaper_item.num_glyphs
| 0 | ||||||||||||||||||||||||
1305 | HB_GlyphAttributes hbAttrs = hbGlyphAttributes.at(i); | - | ||||||||||||||||||||||||
1306 | QGlyphAttributes &attrs = g.attributes[i]; | - | ||||||||||||||||||||||||
1307 | attrs.clusterStart = hbAttrs.clusterStart; | - | ||||||||||||||||||||||||
1308 | attrs.dontPrint = hbAttrs.dontPrint; | - | ||||||||||||||||||||||||
1309 | attrs.justification = hbAttrs.justification; | - | ||||||||||||||||||||||||
1310 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1311 | - | |||||||||||||||||||||||||
1312 | for (quint32 i = 0; i < shaper_item.item.length
| 0 | ||||||||||||||||||||||||
1313 | - | |||||||||||||||||||||||||
1314 | if (shaper_item.log_clusters[i] >= shaper_item.num_glyphs
| 0 | ||||||||||||||||||||||||
1315 | shaper_item.log_clusters[i] = shaper_item.num_glyphs - 1; never executed: shaper_item.log_clusters[i] = shaper_item.num_glyphs - 1; | 0 | ||||||||||||||||||||||||
1316 | shaper_item.log_clusters[i] += glyph_pos; | - | ||||||||||||||||||||||||
1317 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1318 | - | |||||||||||||||||||||||||
1319 | if (kerningEnabled
| 0 | ||||||||||||||||||||||||
1320 | actualFontEngine->doKerning(&g, option.useDesignMetrics() ? QFontEngine::DesignMetrics : QFontEngine::ShaperFlags(0)); never executed: actualFontEngine->doKerning(&g, option.useDesignMetrics() ? QFontEngine::DesignMetrics : QFontEngine::ShaperFlags(0)); | 0 | ||||||||||||||||||||||||
1321 | - | |||||||||||||||||||||||||
1322 | if (engineIdx != 0
| 0 | ||||||||||||||||||||||||
1323 | for (quint32 i = 0; i < shaper_item.num_glyphs
| 0 | ||||||||||||||||||||||||
1324 | g.glyphs[i] |= (engineIdx << 24); never executed: g.glyphs[i] |= (engineIdx << 24); | 0 | ||||||||||||||||||||||||
1325 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1326 | - | |||||||||||||||||||||||||
1327 | glyph_pos += shaper_item.num_glyphs; | - | ||||||||||||||||||||||||
1328 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1329 | - | |||||||||||||||||||||||||
1330 | return never executed: glyph_pos;return glyph_pos; never executed: return glyph_pos; | 0 | ||||||||||||||||||||||||
1331 | } | - | ||||||||||||||||||||||||
1332 | - | |||||||||||||||||||||||||
1333 | void QTextEngine::init(QTextEngine *e) | - | ||||||||||||||||||||||||
1334 | { | - | ||||||||||||||||||||||||
1335 | e->ignoreBidi = false; | - | ||||||||||||||||||||||||
1336 | e->cacheGlyphs = false; | - | ||||||||||||||||||||||||
1337 | e->forceJustification = false; | - | ||||||||||||||||||||||||
1338 | e->visualMovement = false; | - | ||||||||||||||||||||||||
1339 | e->delayDecorations = false; | - | ||||||||||||||||||||||||
1340 | - | |||||||||||||||||||||||||
1341 | e->layoutData = 0; | - | ||||||||||||||||||||||||
1342 | - | |||||||||||||||||||||||||
1343 | e->minWidth = 0; | - | ||||||||||||||||||||||||
1344 | e->maxWidth = 0; | - | ||||||||||||||||||||||||
1345 | - | |||||||||||||||||||||||||
1346 | e->specialData = 0; | - | ||||||||||||||||||||||||
1347 | e->stackEngine = false; | - | ||||||||||||||||||||||||
1348 | - | |||||||||||||||||||||||||
1349 | e->useRawFont = false; | - | ||||||||||||||||||||||||
1350 | - | |||||||||||||||||||||||||
1351 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1352 | - | |||||||||||||||||||||||||
1353 | QTextEngine::QTextEngine() | - | ||||||||||||||||||||||||
1354 | { | - | ||||||||||||||||||||||||
1355 | init(this); | - | ||||||||||||||||||||||||
1356 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1357 | - | |||||||||||||||||||||||||
1358 | QTextEngine::QTextEngine(const QString &str, const QFont &f) | - | ||||||||||||||||||||||||
1359 | : text(str), | - | ||||||||||||||||||||||||
1360 | fnt(f) | - | ||||||||||||||||||||||||
1361 | { | - | ||||||||||||||||||||||||
1362 | init(this); | - | ||||||||||||||||||||||||
1363 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1364 | - | |||||||||||||||||||||||||
1365 | QTextEngine::~QTextEngine() | - | ||||||||||||||||||||||||
1366 | { | - | ||||||||||||||||||||||||
1367 | if (!stackEngine
| 0 | ||||||||||||||||||||||||
1368 | delete layoutData; never executed: delete layoutData; | 0 | ||||||||||||||||||||||||
1369 | delete specialData; | - | ||||||||||||||||||||||||
1370 | resetFontEngineCache(); | - | ||||||||||||||||||||||||
1371 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1372 | - | |||||||||||||||||||||||||
1373 | const QCharAttributes *QTextEngine::attributes() const | - | ||||||||||||||||||||||||
1374 | { | - | ||||||||||||||||||||||||
1375 | if (layoutData
| 0 | ||||||||||||||||||||||||
1376 | return never executed: (QCharAttributes *) layoutData->memory;return (QCharAttributes *) layoutData->memory; never executed: return (QCharAttributes *) layoutData->memory; | 0 | ||||||||||||||||||||||||
1377 | - | |||||||||||||||||||||||||
1378 | itemize(); | - | ||||||||||||||||||||||||
1379 | if (! ensureSpace(layoutData->string.length())
| 0 | ||||||||||||||||||||||||
1380 | return never executed: __null;return __null; never executed: return __null; | 0 | ||||||||||||||||||||||||
1381 | - | |||||||||||||||||||||||||
1382 | QVarLengthArray<QUnicodeTools::ScriptItem> scriptItems(layoutData->items.size()); | - | ||||||||||||||||||||||||
1383 | for (int i = 0; i < layoutData->items.size()
| 0 | ||||||||||||||||||||||||
1384 | const QScriptItem &si = layoutData->items[i]; | - | ||||||||||||||||||||||||
1385 | scriptItems[i].position = si.position; | - | ||||||||||||||||||||||||
1386 | scriptItems[i].script = si.analysis.script; | - | ||||||||||||||||||||||||
1387 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1388 | - | |||||||||||||||||||||||||
1389 | QUnicodeTools::initCharAttributes(reinterpret_cast<const ushort *>(layoutData->string.constData()), | - | ||||||||||||||||||||||||
1390 | layoutData->string.length(), | - | ||||||||||||||||||||||||
1391 | scriptItems.data(), scriptItems.size(), | - | ||||||||||||||||||||||||
1392 | (QCharAttributes *)layoutData->memory); | - | ||||||||||||||||||||||||
1393 | - | |||||||||||||||||||||||||
1394 | - | |||||||||||||||||||||||||
1395 | layoutData->haveCharAttributes = true; | - | ||||||||||||||||||||||||
1396 | return never executed: (QCharAttributes *) layoutData->memory;return (QCharAttributes *) layoutData->memory; never executed: return (QCharAttributes *) layoutData->memory; | 0 | ||||||||||||||||||||||||
1397 | } | - | ||||||||||||||||||||||||
1398 | - | |||||||||||||||||||||||||
1399 | void QTextEngine::shape(int item) const | - | ||||||||||||||||||||||||
1400 | { | - | ||||||||||||||||||||||||
1401 | if (layoutData->items[item].analysis.flags == QScriptAnalysis::Object
| 0 | ||||||||||||||||||||||||
1402 | ensureSpace(1); | - | ||||||||||||||||||||||||
1403 | if (block.docHandle()
| 0 | ||||||||||||||||||||||||
1404 | docLayout()->resizeInlineObject(QTextInlineObject(item, const_cast<QTextEngine *>(this)), | - | ||||||||||||||||||||||||
1405 | layoutData->items[item].position + block.position(), | - | ||||||||||||||||||||||||
1406 | format(&layoutData->items[item])); | - | ||||||||||||||||||||||||
1407 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1408 | } never executed: else if (layoutData->items[item].analysis.flags == QScriptAnalysis::Tabend of block
| 0 | ||||||||||||||||||||||||
1409 | - | |||||||||||||||||||||||||
1410 | fontEngine(layoutData->items[item], | - | ||||||||||||||||||||||||
1411 | &layoutData->items[item].ascent, | - | ||||||||||||||||||||||||
1412 | &layoutData->items[item].descent, | - | ||||||||||||||||||||||||
1413 | &layoutData->items[item].leading); | - | ||||||||||||||||||||||||
1414 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
1415 | shapeText(item); | - | ||||||||||||||||||||||||
1416 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1417 | } | - | ||||||||||||||||||||||||
1418 | - | |||||||||||||||||||||||||
1419 | static inline void releaseCachedFontEngine(QFontEngine *fontEngine) | - | ||||||||||||||||||||||||
1420 | { | - | ||||||||||||||||||||||||
1421 | if (fontEngine
| 0 | ||||||||||||||||||||||||
1422 | delete fontEngine; never executed: delete fontEngine; | 0 | ||||||||||||||||||||||||
1423 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1424 | - | |||||||||||||||||||||||||
1425 | void QTextEngine::resetFontEngineCache() | - | ||||||||||||||||||||||||
1426 | { | - | ||||||||||||||||||||||||
1427 | releaseCachedFontEngine(feCache.prevFontEngine); | - | ||||||||||||||||||||||||
1428 | releaseCachedFontEngine(feCache.prevScaledFontEngine); | - | ||||||||||||||||||||||||
1429 | feCache.reset(); | - | ||||||||||||||||||||||||
1430 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1431 | - | |||||||||||||||||||||||||
1432 | void QTextEngine::invalidate() | - | ||||||||||||||||||||||||
1433 | { | - | ||||||||||||||||||||||||
1434 | freeMemory(); | - | ||||||||||||||||||||||||
1435 | minWidth = 0; | - | ||||||||||||||||||||||||
1436 | maxWidth = 0; | - | ||||||||||||||||||||||||
1437 | - | |||||||||||||||||||||||||
1438 | resetFontEngineCache(); | - | ||||||||||||||||||||||||
1439 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1440 | - | |||||||||||||||||||||||||
1441 | void QTextEngine::clearLineData() | - | ||||||||||||||||||||||||
1442 | { | - | ||||||||||||||||||||||||
1443 | lines.clear(); | - | ||||||||||||||||||||||||
1444 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1445 | - | |||||||||||||||||||||||||
1446 | void QTextEngine::validate() const | - | ||||||||||||||||||||||||
1447 | { | - | ||||||||||||||||||||||||
1448 | if (layoutData
| 0 | ||||||||||||||||||||||||
1449 | return; never executed: return; | 0 | ||||||||||||||||||||||||
1450 | layoutData = new LayoutData(); | - | ||||||||||||||||||||||||
1451 | if (block.docHandle()
| 0 | ||||||||||||||||||||||||
1452 | layoutData->string = block.text(); | - | ||||||||||||||||||||||||
1453 | const bool nextBlockValid = block.next().isValid(); | - | ||||||||||||||||||||||||
1454 | if (!nextBlockValid
| 0 | ||||||||||||||||||||||||
1455 | layoutData->string += QChar(0xA7); | - | ||||||||||||||||||||||||
1456 | } never executed: else if (option.flags() & QTextOption::ShowLineAndParagraphSeparatorsend of block
| 0 | ||||||||||||||||||||||||
1457 | layoutData->string += QLatin1Char(nextBlockValid ? 0xb6 : 0x20); | - | ||||||||||||||||||||||||
1458 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1459 | - | |||||||||||||||||||||||||
1460 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
1461 | layoutData->string = text; | - | ||||||||||||||||||||||||
1462 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1463 | if (specialData
| 0 | ||||||||||||||||||||||||
1464 | layoutData->string.insert(specialData->preeditPosition, specialData->preeditText); never executed: layoutData->string.insert(specialData->preeditPosition, specialData->preeditText); | 0 | ||||||||||||||||||||||||
1465 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1466 | - | |||||||||||||||||||||||||
1467 | void QTextEngine::itemize() const | - | ||||||||||||||||||||||||
1468 | { | - | ||||||||||||||||||||||||
1469 | validate(); | - | ||||||||||||||||||||||||
1470 | if (layoutData->items.size()
| 0 | ||||||||||||||||||||||||
1471 | return; never executed: return; | 0 | ||||||||||||||||||||||||
1472 | - | |||||||||||||||||||||||||
1473 | int length = layoutData->string.length(); | - | ||||||||||||||||||||||||
1474 | if (!length
| 0 | ||||||||||||||||||||||||
1475 | return; never executed: return; | 0 | ||||||||||||||||||||||||
1476 | - | |||||||||||||||||||||||||
1477 | const ushort *string = reinterpret_cast<const ushort *>(layoutData->string.unicode()); | - | ||||||||||||||||||||||||
1478 | - | |||||||||||||||||||||||||
1479 | bool ignore = ignoreBidi; | - | ||||||||||||||||||||||||
1480 | - | |||||||||||||||||||||||||
1481 | bool rtl = isRightToLeft(); | - | ||||||||||||||||||||||||
1482 | - | |||||||||||||||||||||||||
1483 | if (!ignore
| 0 | ||||||||||||||||||||||||
1484 | ignore = true; | - | ||||||||||||||||||||||||
1485 | const QChar *start = layoutData->string.unicode(); | - | ||||||||||||||||||||||||
1486 | const QChar * const end = start + length; | - | ||||||||||||||||||||||||
1487 | while (start < end
| 0 | ||||||||||||||||||||||||
1488 | if (start->unicode() >= 0x590
| 0 | ||||||||||||||||||||||||
1489 | ignore = false; | - | ||||||||||||||||||||||||
1490 | break; never executed: break; | 0 | ||||||||||||||||||||||||
1491 | } | - | ||||||||||||||||||||||||
1492 | ++start; | - | ||||||||||||||||||||||||
1493 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1494 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1495 | - | |||||||||||||||||||||||||
1496 | QVarLengthArray<QScriptAnalysis, 4096> scriptAnalysis(length); | - | ||||||||||||||||||||||||
1497 | QScriptAnalysis *analysis = scriptAnalysis.data(); | - | ||||||||||||||||||||||||
1498 | - | |||||||||||||||||||||||||
1499 | QBidiControl control(rtl); | - | ||||||||||||||||||||||||
1500 | - | |||||||||||||||||||||||||
1501 | if (ignore
| 0 | ||||||||||||||||||||||||
1502 | memset(analysis, 0, length*sizeof(QScriptAnalysis)); | - | ||||||||||||||||||||||||
1503 | if (option.textDirection() == Qt::RightToLeft
| 0 | ||||||||||||||||||||||||
1504 | for (int i = 0; i < length
| 0 | ||||||||||||||||||||||||
1505 | analysis[i].bidiLevel = 1; never executed: analysis[i].bidiLevel = 1; | 0 | ||||||||||||||||||||||||
1506 | layoutData->hasBidi = true; | - | ||||||||||||||||||||||||
1507 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1508 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
1509 | layoutData->hasBidi = bidiItemize(const_cast<QTextEngine *>(this), analysis, control); | - | ||||||||||||||||||||||||
1510 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1511 | - | |||||||||||||||||||||||||
1512 | { | - | ||||||||||||||||||||||||
1513 | QVarLengthArray<uchar> scripts(length); | - | ||||||||||||||||||||||||
1514 | QUnicodeTools::initScripts(string, length, scripts.data()); | - | ||||||||||||||||||||||||
1515 | for (int i = 0; i < length
| 0 | ||||||||||||||||||||||||
1516 | analysis[i].script = scripts.at(i); never executed: analysis[i].script = scripts.at(i); | 0 | ||||||||||||||||||||||||
1517 | } | - | ||||||||||||||||||||||||
1518 | - | |||||||||||||||||||||||||
1519 | const ushort *uc = string; | - | ||||||||||||||||||||||||
1520 | const ushort *e = uc + length; | - | ||||||||||||||||||||||||
1521 | while (uc < e
| 0 | ||||||||||||||||||||||||
1522 | switch (*uc) { | - | ||||||||||||||||||||||||
1523 | case never executed: QChar::ObjectReplacementCharacter:case QChar::ObjectReplacementCharacter: never executed: case QChar::ObjectReplacementCharacter: | 0 | ||||||||||||||||||||||||
1524 | analysis->flags = QScriptAnalysis::Object; | - | ||||||||||||||||||||||||
1525 | break; never executed: break; | 0 | ||||||||||||||||||||||||
1526 | case never executed: QChar::LineSeparator:case QChar::LineSeparator: never executed: case QChar::LineSeparator: | 0 | ||||||||||||||||||||||||
1527 | if (analysis->bidiLevel % 2
| 0 | ||||||||||||||||||||||||
1528 | -- never executed: analysis->bidiLevel;--analysis->bidiLevel; never executed: --analysis->bidiLevel; | 0 | ||||||||||||||||||||||||
1529 | analysis->flags = QScriptAnalysis::LineOrParagraphSeparator; | - | ||||||||||||||||||||||||
1530 | if (option.flags() & QTextOption::ShowLineAndParagraphSeparators
| 0 | ||||||||||||||||||||||||
1531 | const int offset = uc - string; | - | ||||||||||||||||||||||||
1532 | layoutData->string.detach(); | - | ||||||||||||||||||||||||
1533 | string = reinterpret_cast<const ushort *>(layoutData->string.unicode()); | - | ||||||||||||||||||||||||
1534 | uc = string + offset; | - | ||||||||||||||||||||||||
1535 | e = uc + length; | - | ||||||||||||||||||||||||
1536 | *const_cast<ushort*>(uc) = 0x21B5; | - | ||||||||||||||||||||||||
1537 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1538 | break; never executed: break; | 0 | ||||||||||||||||||||||||
1539 | case never executed: QChar::Tabulation:case QChar::Tabulation: never executed: case QChar::Tabulation: | 0 | ||||||||||||||||||||||||
1540 | analysis->flags = QScriptAnalysis::Tab; | - | ||||||||||||||||||||||||
1541 | analysis->bidiLevel = control.baseLevel(); | - | ||||||||||||||||||||||||
1542 | break; never executed: break; | 0 | ||||||||||||||||||||||||
1543 | case never executed: QChar::Space:case QChar::Space: never executed: case QChar::Space: | 0 | ||||||||||||||||||||||||
1544 | case never executed: QChar::Nbsp:case QChar::Nbsp: never executed: case QChar::Nbsp: | 0 | ||||||||||||||||||||||||
1545 | if (option.flags() & QTextOption::ShowTabsAndSpaces
| 0 | ||||||||||||||||||||||||
1546 | analysis->flags = QScriptAnalysis::Space; | - | ||||||||||||||||||||||||
1547 | analysis->bidiLevel = control.baseLevel(); | - | ||||||||||||||||||||||||
1548 | break; never executed: break; | 0 | ||||||||||||||||||||||||
1549 | } | - | ||||||||||||||||||||||||
1550 | - | |||||||||||||||||||||||||
1551 | default never executed: :default: never executed: default: code before this statement never executed: default: | 0 | ||||||||||||||||||||||||
1552 | analysis->flags = QScriptAnalysis::None; | - | ||||||||||||||||||||||||
1553 | break; never executed: break; | 0 | ||||||||||||||||||||||||
1554 | } | - | ||||||||||||||||||||||||
1555 | - | |||||||||||||||||||||||||
1556 | - | |||||||||||||||||||||||||
1557 | - | |||||||||||||||||||||||||
1558 | ++uc; | - | ||||||||||||||||||||||||
1559 | ++analysis; | - | ||||||||||||||||||||||||
1560 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1561 | if (option.flags() & QTextOption::ShowLineAndParagraphSeparators
| 0 | ||||||||||||||||||||||||
1562 | (analysis-1)->flags = QScriptAnalysis::LineOrParagraphSeparator; | - | ||||||||||||||||||||||||
1563 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1564 | - | |||||||||||||||||||||||||
1565 | analysis = scriptAnalysis.data(); | - | ||||||||||||||||||||||||
1566 | if (qt_useHarfbuzzNG()
| 0 | ||||||||||||||||||||||||
1567 | - | |||||||||||||||||||||||||
1568 | for (int i = 0; i < length
| 0 | ||||||||||||||||||||||||
1569 | switch (analysis[i].script) { | - | ||||||||||||||||||||||||
1570 | case never executed: QChar::Script_Latin:case QChar::Script_Latin: never executed: case QChar::Script_Latin: | 0 | ||||||||||||||||||||||||
1571 | case never executed: QChar::Script_Hiragana:case QChar::Script_Hiragana: never executed: case QChar::Script_Hiragana: | 0 | ||||||||||||||||||||||||
1572 | case never executed: QChar::Script_Katakana:case QChar::Script_Katakana: never executed: case QChar::Script_Katakana: | 0 | ||||||||||||||||||||||||
1573 | case never executed: QChar::Script_Bopomofo:case QChar::Script_Bopomofo: never executed: case QChar::Script_Bopomofo: | 0 | ||||||||||||||||||||||||
1574 | case never executed: QChar::Script_Han:case QChar::Script_Han: never executed: case QChar::Script_Han: | 0 | ||||||||||||||||||||||||
1575 | analysis[i].script = QChar::Script_Common; | - | ||||||||||||||||||||||||
1576 | break; never executed: break; | 0 | ||||||||||||||||||||||||
1577 | default never executed: :default: never executed: default: | 0 | ||||||||||||||||||||||||
1578 | break; never executed: break; | 0 | ||||||||||||||||||||||||
1579 | } | - | ||||||||||||||||||||||||
1580 | } | - | ||||||||||||||||||||||||
1581 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
1582 | for (int i = 0; i < length
| 0 | ||||||||||||||||||||||||
1583 | analysis[i].script = hbscript_to_script(script_to_hbscript(analysis[i].script)); never executed: analysis[i].script = hbscript_to_script(script_to_hbscript(analysis[i].script)); | 0 | ||||||||||||||||||||||||
1584 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1585 | - | |||||||||||||||||||||||||
1586 | - | |||||||||||||||||||||||||
1587 | Itemizer itemizer(layoutData->string, scriptAnalysis.data(), layoutData->items); | - | ||||||||||||||||||||||||
1588 | - | |||||||||||||||||||||||||
1589 | const QTextDocumentPrivate *p = block.docHandle(); | - | ||||||||||||||||||||||||
1590 | if (p
| 0 | ||||||||||||||||||||||||
1591 | SpecialData *s = specialData; | - | ||||||||||||||||||||||||
1592 | - | |||||||||||||||||||||||||
1593 | QTextDocumentPrivate::FragmentIterator it = p->find(block.position()); | - | ||||||||||||||||||||||||
1594 | QTextDocumentPrivate::FragmentIterator end = p->find(block.position() + block.length() - 1); | - | ||||||||||||||||||||||||
1595 | int format = it.value()->format; | - | ||||||||||||||||||||||||
1596 | - | |||||||||||||||||||||||||
1597 | int prevPosition = 0; | - | ||||||||||||||||||||||||
1598 | int position = prevPosition; | - | ||||||||||||||||||||||||
1599 | while (1) { | - | ||||||||||||||||||||||||
1600 | const QTextFragmentData * const frag = it.value(); | - | ||||||||||||||||||||||||
1601 | if (it == end
| 0 | ||||||||||||||||||||||||
1602 | if (s
| 0 | ||||||||||||||||||||||||
1603 | position += s->preeditText.length(); | - | ||||||||||||||||||||||||
1604 | s = 0; | - | ||||||||||||||||||||||||
1605 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1606 | ((!(position <= length)) ? qt_assert("position <= length",__FILE__,1725) : qt_noop()); | - | ||||||||||||||||||||||||
1607 | QFont::Capitalization capitalization = | - | ||||||||||||||||||||||||
1608 | formatCollection()->charFormat(format).hasProperty(QTextFormat::FontCapitalization)
| 0 | ||||||||||||||||||||||||
1609 | ? formatCollection()->charFormat(format).fontCapitalization() | - | ||||||||||||||||||||||||
1610 | : formatCollection()->defaultFont().capitalization(); | - | ||||||||||||||||||||||||
1611 | itemizer.generate(prevPosition, position - prevPosition, capitalization); | - | ||||||||||||||||||||||||
1612 | if (it == end
| 0 | ||||||||||||||||||||||||
1613 | if (position < length
| 0 | ||||||||||||||||||||||||
1614 | itemizer.generate(position, length - position, capitalization); never executed: itemizer.generate(position, length - position, capitalization); | 0 | ||||||||||||||||||||||||
1615 | break; never executed: break; | 0 | ||||||||||||||||||||||||
1616 | } | - | ||||||||||||||||||||||||
1617 | format = frag->format; | - | ||||||||||||||||||||||||
1618 | prevPosition = position; | - | ||||||||||||||||||||||||
1619 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1620 | position += frag->size_array[0]; | - | ||||||||||||||||||||||||
1621 | ++it; | - | ||||||||||||||||||||||||
1622 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1623 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
1624 | - | |||||||||||||||||||||||||
1625 | if (useRawFont
| 0 | ||||||||||||||||||||||||
1626 | int lastIndex = 0; | - | ||||||||||||||||||||||||
1627 | for (int i = 0; i < specialData->formats.size()
| 0 | ||||||||||||||||||||||||
1628 | const QTextLayout::FormatRange &range = specialData->formats.at(i); | - | ||||||||||||||||||||||||
1629 | const QTextCharFormat &format = range.format; | - | ||||||||||||||||||||||||
1630 | if (format.hasProperty(QTextFormat::FontCapitalization)
| 0 | ||||||||||||||||||||||||
1631 | itemizer.generate(lastIndex, range.start - lastIndex, QFont::MixedCase); | - | ||||||||||||||||||||||||
1632 | itemizer.generate(range.start, range.length, format.fontCapitalization()); | - | ||||||||||||||||||||||||
1633 | lastIndex = range.start + range.length; | - | ||||||||||||||||||||||||
1634 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1635 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1636 | itemizer.generate(lastIndex, length - lastIndex, QFont::MixedCase); | - | ||||||||||||||||||||||||
1637 | } never executed: elseend of block | 0 | ||||||||||||||||||||||||
1638 | - | |||||||||||||||||||||||||
1639 | itemizer.generate(0, length, static_cast<QFont::Capitalization> (fnt.d->capital)); never executed: itemizer.generate(0, length, static_cast<QFont::Capitalization> (fnt.d->capital)); | 0 | ||||||||||||||||||||||||
1640 | } | - | ||||||||||||||||||||||||
1641 | - | |||||||||||||||||||||||||
1642 | addRequiredBoundaries(); | - | ||||||||||||||||||||||||
1643 | resolveFormats(); | - | ||||||||||||||||||||||||
1644 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1645 | - | |||||||||||||||||||||||||
1646 | bool QTextEngine::isRightToLeft() const | - | ||||||||||||||||||||||||
1647 | { | - | ||||||||||||||||||||||||
1648 | switch (option.textDirection()) { | - | ||||||||||||||||||||||||
1649 | case never executed: Qt::LeftToRight:case Qt::LeftToRight: never executed: case Qt::LeftToRight: | 0 | ||||||||||||||||||||||||
1650 | return never executed: false;return false; never executed: return false; | 0 | ||||||||||||||||||||||||
1651 | case never executed: Qt::RightToLeft:case Qt::RightToLeft: never executed: case Qt::RightToLeft: | 0 | ||||||||||||||||||||||||
1652 | return never executed: true;return true; never executed: return true; | 0 | ||||||||||||||||||||||||
1653 | default never executed: :default: never executed: default: | 0 | ||||||||||||||||||||||||
1654 | break; never executed: break; | 0 | ||||||||||||||||||||||||
1655 | } | - | ||||||||||||||||||||||||
1656 | if (!layoutData
| 0 | ||||||||||||||||||||||||
1657 | itemize(); never executed: itemize(); | 0 | ||||||||||||||||||||||||
1658 | - | |||||||||||||||||||||||||
1659 | if (layoutData->string.isEmpty()
| 0 | ||||||||||||||||||||||||
1660 | return never executed: QGuiApplication::inputMethod()->inputDirection() == Qt::RightToLeft;return QGuiApplication::inputMethod()->inputDirection() == Qt::RightToLeft; never executed: return QGuiApplication::inputMethod()->inputDirection() == Qt::RightToLeft; | 0 | ||||||||||||||||||||||||
1661 | return never executed: layoutData->string.isRightToLeft();return layoutData->string.isRightToLeft(); never executed: return layoutData->string.isRightToLeft(); | 0 | ||||||||||||||||||||||||
1662 | } | - | ||||||||||||||||||||||||
1663 | - | |||||||||||||||||||||||||
1664 | - | |||||||||||||||||||||||||
1665 | int QTextEngine::findItem(int strPos, int firstItem) const | - | ||||||||||||||||||||||||
1666 | { | - | ||||||||||||||||||||||||
1667 | itemize(); | - | ||||||||||||||||||||||||
1668 | if (strPos < 0
| 0 | ||||||||||||||||||||||||
1669 | return never executed: -1;return -1; never executed: return -1; | 0 | ||||||||||||||||||||||||
1670 | - | |||||||||||||||||||||||||
1671 | int left = firstItem + 1; | - | ||||||||||||||||||||||||
1672 | int right = layoutData->items.size()-1; | - | ||||||||||||||||||||||||
1673 | while(left <= right
| 0 | ||||||||||||||||||||||||
1674 | int middle = ((right-left)/2)+left; | - | ||||||||||||||||||||||||
1675 | if (strPos > layoutData->items[middle].position
| 0 | ||||||||||||||||||||||||
1676 | left = middle+1; never executed: left = middle+1; | 0 | ||||||||||||||||||||||||
1677 | else if(strPos < layoutData->items[middle].position
| 0 | ||||||||||||||||||||||||
1678 | right = middle-1; never executed: right = middle-1; | 0 | ||||||||||||||||||||||||
1679 | else { | - | ||||||||||||||||||||||||
1680 | return never executed: middle;return middle; never executed: return middle; | 0 | ||||||||||||||||||||||||
1681 | } | - | ||||||||||||||||||||||||
1682 | } | - | ||||||||||||||||||||||||
1683 | return never executed: right;return right; never executed: return right; | 0 | ||||||||||||||||||||||||
1684 | } | - | ||||||||||||||||||||||||
1685 | - | |||||||||||||||||||||||||
1686 | QFixed QTextEngine::width(int from, int len) const | - | ||||||||||||||||||||||||
1687 | { | - | ||||||||||||||||||||||||
1688 | itemize(); | - | ||||||||||||||||||||||||
1689 | - | |||||||||||||||||||||||||
1690 | QFixed w = 0; | - | ||||||||||||||||||||||||
1691 | - | |||||||||||||||||||||||||
1692 | - | |||||||||||||||||||||||||
1693 | for (int i = 0; i < layoutData->items.size()
| 0 | ||||||||||||||||||||||||
1694 | const QScriptItem *si = layoutData->items.constData() + i; | - | ||||||||||||||||||||||||
1695 | int pos = si->position; | - | ||||||||||||||||||||||||
1696 | int ilen = length(i); | - | ||||||||||||||||||||||||
1697 | - | |||||||||||||||||||||||||
1698 | if (pos >= from + len
| 0 | ||||||||||||||||||||||||
1699 | break; never executed: break; | 0 | ||||||||||||||||||||||||