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