Line | Source Code | Coverage |
---|
1 | | - |
2 | | - |
3 | | - |
4 | | - |
5 | | - |
6 | | - |
7 | | - |
8 | | - |
9 | bool QFontDef::exactMatch(const QFontDef &other) const | - |
10 | { | - |
11 | if (pixelSize != -1 && other.pixelSize != -1) { partially evaluated: pixelSize != -1 no Evaluation Count:0 | yes Evaluation Count:12 |
never evaluated: other.pixelSize != -1 | 0-12 |
12 | if (pixelSize != other.pixelSize) never evaluated: pixelSize != other.pixelSize | 0 |
13 | return false; never executed: return false; | 0 |
14 | } else if (pointSize != -1 && other.pointSize != -1) { partially evaluated: pointSize != -1 yes Evaluation Count:12 | no Evaluation Count:0 |
partially evaluated: other.pointSize != -1 yes Evaluation Count:12 | no Evaluation Count:0 |
| 0-12 |
15 | if (pointSize != other.pointSize) evaluated: pointSize != other.pointSize yes Evaluation Count:10 | yes Evaluation Count:2 |
| 2-10 |
16 | return false; executed: return false; Execution Count:10 | 10 |
17 | } else { executed: } Execution Count:2 | 2 |
18 | return false; never executed: return false; | 0 |
19 | } | - |
20 | | - |
21 | if (!ignorePitch && !other.ignorePitch && fixedPitch != other.fixedPitch) partially evaluated: !ignorePitch no Evaluation Count:0 | yes Evaluation Count:2 |
never evaluated: !other.ignorePitch never evaluated: fixedPitch != other.fixedPitch | 0-2 |
22 | return false; never executed: return false; | 0 |
23 | | - |
24 | if (stretch != 0 && other.stretch != 0 && stretch != other.stretch) partially evaluated: stretch != 0 yes Evaluation Count:2 | no Evaluation Count:0 |
partially evaluated: other.stretch != 0 yes Evaluation Count:2 | no Evaluation Count:0 |
partially evaluated: stretch != other.stretch no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
25 | return false; never executed: return false; | 0 |
26 | | - |
27 | QString this_family, this_foundry, other_family, other_foundry; | - |
28 | QFontDatabase::parseFontName(family, this_foundry, this_family); | - |
29 | QFontDatabase::parseFontName(other.family, other_foundry, other_family); | - |
30 | | - |
31 | this_family = QFontDatabase::resolveFontFamilyAlias(this_family); | - |
32 | other_family = QFontDatabase::resolveFontFamilyAlias(other_family); | - |
33 | | - |
34 | return (styleHint == other.styleHint | 2 |
35 | && styleStrategy == other.styleStrategy | 2 |
36 | && weight == other.weight | 2 |
37 | && style == other.style | 2 |
38 | && this_family == other_family | 2 |
39 | && (styleName.isEmpty() || other.styleName.isEmpty() || styleName == other.styleName) | 2 |
40 | && (this_foundry.isEmpty() | 2 |
41 | || other_foundry.isEmpty() | 2 |
42 | || this_foundry == other_foundry) | 2 |
43 | ); executed: return (styleHint == other.styleHint && styleStrategy == other.styleStrategy && weight == other.weight && style == other.style && this_family == other_family && (styleName.isEmpty() || other.styleName.isEmpty() || styleName == other.styleName) && (this_foundry.isEmpty() || other_foundry.isEmpty() || this_foundry == other_foundry) ); Execution Count:2 | 2 |
44 | } | - |
45 | | - |
46 | extern bool qt_is_gui_used; | - |
47 | | - |
48 | __attribute__((visibility("default"))) int qt_defaultDpiX() | - |
49 | { | - |
50 | if ((static_cast<QGuiApplication *>(QCoreApplication::instance()))->testAttribute(Qt::AA_Use96Dpi)) evaluated: (static_cast<QGuiApplication *>(QCoreApplication::instance()))->testAttribute(Qt::AA_Use96Dpi) yes Evaluation Count:183637 | yes Evaluation Count:194 |
| 194-183637 |
51 | return 96; executed: return 96; Execution Count:183637 | 183637 |
52 | | - |
53 | if (!qt_is_gui_used) partially evaluated: !qt_is_gui_used no Evaluation Count:0 | yes Evaluation Count:194 |
| 0-194 |
54 | return 75; never executed: return 75; | 0 |
55 | | - |
56 | if (const QScreen *screen = QGuiApplication::primaryScreen()) partially evaluated: const QScreen *screen = QGuiApplication::primaryScreen() yes Evaluation Count:194 | no Evaluation Count:0 |
| 0-194 |
57 | return qRound(screen->logicalDotsPerInchX()); executed: return qRound(screen->logicalDotsPerInchX()); Execution Count:194 | 194 |
58 | | - |
59 | | - |
60 | return 100; never executed: return 100; | 0 |
61 | } | - |
62 | | - |
63 | __attribute__((visibility("default"))) int qt_defaultDpiY() | - |
64 | { | - |
65 | if ((static_cast<QGuiApplication *>(QCoreApplication::instance()))->testAttribute(Qt::AA_Use96Dpi)) evaluated: (static_cast<QGuiApplication *>(QCoreApplication::instance()))->testAttribute(Qt::AA_Use96Dpi) yes Evaluation Count:233306 | yes Evaluation Count:503 |
| 503-233306 |
66 | return 96; executed: return 96; Execution Count:233306 | 233306 |
67 | | - |
68 | if (!qt_is_gui_used) partially evaluated: !qt_is_gui_used no Evaluation Count:0 | yes Evaluation Count:503 |
| 0-503 |
69 | return 75; never executed: return 75; | 0 |
70 | | - |
71 | if (const QScreen *screen = QGuiApplication::primaryScreen()) evaluated: const QScreen *screen = QGuiApplication::primaryScreen() yes Evaluation Count:491 | yes Evaluation Count:12 |
| 12-491 |
72 | return qRound(screen->logicalDotsPerInchY()); executed: return qRound(screen->logicalDotsPerInchY()); Execution Count:491 | 491 |
73 | | - |
74 | | - |
75 | return 100; executed: return 100; Execution Count:12 | 12 |
76 | } | - |
77 | | - |
78 | __attribute__((visibility("default"))) int qt_defaultDpi() | - |
79 | { | - |
80 | return qt_defaultDpiY(); executed: return qt_defaultDpiY(); Execution Count:50824 | 50824 |
81 | } | - |
82 | | - |
83 | QFontPrivate::QFontPrivate() | - |
84 | : engineData(0), dpi(qt_defaultDpi()), screen(0), | - |
85 | rawMode(false), underline(false), overline(false), strikeOut(false), kerning(true), | - |
86 | capital(0), letterSpacingIsAbsolute(false), scFont(0) | - |
87 | { | - |
88 | } executed: } Execution Count:1921 | 1921 |
89 | | - |
90 | QFontPrivate::QFontPrivate(const QFontPrivate &other) | - |
91 | : request(other.request), engineData(0), dpi(other.dpi), screen(other.screen), | - |
92 | rawMode(other.rawMode), underline(other.underline), overline(other.overline), | - |
93 | strikeOut(other.strikeOut), kerning(other.kerning), | - |
94 | capital(other.capital), letterSpacingIsAbsolute(other.letterSpacingIsAbsolute), | - |
95 | letterSpacing(other.letterSpacing), wordSpacing(other.wordSpacing), | - |
96 | scFont(other.scFont) | - |
97 | { | - |
98 | if (scFont && scFont != this) partially evaluated: scFont no Evaluation Count:0 | yes Evaluation Count:40097 |
never evaluated: scFont != this | 0-40097 |
99 | scFont->ref.ref(); never executed: scFont->ref.ref(); | 0 |
100 | } executed: } Execution Count:40097 | 40097 |
101 | | - |
102 | QFontPrivate::~QFontPrivate() | - |
103 | { | - |
104 | if (engineData) evaluated: engineData yes Evaluation Count:29982 | yes Evaluation Count:12002 |
| 12002-29982 |
105 | engineData->ref.deref(); executed: engineData->ref.deref(); Execution Count:29982 | 29982 |
106 | engineData = 0; | - |
107 | if (scFont && scFont != this) partially evaluated: scFont no Evaluation Count:0 | yes Evaluation Count:41984 |
never evaluated: scFont != this | 0-41984 |
108 | scFont->ref.deref(); never executed: scFont->ref.deref(); | 0 |
109 | scFont = 0; | - |
110 | } executed: } Execution Count:41984 | 41984 |
111 | | - |
112 | extern QMutex *qt_fontdatabase_mutex(); | - |
113 | | - |
114 | | - |
115 | | - |
116 | QFontEngine *QFontPrivate::engineForScript(int script) const | - |
117 | { | - |
118 | QMutexLocker locker(qt_fontdatabase_mutex()); | - |
119 | if (script >= QUnicodeTables::Inherited) partially evaluated: script >= QUnicodeTables::Inherited no Evaluation Count:0 | yes Evaluation Count:380606 |
| 0-380606 |
120 | script = QUnicodeTables::Common; never executed: script = QUnicodeTables::Common; | 0 |
121 | if (engineData && engineData->fontCache != QFontCache::instance()) { evaluated: engineData yes Evaluation Count:350696 | yes Evaluation Count:29910 |
partially evaluated: engineData->fontCache != QFontCache::instance() no Evaluation Count:0 | yes Evaluation Count:350696 |
| 0-350696 |
122 | | - |
123 | engineData->ref.deref(); | - |
124 | engineData = 0; | - |
125 | } | 0 |
126 | if (!engineData || !engineData->engines[script]) evaluated: !engineData yes Evaluation Count:29910 | yes Evaluation Count:350696 |
evaluated: !engineData->engines[script] yes Evaluation Count:19 | yes Evaluation Count:350677 |
| 19-350696 |
127 | QFontDatabase::load(this, script); executed: QFontDatabase::load(this, script); Execution Count:29929 | 29929 |
128 | return engineData->engines[script]; executed: return engineData->engines[script]; Execution Count:380606 | 380606 |
129 | } | - |
130 | | - |
131 | void QFontPrivate::alterCharForCapitalization(QChar &c) const { | - |
132 | switch (capital) { | - |
133 | case QFont::AllUppercase: | - |
134 | case QFont::SmallCaps: | - |
135 | c = c.toUpper(); | - |
136 | break; | 0 |
137 | case QFont::AllLowercase: | - |
138 | c = c.toLower(); | - |
139 | break; | 0 |
140 | case QFont::MixedCase: | - |
141 | break; executed: break; Execution Count:1974 | 1974 |
142 | } | - |
143 | } executed: } Execution Count:1974 | 1974 |
144 | | - |
145 | QFontPrivate *QFontPrivate::smallCapsFontPrivate() const | - |
146 | { | - |
147 | if (scFont) | 0 |
148 | return scFont; never executed: return scFont; | 0 |
149 | QFont font(const_cast<QFontPrivate *>(this)); | - |
150 | qreal pointSize = font.pointSizeF(); | - |
151 | if (pointSize > 0) never evaluated: pointSize > 0 | 0 |
152 | font.setPointSizeF(pointSize * .7); never executed: font.setPointSizeF(pointSize * .7); | 0 |
153 | else | - |
154 | font.setPixelSize((font.pixelSize() * 7 + 5) / 10); never executed: font.setPixelSize((font.pixelSize() * 7 + 5) / 10); | 0 |
155 | scFont = font.d.data(); | - |
156 | if (scFont != this) never evaluated: scFont != this | 0 |
157 | scFont->ref.ref(); never executed: scFont->ref.ref(); | 0 |
158 | return scFont; never executed: return scFont; | 0 |
159 | } | - |
160 | | - |
161 | | - |
162 | void QFontPrivate::resolve(uint mask, const QFontPrivate *other) | - |
163 | { | - |
164 | qt_noop(); | - |
165 | | - |
166 | dpi = other->dpi; | - |
167 | | - |
168 | if ((mask & QFont::AllPropertiesResolved) == QFont::AllPropertiesResolved) return; partially evaluated: (mask & QFont::AllPropertiesResolved) == QFont::AllPropertiesResolved no Evaluation Count:0 | yes Evaluation Count:5312 |
| 0-5312 |
169 | | - |
170 | | - |
171 | if (! (mask & QFont::FamilyResolved)) evaluated: ! (mask & QFont::FamilyResolved) yes Evaluation Count:1825 | yes Evaluation Count:3487 |
| 1825-3487 |
172 | request.family = other->request.family; executed: request.family = other->request.family; Execution Count:1825 | 1825 |
173 | | - |
174 | if (! (mask & QFont::StyleNameResolved)) evaluated: ! (mask & QFont::StyleNameResolved) yes Evaluation Count:5222 | yes Evaluation Count:90 |
| 90-5222 |
175 | request.styleName = other->request.styleName; executed: request.styleName = other->request.styleName; Execution Count:5222 | 5222 |
176 | | - |
177 | if (! (mask & QFont::SizeResolved)) { evaluated: ! (mask & QFont::SizeResolved) yes Evaluation Count:2187 | yes Evaluation Count:3125 |
| 2187-3125 |
178 | request.pointSize = other->request.pointSize; | - |
179 | request.pixelSize = other->request.pixelSize; | - |
180 | } executed: } Execution Count:2187 | 2187 |
181 | | - |
182 | if (! (mask & QFont::StyleHintResolved)) evaluated: ! (mask & QFont::StyleHintResolved) yes Evaluation Count:2565 | yes Evaluation Count:2747 |
| 2565-2747 |
183 | request.styleHint = other->request.styleHint; executed: request.styleHint = other->request.styleHint; Execution Count:2565 | 2565 |
184 | | - |
185 | if (! (mask & QFont::StyleStrategyResolved)) evaluated: ! (mask & QFont::StyleStrategyResolved) yes Evaluation Count:2559 | yes Evaluation Count:2753 |
| 2559-2753 |
186 | request.styleStrategy = other->request.styleStrategy; executed: request.styleStrategy = other->request.styleStrategy; Execution Count:2559 | 2559 |
187 | | - |
188 | if (! (mask & QFont::WeightResolved)) evaluated: ! (mask & QFont::WeightResolved) yes Evaluation Count:1729 | yes Evaluation Count:3583 |
| 1729-3583 |
189 | request.weight = other->request.weight; executed: request.weight = other->request.weight; Execution Count:1729 | 1729 |
190 | | - |
191 | if (! (mask & QFont::StyleResolved)) evaluated: ! (mask & QFont::StyleResolved) yes Evaluation Count:2415 | yes Evaluation Count:2897 |
| 2415-2897 |
192 | request.style = other->request.style; executed: request.style = other->request.style; Execution Count:2415 | 2415 |
193 | | - |
194 | if (! (mask & QFont::FixedPitchResolved)) evaluated: ! (mask & QFont::FixedPitchResolved) yes Evaluation Count:4770 | yes Evaluation Count:542 |
| 542-4770 |
195 | request.fixedPitch = other->request.fixedPitch; executed: request.fixedPitch = other->request.fixedPitch; Execution Count:4770 | 4770 |
196 | | - |
197 | if (! (mask & QFont::StretchResolved)) evaluated: ! (mask & QFont::StretchResolved) yes Evaluation Count:2563 | yes Evaluation Count:2749 |
| 2563-2749 |
198 | request.stretch = other->request.stretch; executed: request.stretch = other->request.stretch; Execution Count:2563 | 2563 |
199 | | - |
200 | if (! (mask & QFont::HintingPreferenceResolved)) partially evaluated: ! (mask & QFont::HintingPreferenceResolved) yes Evaluation Count:5312 | no Evaluation Count:0 |
| 0-5312 |
201 | request.hintingPreference = other->request.hintingPreference; executed: request.hintingPreference = other->request.hintingPreference; Execution Count:5312 | 5312 |
202 | | - |
203 | if (! (mask & QFont::UnderlineResolved)) evaluated: ! (mask & QFont::UnderlineResolved) yes Evaluation Count:2378 | yes Evaluation Count:2934 |
| 2378-2934 |
204 | underline = other->underline; executed: underline = other->underline; Execution Count:2378 | 2378 |
205 | | - |
206 | if (! (mask & QFont::OverlineResolved)) evaluated: ! (mask & QFont::OverlineResolved) yes Evaluation Count:2556 | yes Evaluation Count:2756 |
| 2556-2756 |
207 | overline = other->overline; executed: overline = other->overline; Execution Count:2556 | 2556 |
208 | | - |
209 | if (! (mask & QFont::StrikeOutResolved)) evaluated: ! (mask & QFont::StrikeOutResolved) yes Evaluation Count:2463 | yes Evaluation Count:2849 |
| 2463-2849 |
210 | strikeOut = other->strikeOut; executed: strikeOut = other->strikeOut; Execution Count:2463 | 2463 |
211 | | - |
212 | if (! (mask & QFont::KerningResolved)) evaluated: ! (mask & QFont::KerningResolved) yes Evaluation Count:2565 | yes Evaluation Count:2747 |
| 2565-2747 |
213 | kerning = other->kerning; executed: kerning = other->kerning; Execution Count:2565 | 2565 |
214 | | - |
215 | if (! (mask & QFont::LetterSpacingResolved)) { evaluated: ! (mask & QFont::LetterSpacingResolved) yes Evaluation Count:2565 | yes Evaluation Count:2747 |
| 2565-2747 |
216 | letterSpacing = other->letterSpacing; | - |
217 | letterSpacingIsAbsolute = other->letterSpacingIsAbsolute; | - |
218 | } executed: } Execution Count:2565 | 2565 |
219 | if (! (mask & QFont::WordSpacingResolved)) evaluated: ! (mask & QFont::WordSpacingResolved) yes Evaluation Count:2563 | yes Evaluation Count:2749 |
| 2563-2749 |
220 | wordSpacing = other->wordSpacing; executed: wordSpacing = other->wordSpacing; Execution Count:2563 | 2563 |
221 | if (! (mask & QFont::CapitalizationResolved)) evaluated: ! (mask & QFont::CapitalizationResolved) yes Evaluation Count:2559 | yes Evaluation Count:2753 |
| 2559-2753 |
222 | capital = other->capital; executed: capital = other->capital; Execution Count:2559 | 2559 |
223 | } executed: } Execution Count:5312 | 5312 |
224 | | - |
225 | | - |
226 | | - |
227 | | - |
228 | QFontEngineData::QFontEngineData() | - |
229 | : ref(1), fontCache(QFontCache::instance()) | - |
230 | { | - |
231 | memset(engines, 0, QUnicodeTables::ScriptCount * sizeof(QFontEngine *)); | - |
232 | } executed: } Execution Count:610 | 610 |
233 | | - |
234 | QFontEngineData::~QFontEngineData() | - |
235 | { | - |
236 | for (int i = 0; i < QUnicodeTables::ScriptCount; ++i) { evaluated: i < QUnicodeTables::ScriptCount yes Evaluation Count:14280 | yes Evaluation Count:510 |
| 510-14280 |
237 | if (engines[i]) partially evaluated: engines[i] no Evaluation Count:0 | yes Evaluation Count:14280 |
| 0-14280 |
238 | engines[i]->ref.deref(); never executed: engines[i]->ref.deref(); | 0 |
239 | engines[i] = 0; | - |
240 | } executed: } Execution Count:14280 | 14280 |
241 | } executed: } Execution Count:510 | 510 |
242 | QFont::QFont(const QFont &font, QPaintDevice *pd) | - |
243 | : resolve_mask(font.resolve_mask) | - |
244 | { | - |
245 | qt_noop(); | - |
246 | int dpi = pd->logicalDpiY(); | - |
247 | const int screen = 0; | - |
248 | if (font.d->dpi != dpi || font.d->screen != screen ) { evaluated: font.d->dpi != dpi yes Evaluation Count:5208 | yes Evaluation Count:75046 |
partially evaluated: font.d->screen != screen no Evaluation Count:0 | yes Evaluation Count:75046 |
| 0-75046 |
249 | d = new QFontPrivate(*font.d); | - |
250 | d->dpi = dpi; | - |
251 | d->screen = screen; | - |
252 | } else { executed: } Execution Count:5208 | 5208 |
253 | d = font.d.data(); | - |
254 | } executed: } Execution Count:75046 | 75046 |
255 | } | - |
256 | | - |
257 | | - |
258 | | - |
259 | | - |
260 | QFont::QFont(QFontPrivate *data) | - |
261 | : d(data), resolve_mask(QFont::AllPropertiesResolved) | - |
262 | { | - |
263 | } executed: } Execution Count:43777 | 43777 |
264 | | - |
265 | | - |
266 | | - |
267 | | - |
268 | void QFont::detach() | - |
269 | { | - |
270 | if (d->ref.load() == 1) { evaluated: d->ref.load() == 1 yes Evaluation Count:17218 | yes Evaluation Count:34784 |
| 17218-34784 |
271 | if (d->engineData) partially evaluated: d->engineData no Evaluation Count:0 | yes Evaluation Count:17218 |
| 0-17218 |
272 | d->engineData->ref.deref(); never executed: d->engineData->ref.deref(); | 0 |
273 | d->engineData = 0; | - |
274 | if (d->scFont && d->scFont != d.data()) partially evaluated: d->scFont no Evaluation Count:0 | yes Evaluation Count:17218 |
never evaluated: d->scFont != d.data() | 0-17218 |
275 | d->scFont->ref.deref(); never executed: d->scFont->ref.deref(); | 0 |
276 | d->scFont = 0; | - |
277 | return; executed: return; Execution Count:17218 | 17218 |
278 | } | - |
279 | | - |
280 | d.detach(); | - |
281 | } executed: } Execution Count:34784 | 34784 |
282 | | - |
283 | | - |
284 | | - |
285 | | - |
286 | | - |
287 | | - |
288 | | - |
289 | void QFontPrivate::detachButKeepEngineData(QFont *font) | - |
290 | { | - |
291 | if (font->d->ref.load() == 1) evaluated: font->d->ref.load() == 1 yes Evaluation Count:21829 | yes Evaluation Count:103 |
| 103-21829 |
292 | return; executed: return; Execution Count:21829 | 21829 |
293 | | - |
294 | QFontEngineData *engineData = font->d->engineData; | - |
295 | if (engineData) evaluated: engineData yes Evaluation Count:94 | yes Evaluation Count:9 |
| 9-94 |
296 | engineData->ref.ref(); executed: engineData->ref.ref(); Execution Count:94 | 94 |
297 | font->d.detach(); | - |
298 | font->d->engineData = engineData; | - |
299 | } executed: } Execution Count:103 | 103 |
300 | | - |
301 | | - |
302 | | - |
303 | | - |
304 | | - |
305 | | - |
306 | QFont::QFont() | - |
307 | : d(QGuiApplicationPrivate::instance() ? QGuiApplication::font().d.data() : new QFontPrivate()), resolve_mask(0) | - |
308 | { | - |
309 | } executed: } Execution Count:1041278 | 1041278 |
310 | QFont::QFont(const QString &family, int pointSize, int weight, bool italic) | - |
311 | : d(new QFontPrivate()), resolve_mask(QFont::FamilyResolved) | - |
312 | { | - |
313 | if (pointSize <= 0) { evaluated: pointSize <= 0 yes Evaluation Count:212 | yes Evaluation Count:1327 |
| 212-1327 |
314 | pointSize = 12; | - |
315 | } else { executed: } Execution Count:212 | 212 |
316 | resolve_mask |= QFont::SizeResolved; | - |
317 | } executed: } Execution Count:1327 | 1327 |
318 | | - |
319 | if (weight < 0) { evaluated: weight < 0 yes Evaluation Count:537 | yes Evaluation Count:1002 |
| 537-1002 |
320 | weight = Normal; | - |
321 | } else { executed: } Execution Count:537 | 537 |
322 | resolve_mask |= QFont::WeightResolved | QFont::StyleResolved; | - |
323 | } executed: } Execution Count:1002 | 1002 |
324 | | - |
325 | if (italic) evaluated: italic yes Evaluation Count:72 | yes Evaluation Count:1467 |
| 72-1467 |
326 | resolve_mask |= QFont::StyleResolved; executed: resolve_mask |= QFont::StyleResolved; Execution Count:72 | 72 |
327 | | - |
328 | d->request.family = family; | - |
329 | d->request.pointSize = qreal(pointSize); | - |
330 | d->request.pixelSize = -1; | - |
331 | d->request.weight = weight; | - |
332 | d->request.style = italic ? QFont::StyleItalic : QFont::StyleNormal; evaluated: italic yes Evaluation Count:72 | yes Evaluation Count:1467 |
| 72-1467 |
333 | } executed: } Execution Count:1539 | 1539 |
334 | | - |
335 | | - |
336 | | - |
337 | | - |
338 | QFont::QFont(const QFont &font) | - |
339 | : d(font.d.data()), resolve_mask(font.resolve_mask) | - |
340 | { | - |
341 | } executed: } Execution Count:2905296 | 2905296 |
342 | | - |
343 | | - |
344 | | - |
345 | | - |
346 | QFont::~QFont() | - |
347 | { | - |
348 | } | - |
349 | | - |
350 | | - |
351 | | - |
352 | | - |
353 | QFont &QFont::operator=(const QFont &font) | - |
354 | { | - |
355 | d = font.d.data(); | - |
356 | resolve_mask = font.resolve_mask; | - |
357 | return *this; executed: return *this; Execution Count:421397 | 421397 |
358 | } | - |
359 | QString QFont::family() const | - |
360 | { | - |
361 | return d->request.family; executed: return d->request.family; Execution Count:16119 | 16119 |
362 | } | - |
363 | void QFont::setFamily(const QString &family) | - |
364 | { | - |
365 | if ((resolve_mask & QFont::FamilyResolved) && d->request.family == family) evaluated: (resolve_mask & QFont::FamilyResolved) yes Evaluation Count:1 | yes Evaluation Count:3596 |
partially evaluated: d->request.family == family no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-3596 |
366 | return; | 0 |
367 | | - |
368 | detach(); | - |
369 | | - |
370 | d->request.family = family; | - |
371 | | - |
372 | resolve_mask |= QFont::FamilyResolved; | - |
373 | } executed: } Execution Count:3597 | 3597 |
374 | QString QFont::styleName() const | - |
375 | { | - |
376 | return d->request.styleName; executed: return d->request.styleName; Execution Count:2 | 2 |
377 | } | - |
378 | void QFont::setStyleName(const QString &styleName) | - |
379 | { | - |
380 | if ((resolve_mask & QFont::StyleNameResolved) && d->request.styleName == styleName) partially evaluated: (resolve_mask & QFont::StyleNameResolved) no Evaluation Count:0 | yes Evaluation Count:761 |
never evaluated: d->request.styleName == styleName | 0-761 |
381 | return; | 0 |
382 | | - |
383 | detach(); | - |
384 | | - |
385 | d->request.styleName = styleName; | - |
386 | resolve_mask |= QFont::StyleNameResolved; | - |
387 | } executed: } Execution Count:761 | 761 |
388 | | - |
389 | | - |
390 | | - |
391 | | - |
392 | | - |
393 | | - |
394 | | - |
395 | int QFont::pointSize() const | - |
396 | { | - |
397 | return qRound(d->request.pointSize); executed: return qRound(d->request.pointSize); Execution Count:300 | 300 |
398 | } | - |
399 | void QFont::setHintingPreference(HintingPreference hintingPreference) | - |
400 | { | - |
401 | if ((resolve_mask & QFont::HintingPreferenceResolved) && d->request.hintingPreference == hintingPreference) partially evaluated: (resolve_mask & QFont::HintingPreferenceResolved) no Evaluation Count:0 | yes Evaluation Count:24 |
never evaluated: d->request.hintingPreference == hintingPreference | 0-24 |
402 | return; | 0 |
403 | | - |
404 | detach(); | - |
405 | | - |
406 | d->request.hintingPreference = hintingPreference; | - |
407 | | - |
408 | resolve_mask |= QFont::HintingPreferenceResolved; | - |
409 | } executed: } Execution Count:24 | 24 |
410 | | - |
411 | | - |
412 | | - |
413 | | - |
414 | | - |
415 | | - |
416 | QFont::HintingPreference QFont::hintingPreference() const | - |
417 | { | - |
418 | return QFont::HintingPreference(d->request.hintingPreference); executed: return QFont::HintingPreference(d->request.hintingPreference); Execution Count:32 | 32 |
419 | } | - |
420 | | - |
421 | | - |
422 | | - |
423 | | - |
424 | | - |
425 | | - |
426 | | - |
427 | void QFont::setPointSize(int pointSize) | - |
428 | { | - |
429 | if (pointSize <= 0) { partially evaluated: pointSize <= 0 no Evaluation Count:0 | yes Evaluation Count:62 |
| 0-62 |
430 | QMessageLogger("text/qfont.cpp", 948, __PRETTY_FUNCTION__).warning("QFont::setPointSize: Point size <= 0 (%d), must be greater than 0", pointSize); | - |
431 | return; | 0 |
432 | } | - |
433 | | - |
434 | if ((resolve_mask & QFont::SizeResolved) && d->request.pointSize == qreal(pointSize)) evaluated: (resolve_mask & QFont::SizeResolved) yes Evaluation Count:7 | yes Evaluation Count:55 |
partially evaluated: d->request.pointSize == qreal(pointSize) no Evaluation Count:0 | yes Evaluation Count:7 |
| 0-55 |
435 | return; | 0 |
436 | | - |
437 | detach(); | - |
438 | | - |
439 | d->request.pointSize = qreal(pointSize); | - |
440 | d->request.pixelSize = -1; | - |
441 | | - |
442 | resolve_mask |= QFont::SizeResolved; | - |
443 | } executed: } Execution Count:62 | 62 |
444 | void QFont::setPointSizeF(qreal pointSize) | - |
445 | { | - |
446 | if (pointSize <= 0) { partially evaluated: pointSize <= 0 no Evaluation Count:0 | yes Evaluation Count:3214 |
| 0-3214 |
447 | QMessageLogger("text/qfont.cpp", 973, __PRETTY_FUNCTION__).warning("QFont::setPointSizeF: Point size <= 0 (%f), must be greater than 0", pointSize); | - |
448 | return; | 0 |
449 | } | - |
450 | | - |
451 | if ((resolve_mask & QFont::SizeResolved) && d->request.pointSize == pointSize) partially evaluated: (resolve_mask & QFont::SizeResolved) no Evaluation Count:0 | yes Evaluation Count:3214 |
never evaluated: d->request.pointSize == pointSize | 0-3214 |
452 | return; | 0 |
453 | | - |
454 | detach(); | - |
455 | | - |
456 | d->request.pointSize = pointSize; | - |
457 | d->request.pixelSize = -1; | - |
458 | | - |
459 | resolve_mask |= QFont::SizeResolved; | - |
460 | } executed: } Execution Count:3214 | 3214 |
461 | | - |
462 | | - |
463 | | - |
464 | | - |
465 | | - |
466 | | - |
467 | | - |
468 | qreal QFont::pointSizeF() const | - |
469 | { | - |
470 | return d->request.pointSize; executed: return d->request.pointSize; Execution Count:14534 | 14534 |
471 | } | - |
472 | void QFont::setPixelSize(int pixelSize) | - |
473 | { | - |
474 | if (pixelSize <= 0) { partially evaluated: pixelSize <= 0 no Evaluation Count:0 | yes Evaluation Count:165 |
| 0-165 |
475 | QMessageLogger("text/qfont.cpp", 1011, __PRETTY_FUNCTION__).warning("QFont::setPixelSize: Pixel size <= 0 (%d)", pixelSize); | - |
476 | return; | 0 |
477 | } | - |
478 | | - |
479 | if ((resolve_mask & QFont::SizeResolved) && d->request.pixelSize == qreal(pixelSize)) evaluated: (resolve_mask & QFont::SizeResolved) yes Evaluation Count:89 | yes Evaluation Count:76 |
partially evaluated: d->request.pixelSize == qreal(pixelSize) no Evaluation Count:0 | yes Evaluation Count:89 |
| 0-89 |
480 | return; | 0 |
481 | | - |
482 | detach(); | - |
483 | | - |
484 | d->request.pixelSize = pixelSize; | - |
485 | d->request.pointSize = -1; | - |
486 | | - |
487 | resolve_mask |= QFont::SizeResolved; | - |
488 | } executed: } Execution Count:165 | 165 |
489 | int QFont::pixelSize() const | - |
490 | { | - |
491 | return d->request.pixelSize; executed: return d->request.pixelSize; Execution Count:367 | 367 |
492 | } | - |
493 | QFont::Style QFont::style() const | - |
494 | { | - |
495 | return (QFont::Style)d->request.style; executed: return (QFont::Style)d->request.style; Execution Count:14811 | 14811 |
496 | } | - |
497 | | - |
498 | | - |
499 | | - |
500 | | - |
501 | | - |
502 | | - |
503 | | - |
504 | void QFont::setStyle(Style style) | - |
505 | { | - |
506 | if ((resolve_mask & QFont::StyleResolved) && d->request.style == style) evaluated: (resolve_mask & QFont::StyleResolved) yes Evaluation Count:841 | yes Evaluation Count:3037 |
evaluated: d->request.style == style yes Evaluation Count:429 | yes Evaluation Count:412 |
| 412-3037 |
507 | return; executed: return; Execution Count:429 | 429 |
508 | | - |
509 | detach(); | - |
510 | | - |
511 | d->request.style = style; | - |
512 | resolve_mask |= QFont::StyleResolved; | - |
513 | } executed: } Execution Count:3449 | 3449 |
514 | | - |
515 | | - |
516 | | - |
517 | | - |
518 | | - |
519 | | - |
520 | | - |
521 | int QFont::weight() const | - |
522 | { | - |
523 | return d->request.weight; executed: return d->request.weight; Execution Count:14711 | 14711 |
524 | } | - |
525 | void QFont::setWeight(int weight) | - |
526 | { | - |
527 | qt_noop(); | - |
528 | | - |
529 | if ((resolve_mask & QFont::WeightResolved) && d->request.weight == weight) evaluated: (resolve_mask & QFont::WeightResolved) yes Evaluation Count:5 | yes Evaluation Count:28623 |
partially evaluated: d->request.weight == weight no Evaluation Count:0 | yes Evaluation Count:5 |
| 0-28623 |
530 | return; | 0 |
531 | | - |
532 | detach(); | - |
533 | | - |
534 | d->request.weight = weight; | - |
535 | resolve_mask |= QFont::WeightResolved; | - |
536 | } executed: } Execution Count:28628 | 28628 |
537 | bool QFont::underline() const | - |
538 | { | - |
539 | return d->underline; executed: return d->underline; Execution Count:14390 | 14390 |
540 | } | - |
541 | | - |
542 | | - |
543 | | - |
544 | | - |
545 | | - |
546 | | - |
547 | | - |
548 | void QFont::setUnderline(bool enable) | - |
549 | { | - |
550 | if ((resolve_mask & QFont::UnderlineResolved) && d->underline == enable) evaluated: (resolve_mask & QFont::UnderlineResolved) yes Evaluation Count:2 | yes Evaluation Count:3565 |
partially evaluated: d->underline == enable no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-3565 |
551 | return; | 0 |
552 | | - |
553 | QFontPrivate::detachButKeepEngineData(this); | - |
554 | | - |
555 | d->underline = enable; | - |
556 | resolve_mask |= QFont::UnderlineResolved; | - |
557 | } executed: } Execution Count:3567 | 3567 |
558 | | - |
559 | | - |
560 | | - |
561 | | - |
562 | | - |
563 | | - |
564 | bool QFont::overline() const | - |
565 | { | - |
566 | return d->overline; executed: return d->overline; Execution Count:14202 | 14202 |
567 | } | - |
568 | | - |
569 | | - |
570 | | - |
571 | | - |
572 | | - |
573 | | - |
574 | void QFont::setOverline(bool enable) | - |
575 | { | - |
576 | if ((resolve_mask & QFont::OverlineResolved) && d->overline == enable) evaluated: (resolve_mask & QFont::OverlineResolved) yes Evaluation Count:2 | yes Evaluation Count:2986 |
partially evaluated: d->overline == enable no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2986 |
577 | return; | 0 |
578 | | - |
579 | QFontPrivate::detachButKeepEngineData(this); | - |
580 | | - |
581 | d->overline = enable; | - |
582 | resolve_mask |= QFont::OverlineResolved; | - |
583 | } executed: } Execution Count:2988 | 2988 |
584 | | - |
585 | | - |
586 | | - |
587 | | - |
588 | | - |
589 | | - |
590 | bool QFont::strikeOut() const | - |
591 | { | - |
592 | return d->strikeOut; executed: return d->strikeOut; Execution Count:14373 | 14373 |
593 | } | - |
594 | | - |
595 | | - |
596 | | - |
597 | | - |
598 | | - |
599 | | - |
600 | | - |
601 | void QFont::setStrikeOut(bool enable) | - |
602 | { | - |
603 | if ((resolve_mask & QFont::StrikeOutResolved) && d->strikeOut == enable) evaluated: (resolve_mask & QFont::StrikeOutResolved) yes Evaluation Count:2 | yes Evaluation Count:3481 |
partially evaluated: d->strikeOut == enable no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-3481 |
604 | return; | 0 |
605 | | - |
606 | QFontPrivate::detachButKeepEngineData(this); | - |
607 | | - |
608 | d->strikeOut = enable; | - |
609 | resolve_mask |= QFont::StrikeOutResolved; | - |
610 | } executed: } Execution Count:3483 | 3483 |
611 | | - |
612 | | - |
613 | | - |
614 | | - |
615 | | - |
616 | | - |
617 | bool QFont::fixedPitch() const | - |
618 | { | - |
619 | return d->request.fixedPitch; executed: return d->request.fixedPitch; Execution Count:17851 | 17851 |
620 | } | - |
621 | | - |
622 | | - |
623 | | - |
624 | | - |
625 | | - |
626 | | - |
627 | | - |
628 | void QFont::setFixedPitch(bool enable) | - |
629 | { | - |
630 | if ((resolve_mask & QFont::FixedPitchResolved) && d->request.fixedPitch == enable) partially evaluated: (resolve_mask & QFont::FixedPitchResolved) no Evaluation Count:0 | yes Evaluation Count:627 |
never evaluated: d->request.fixedPitch == enable | 0-627 |
631 | return; | 0 |
632 | | - |
633 | detach(); | - |
634 | | - |
635 | d->request.fixedPitch = enable; | - |
636 | d->request.ignorePitch = false; | - |
637 | resolve_mask |= QFont::FixedPitchResolved; | - |
638 | } executed: } Execution Count:627 | 627 |
639 | | - |
640 | | - |
641 | | - |
642 | | - |
643 | | - |
644 | | - |
645 | bool QFont::kerning() const | - |
646 | { | - |
647 | return d->kerning; executed: return d->kerning; Execution Count:14006 | 14006 |
648 | } | - |
649 | void QFont::setKerning(bool enable) | - |
650 | { | - |
651 | if ((resolve_mask & QFont::KerningResolved) && d->kerning == enable) partially evaluated: (resolve_mask & QFont::KerningResolved) no Evaluation Count:0 | yes Evaluation Count:2971 |
never evaluated: d->kerning == enable | 0-2971 |
652 | return; | 0 |
653 | | - |
654 | QFontPrivate::detachButKeepEngineData(this); | - |
655 | | - |
656 | d->kerning = enable; | - |
657 | resolve_mask |= QFont::KerningResolved; | - |
658 | } executed: } Execution Count:2971 | 2971 |
659 | QFont::StyleStrategy QFont::styleStrategy() const | - |
660 | { | - |
661 | return (StyleStrategy) d->request.styleStrategy; executed: return (StyleStrategy) d->request.styleStrategy; Execution Count:16986 | 16986 |
662 | } | - |
663 | QFont::StyleHint QFont::styleHint() const | - |
664 | { | - |
665 | return (StyleHint) d->request.styleHint; executed: return (StyleHint) d->request.styleHint; Execution Count:14342 | 14342 |
666 | } | - |
667 | void QFont::setStyleHint(StyleHint hint, StyleStrategy strategy) | - |
668 | { | - |
669 | if ((resolve_mask & (QFont::StyleHintResolved | QFont::StyleStrategyResolved)) && partially evaluated: (resolve_mask & (QFont::StyleHintResolved | QFont::StyleStrategyResolved)) no Evaluation Count:0 | yes Evaluation Count:2979 |
| 0-2979 |
670 | (StyleHint) d->request.styleHint == hint && never evaluated: (StyleHint) d->request.styleHint == hint | 0 |
671 | (StyleStrategy) d->request.styleStrategy == strategy) never evaluated: (StyleStrategy) d->request.styleStrategy == strategy | 0 |
672 | return; | 0 |
673 | | - |
674 | detach(); | - |
675 | | - |
676 | d->request.styleHint = hint; | - |
677 | d->request.styleStrategy = strategy; | - |
678 | resolve_mask |= QFont::StyleHintResolved; | - |
679 | resolve_mask |= QFont::StyleStrategyResolved; | - |
680 | | - |
681 | } executed: } Execution Count:2979 | 2979 |
682 | | - |
683 | | - |
684 | | - |
685 | | - |
686 | | - |
687 | | - |
688 | void QFont::setStyleStrategy(StyleStrategy s) | - |
689 | { | - |
690 | if ((resolve_mask & QFont::StyleStrategyResolved) && evaluated: (resolve_mask & QFont::StyleStrategyResolved) yes Evaluation Count:2980 | yes Evaluation Count:8 |
| 8-2980 |
691 | s == (StyleStrategy)d->request.styleStrategy) evaluated: s == (StyleStrategy)d->request.styleStrategy yes Evaluation Count:2966 | yes Evaluation Count:14 |
| 14-2966 |
692 | return; executed: return; Execution Count:2966 | 2966 |
693 | | - |
694 | detach(); | - |
695 | | - |
696 | d->request.styleStrategy = s; | - |
697 | resolve_mask |= QFont::StyleStrategyResolved; | - |
698 | } executed: } Execution Count:22 | 22 |
699 | int QFont::stretch() const | - |
700 | { | - |
701 | return d->request.stretch; executed: return d->request.stretch; Execution Count:14006 | 14006 |
702 | } | - |
703 | void QFont::setStretch(int factor) | - |
704 | { | - |
705 | if (factor < 1 || factor > 4000) { partially evaluated: factor < 1 no Evaluation Count:0 | yes Evaluation Count:2983 |
partially evaluated: factor > 4000 no Evaluation Count:0 | yes Evaluation Count:2983 |
| 0-2983 |
706 | QMessageLogger("text/qfont.cpp", 1478, __PRETTY_FUNCTION__).warning("QFont::setStretch: Parameter '%d' out of range", factor); | - |
707 | return; | 0 |
708 | } | - |
709 | | - |
710 | if ((resolve_mask & QFont::StretchResolved) && partially evaluated: (resolve_mask & QFont::StretchResolved) no Evaluation Count:0 | yes Evaluation Count:2983 |
| 0-2983 |
711 | d->request.stretch == (uint)factor) never evaluated: d->request.stretch == (uint)factor | 0 |
712 | return; | 0 |
713 | | - |
714 | detach(); | - |
715 | | - |
716 | d->request.stretch = (uint)factor; | - |
717 | resolve_mask |= QFont::StretchResolved; | - |
718 | } executed: } Execution Count:2983 | 2983 |
719 | qreal QFont::letterSpacing() const | - |
720 | { | - |
721 | return d->letterSpacing.toReal(); executed: return d->letterSpacing.toReal(); Execution Count:14007 | 14007 |
722 | } | - |
723 | void QFont::setLetterSpacing(SpacingType type, qreal spacing) | - |
724 | { | - |
725 | const QFixed newSpacing = QFixed::fromReal(spacing); | - |
726 | const bool absoluteSpacing = type == AbsoluteSpacing; | - |
727 | if ((resolve_mask & QFont::LetterSpacingResolved) && partially evaluated: (resolve_mask & QFont::LetterSpacingResolved) no Evaluation Count:0 | yes Evaluation Count:2970 |
| 0-2970 |
728 | d->letterSpacingIsAbsolute == absoluteSpacing && never evaluated: d->letterSpacingIsAbsolute == absoluteSpacing | 0 |
729 | d->letterSpacing == newSpacing) never evaluated: d->letterSpacing == newSpacing | 0 |
730 | return; | 0 |
731 | | - |
732 | QFontPrivate::detachButKeepEngineData(this); | - |
733 | | - |
734 | d->letterSpacing = newSpacing; | - |
735 | d->letterSpacingIsAbsolute = absoluteSpacing; | - |
736 | resolve_mask |= QFont::LetterSpacingResolved; | - |
737 | } executed: } Execution Count:2970 | 2970 |
738 | | - |
739 | | - |
740 | | - |
741 | | - |
742 | | - |
743 | | - |
744 | | - |
745 | QFont::SpacingType QFont::letterSpacingType() const | - |
746 | { | - |
747 | return d->letterSpacingIsAbsolute ? AbsoluteSpacing : PercentageSpacing; executed: return d->letterSpacingIsAbsolute ? AbsoluteSpacing : PercentageSpacing; Execution Count:14005 | 14005 |
748 | } | - |
749 | | - |
750 | | - |
751 | | - |
752 | | - |
753 | | - |
754 | | - |
755 | | - |
756 | qreal QFont::wordSpacing() const | - |
757 | { | - |
758 | return d->wordSpacing.toReal(); executed: return d->wordSpacing.toReal(); Execution Count:14007 | 14007 |
759 | } | - |
760 | void QFont::setWordSpacing(qreal spacing) | - |
761 | { | - |
762 | const QFixed newSpacing = QFixed::fromReal(spacing); | - |
763 | if ((resolve_mask & QFont::WordSpacingResolved) && partially evaluated: (resolve_mask & QFont::WordSpacingResolved) no Evaluation Count:0 | yes Evaluation Count:2973 |
| 0-2973 |
764 | d->wordSpacing == newSpacing) never evaluated: d->wordSpacing == newSpacing | 0 |
765 | return; | 0 |
766 | | - |
767 | QFontPrivate::detachButKeepEngineData(this); | - |
768 | | - |
769 | d->wordSpacing = newSpacing; | - |
770 | resolve_mask |= QFont::WordSpacingResolved; | - |
771 | } executed: } Execution Count:2973 | 2973 |
772 | void QFont::setCapitalization(Capitalization caps) | - |
773 | { | - |
774 | if ((resolve_mask & QFont::CapitalizationResolved) && evaluated: (resolve_mask & QFont::CapitalizationResolved) yes Evaluation Count:1 | yes Evaluation Count:2979 |
| 1-2979 |
775 | capitalization() == caps) partially evaluated: capitalization() == caps no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
776 | return; | 0 |
777 | | - |
778 | QFontPrivate::detachButKeepEngineData(this); | - |
779 | | - |
780 | d->capital = caps; | - |
781 | resolve_mask |= QFont::CapitalizationResolved; | - |
782 | } executed: } Execution Count:2980 | 2980 |
783 | | - |
784 | | - |
785 | | - |
786 | | - |
787 | | - |
788 | | - |
789 | | - |
790 | QFont::Capitalization QFont::capitalization() const | - |
791 | { | - |
792 | return static_cast<QFont::Capitalization> (d->capital); executed: return static_cast<QFont::Capitalization> (d->capital); Execution Count:19400 | 19400 |
793 | } | - |
794 | void QFont::setRawMode(bool enable) | - |
795 | { | - |
796 | if ((bool) d->rawMode == enable) return; executed: return; Execution Count:1 partially evaluated: (bool) d->rawMode == enable yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
797 | | - |
798 | | - |
799 | detach(); | - |
800 | | - |
801 | d->rawMode = enable; | - |
802 | } | 0 |
803 | | - |
804 | | - |
805 | | - |
806 | | - |
807 | | - |
808 | | - |
809 | | - |
810 | bool QFont::exactMatch() const | - |
811 | { | - |
812 | QFontEngine *engine = d->engineForScript(QUnicodeTables::Common); | - |
813 | qt_noop(); | - |
814 | return (d->rawMode | 7 |
815 | ? engine->type() != QFontEngine::Box | 7 |
816 | : d->request.exactMatch(engine->fontDef)); executed: return (d->rawMode ? engine->type() != QFontEngine::Box : d->request.exactMatch(engine->fontDef)); Execution Count:7 | 7 |
817 | } | - |
818 | bool QFont::operator==(const QFont &f) const | - |
819 | { | - |
820 | return (f.d == d | 144337 |
821 | || (f.d->request == d->request | 144337 |
822 | && f.d->request.pointSize == d->request.pointSize | 144337 |
823 | && f.d->underline == d->underline | 144337 |
824 | && f.d->overline == d->overline | 144337 |
825 | && f.d->strikeOut == d->strikeOut | 144337 |
826 | && f.d->kerning == d->kerning | 144337 |
827 | && f.d->capital == d->capital | 144337 |
828 | && f.d->letterSpacingIsAbsolute == d->letterSpacingIsAbsolute | 144337 |
829 | && f.d->letterSpacing == d->letterSpacing | 144337 |
830 | && f.d->wordSpacing == d->wordSpacing | 144337 |
831 | )); executed: return (f.d == d || (f.d->request == d->request && f.d->request.pointSize == d->request.pointSize && f.d->underline == d->underline && f.d->overline == d->overline && f.d->strikeOut == d->strikeOut && f.d->kerning == d->kerning && f.d->capital == d->capital && f.d->letterSpacingIsAbsolute == d->letterSpacingIsAbsolute && f.d->letterSpacing == d->letterSpacing && f.d->wordSpacing == d->wordSpacing )); Execution Count:144337 | 144337 |
832 | } | - |
833 | bool QFont::operator<(const QFont &f) const | - |
834 | { | - |
835 | if (f.d == d) return false; never executed: return false; partially evaluated: f.d == d no Evaluation Count:0 | yes Evaluation Count:26 |
| 0-26 |
836 | | - |
837 | QFontDef &r1 = f.d->request; | - |
838 | QFontDef &r2 = d->request; | - |
839 | if (r1.pointSize != r2.pointSize) return r1.pointSize < r2.pointSize; executed: return r1.pointSize < r2.pointSize; Execution Count:8 evaluated: r1.pointSize != r2.pointSize yes Evaluation Count:8 | yes Evaluation Count:18 |
| 8-18 |
840 | if (r1.pixelSize != r2.pixelSize) return r1.pixelSize < r2.pixelSize; never executed: return r1.pixelSize < r2.pixelSize; partially evaluated: r1.pixelSize != r2.pixelSize no Evaluation Count:0 | yes Evaluation Count:18 |
| 0-18 |
841 | if (r1.weight != r2.weight) return r1.weight < r2.weight; executed: return r1.weight < r2.weight; Execution Count:2 evaluated: r1.weight != r2.weight yes Evaluation Count:2 | yes Evaluation Count:16 |
| 2-16 |
842 | if (r1.style != r2.style) return r1.style < r2.style; executed: return r1.style < r2.style; Execution Count:2 evaluated: r1.style != r2.style yes Evaluation Count:2 | yes Evaluation Count:14 |
| 2-14 |
843 | if (r1.stretch != r2.stretch) return r1.stretch < r2.stretch; never executed: return r1.stretch < r2.stretch; partially evaluated: r1.stretch != r2.stretch no Evaluation Count:0 | yes Evaluation Count:14 |
| 0-14 |
844 | if (r1.styleHint != r2.styleHint) return r1.styleHint < r2.styleHint; never executed: return r1.styleHint < r2.styleHint; partially evaluated: r1.styleHint != r2.styleHint no Evaluation Count:0 | yes Evaluation Count:14 |
| 0-14 |
845 | if (r1.styleStrategy != r2.styleStrategy) return r1.styleStrategy < r2.styleStrategy; never executed: return r1.styleStrategy < r2.styleStrategy; partially evaluated: r1.styleStrategy != r2.styleStrategy no Evaluation Count:0 | yes Evaluation Count:14 |
| 0-14 |
846 | if (r1.family != r2.family) return r1.family < r2.family; never executed: return r1.family < r2.family; partially evaluated: r1.family != r2.family no Evaluation Count:0 | yes Evaluation Count:14 |
| 0-14 |
847 | if (f.d->capital != d->capital) return f.d->capital < d->capital; executed: return f.d->capital < d->capital; Execution Count:2 evaluated: f.d->capital != d->capital yes Evaluation Count:2 | yes Evaluation Count:12 |
| 2-12 |
848 | | - |
849 | if (f.d->letterSpacingIsAbsolute != d->letterSpacingIsAbsolute) return f.d->letterSpacingIsAbsolute < d->letterSpacingIsAbsolute; never executed: return f.d->letterSpacingIsAbsolute < d->letterSpacingIsAbsolute; partially evaluated: f.d->letterSpacingIsAbsolute != d->letterSpacingIsAbsolute no Evaluation Count:0 | yes Evaluation Count:12 |
| 0-12 |
850 | if (f.d->letterSpacing != d->letterSpacing) return f.d->letterSpacing < d->letterSpacing; never executed: return f.d->letterSpacing < d->letterSpacing; partially evaluated: f.d->letterSpacing != d->letterSpacing no Evaluation Count:0 | yes Evaluation Count:12 |
| 0-12 |
851 | if (f.d->wordSpacing != d->wordSpacing) return f.d->wordSpacing < d->wordSpacing; never executed: return f.d->wordSpacing < d->wordSpacing; partially evaluated: f.d->wordSpacing != d->wordSpacing no Evaluation Count:0 | yes Evaluation Count:12 |
| 0-12 |
852 | | - |
853 | int f1attrs = (f.d->underline << 3) + (f.d->overline << 2) + (f.d->strikeOut<<1) + f.d->kerning; | - |
854 | int f2attrs = (d->underline << 3) + (d->overline << 2) + (d->strikeOut<<1) + d->kerning; | - |
855 | return f1attrs < f2attrs; executed: return f1attrs < f2attrs; Execution Count:12 | 12 |
856 | } | - |
857 | bool QFont::operator!=(const QFont &f) const | - |
858 | { | - |
859 | return !(operator==(f)); executed: return !(operator==(f)); Execution Count:683 | 683 |
860 | } | - |
861 | | - |
862 | | - |
863 | | - |
864 | | - |
865 | QFont::operator QVariant() const | - |
866 | { | - |
867 | return QVariant(QVariant::Font, this); executed: return QVariant(QVariant::Font, this); Execution Count:4752 | 4752 |
868 | } | - |
869 | bool QFont::isCopyOf(const QFont & f) const | - |
870 | { | - |
871 | return d == f.d; executed: return d == f.d; Execution Count:78998 | 78998 |
872 | } | - |
873 | | - |
874 | | - |
875 | | - |
876 | | - |
877 | | - |
878 | | - |
879 | | - |
880 | bool QFont::rawMode() const | - |
881 | { | - |
882 | return d->rawMode; executed: return d->rawMode; Execution Count:170 | 170 |
883 | } | - |
884 | | - |
885 | | - |
886 | | - |
887 | | - |
888 | | - |
889 | QFont QFont::resolve(const QFont &other) const | - |
890 | { | - |
891 | if (*this == other evaluated: *this == other yes Evaluation Count:68801 | yes Evaluation Count:1961 |
| 1961-68801 |
892 | && (resolve_mask == other.resolve_mask || resolve_mask == 0) evaluated: resolve_mask == other.resolve_mask yes Evaluation Count:65896 | yes Evaluation Count:2905 |
evaluated: resolve_mask == 0 yes Evaluation Count:51 | yes Evaluation Count:2854 |
| 51-65896 |
893 | && d->dpi == other.d->dpi) { evaluated: d->dpi == other.d->dpi yes Evaluation Count:65450 | yes Evaluation Count:497 |
| 497-65450 |
894 | QFont o = other; | - |
895 | o.resolve_mask = resolve_mask; | - |
896 | return o; executed: return o; Execution Count:65450 | 65450 |
897 | } | - |
898 | | - |
899 | QFont font(*this); | - |
900 | font.detach(); | - |
901 | font.d->resolve(resolve_mask, other.d.data()); | - |
902 | | - |
903 | return font; executed: return font; Execution Count:5312 | 5312 |
904 | } | - |
905 | typedef QHash<QString, QStringList> QFontSubst; | - |
906 | static QFontSubst *globalFontSubst() { static QGlobalStatic<QFontSubst > thisGlobalStatic = { { (0) }, false }; if (!thisGlobalStatic.pointer.load() && !thisGlobalStatic.destroyed) { QFontSubst *x = new QFontSubst; if (!thisGlobalStatic.pointer.testAndSetOrdered(0, x)) delete x; else static QGlobalStaticDeleter<QFontSubst > cleanup(thisGlobalStatic); } return thisGlobalStatic.pointer.load(); } never executed: delete x; executed: return thisGlobalStatic.pointer.load(); Execution Count:649 partially evaluated: !thisGlobalStatic.pointer.testAndSetOrdered(0, x) no Evaluation Count:0 | yes Evaluation Count:100 |
evaluated: !thisGlobalStatic.pointer.load() yes Evaluation Count:100 | yes Evaluation Count:549 |
partially evaluated: !thisGlobalStatic.destroyed yes Evaluation Count:100 | no Evaluation Count:0 |
| 0-649 |
907 | QString QFont::substitute(const QString &familyName) | - |
908 | { | - |
909 | QFontSubst *fontSubst = globalFontSubst(); | - |
910 | qt_noop(); | - |
911 | QFontSubst::ConstIterator it = fontSubst->constFind(familyName.toLower()); | - |
912 | if (it != fontSubst->constEnd() && !(*it).isEmpty()) never evaluated: it != fontSubst->constEnd() never evaluated: !(*it).isEmpty() | 0 |
913 | return (*it).first(); never executed: return (*it).first(); | 0 |
914 | | - |
915 | return familyName; never executed: return familyName; | 0 |
916 | } | - |
917 | QStringList QFont::substitutes(const QString &familyName) | - |
918 | { | - |
919 | QFontSubst *fontSubst = globalFontSubst(); | - |
920 | qt_noop(); | - |
921 | return fontSubst->value(familyName.toLower(), QStringList()); executed: return fontSubst->value(familyName.toLower(), QStringList()); Execution Count:645 | 645 |
922 | } | - |
923 | void QFont::insertSubstitution(const QString &familyName, | - |
924 | const QString &substituteName) | - |
925 | { | - |
926 | QFontSubst *fontSubst = globalFontSubst(); | - |
927 | qt_noop(); | - |
928 | QStringList &list = (*fontSubst)[familyName.toLower()]; | - |
929 | QString s = substituteName.toLower(); | - |
930 | if (!list.contains(s)) partially evaluated: !list.contains(s) yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
931 | list.append(s); executed: list.append(s); Execution Count:1 | 1 |
932 | } executed: } Execution Count:1 | 1 |
933 | void QFont::insertSubstitutions(const QString &familyName, | - |
934 | const QStringList &substituteNames) | - |
935 | { | - |
936 | QFontSubst *fontSubst = globalFontSubst(); | - |
937 | qt_noop(); | - |
938 | QStringList &list = (*fontSubst)[familyName.toLower()]; | - |
939 | for (QForeachContainer<__typeof__(substituteNames)> _container_(substituteNames); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (const QString &substituteName = *_container_.i;; __extension__ ({--_container_.brk; break;})) { | - |
940 | const QString lowerSubstituteName = substituteName.toLower(); | - |
941 | if (!list.contains(lowerSubstituteName)) partially evaluated: !list.contains(lowerSubstituteName) yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
942 | list.append(lowerSubstituteName); executed: list.append(lowerSubstituteName); Execution Count:2 | 2 |
943 | } executed: } Execution Count:2 | 2 |
944 | } executed: } Execution Count:1 | 1 |
945 | void QFont::removeSubstitutions(const QString &familyName) | - |
946 | { | - |
947 | QFontSubst *fontSubst = globalFontSubst(); | - |
948 | qt_noop(); | - |
949 | fontSubst->remove(familyName.toLower()); | - |
950 | } executed: } Execution Count:2 | 2 |
951 | QStringList QFont::substitutions() | - |
952 | { | - |
953 | typedef QFontSubst::const_iterator QFontSubstConstIterator; | - |
954 | | - |
955 | QFontSubst *fontSubst = globalFontSubst(); | - |
956 | qt_noop(); | - |
957 | QStringList ret; | - |
958 | const QFontSubstConstIterator cend = fontSubst->constEnd(); | - |
959 | for (QFontSubstConstIterator it = fontSubst->constBegin(); it != cend; ++it) never evaluated: it != cend | 0 |
960 | ret.append(it.key()); never executed: ret.append(it.key()); | 0 |
961 | | - |
962 | ret.sort(); | - |
963 | return ret; never executed: return ret; | 0 |
964 | } | - |
965 | | - |
966 | | - |
967 | | - |
968 | | - |
969 | | - |
970 | | - |
971 | static quint8 get_font_bits(int version, const QFontPrivate *f) | - |
972 | { | - |
973 | qt_noop(); | - |
974 | quint8 bits = 0; | - |
975 | if (f->request.style) evaluated: f->request.style yes Evaluation Count:36 | yes Evaluation Count:52 |
| 36-52 |
976 | bits |= 0x01; executed: bits |= 0x01; Execution Count:36 | 36 |
977 | if (f->underline) evaluated: f->underline yes Evaluation Count:18 | yes Evaluation Count:70 |
| 18-70 |
978 | bits |= 0x02; executed: bits |= 0x02; Execution Count:18 | 18 |
979 | if (f->overline) partially evaluated: f->overline no Evaluation Count:0 | yes Evaluation Count:88 |
| 0-88 |
980 | bits |= 0x40; never executed: bits |= 0x40; | 0 |
981 | if (f->strikeOut) evaluated: f->strikeOut yes Evaluation Count:24 | yes Evaluation Count:64 |
| 24-64 |
982 | bits |= 0x04; executed: bits |= 0x04; Execution Count:24 | 24 |
983 | if (f->request.fixedPitch) evaluated: f->request.fixedPitch yes Evaluation Count:18 | yes Evaluation Count:70 |
| 18-70 |
984 | bits |= 0x08; executed: bits |= 0x08; Execution Count:18 | 18 |
985 | | - |
986 | | - |
987 | if (f->rawMode) partially evaluated: f->rawMode no Evaluation Count:0 | yes Evaluation Count:88 |
| 0-88 |
988 | bits |= 0x20; never executed: bits |= 0x20; | 0 |
989 | if (version >= QDataStream::Qt_4_0) { partially evaluated: version >= QDataStream::Qt_4_0 yes Evaluation Count:88 | no Evaluation Count:0 |
| 0-88 |
990 | if (f->kerning) partially evaluated: f->kerning yes Evaluation Count:88 | no Evaluation Count:0 |
| 0-88 |
991 | bits |= 0x10; executed: bits |= 0x10; Execution Count:88 | 88 |
992 | } executed: } Execution Count:88 | 88 |
993 | if (f->request.style == QFont::StyleOblique) partially evaluated: f->request.style == QFont::StyleOblique no Evaluation Count:0 | yes Evaluation Count:88 |
| 0-88 |
994 | bits |= 0x80; never executed: bits |= 0x80; | 0 |
995 | return bits; executed: return bits; Execution Count:88 | 88 |
996 | } | - |
997 | | - |
998 | static quint8 get_extended_font_bits(const QFontPrivate *f) | - |
999 | { | - |
1000 | qt_noop(); | - |
1001 | quint8 bits = 0; | - |
1002 | if (f->request.ignorePitch) evaluated: f->request.ignorePitch yes Evaluation Count:46 | yes Evaluation Count:42 |
| 42-46 |
1003 | bits |= 0x01; executed: bits |= 0x01; Execution Count:46 | 46 |
1004 | if (f->letterSpacingIsAbsolute) evaluated: f->letterSpacingIsAbsolute yes Evaluation Count:2 | yes Evaluation Count:86 |
| 2-86 |
1005 | bits |= 0x02; executed: bits |= 0x02; Execution Count:2 | 2 |
1006 | return bits; executed: return bits; Execution Count:88 | 88 |
1007 | } | - |
1008 | | - |
1009 | | - |
1010 | | - |
1011 | | - |
1012 | | - |
1013 | | - |
1014 | | - |
1015 | static void set_font_bits(int version, quint8 bits, QFontPrivate *f) | - |
1016 | { | - |
1017 | qt_noop(); | - |
1018 | f->request.style = (bits & 0x01) != 0 ? QFont::StyleItalic : QFont::StyleNormal; evaluated: (bits & 0x01) != 0 yes Evaluation Count:36 | yes Evaluation Count:52 |
| 36-52 |
1019 | f->underline = (bits & 0x02) != 0; | - |
1020 | f->overline = (bits & 0x40) != 0; | - |
1021 | f->strikeOut = (bits & 0x04) != 0; | - |
1022 | f->request.fixedPitch = (bits & 0x08) != 0; | - |
1023 | | - |
1024 | f->rawMode = (bits & 0x20) != 0; | - |
1025 | if (version >= QDataStream::Qt_4_0) partially evaluated: version >= QDataStream::Qt_4_0 yes Evaluation Count:88 | no Evaluation Count:0 |
| 0-88 |
1026 | f->kerning = (bits & 0x10) != 0; executed: f->kerning = (bits & 0x10) != 0; Execution Count:88 | 88 |
1027 | if ((bits & 0x80) != 0) partially evaluated: (bits & 0x80) != 0 no Evaluation Count:0 | yes Evaluation Count:88 |
| 0-88 |
1028 | f->request.style = QFont::StyleOblique; never executed: f->request.style = QFont::StyleOblique; | 0 |
1029 | } executed: } Execution Count:88 | 88 |
1030 | | - |
1031 | static void set_extended_font_bits(quint8 bits, QFontPrivate *f) | - |
1032 | { | - |
1033 | qt_noop(); | - |
1034 | f->request.ignorePitch = (bits & 0x01) != 0; | - |
1035 | f->letterSpacingIsAbsolute = (bits & 0x02) != 0; | - |
1036 | } executed: } Execution Count:88 | 88 |
1037 | QString QFont::key() const | - |
1038 | { | - |
1039 | return toString(); never executed: return toString(); | 0 |
1040 | } | - |
1041 | QString QFont::toString() const | - |
1042 | { | - |
1043 | const QChar comma(QLatin1Char(',')); | - |
1044 | return family() + comma + | 170 |
1045 | QString::number( pointSizeF()) + comma + | 170 |
1046 | QString::number( pixelSize()) + comma + | 170 |
1047 | QString::number((int) styleHint()) + comma + | 170 |
1048 | QString::number( weight()) + comma + | 170 |
1049 | QString::number((int) style()) + comma + | 170 |
1050 | QString::number((int) underline()) + comma + | 170 |
1051 | QString::number((int) strikeOut()) + comma + | 170 |
1052 | QString::number((int)fixedPitch()) + comma + | 170 |
1053 | QString::number((int) rawMode()); executed: return family() + comma + QString::number( pointSizeF()) + comma + QString::number( pixelSize()) + comma + QString::number((int) styleHint()) + comma + QString::number( weight()) + comma + QString::number((int) style()) + comma + QString::number((int) underline()) + comma + QString::number((int) strikeOut()) + comma + QString::number((int)fixedPitch()) + comma + QString::number((int) rawMode()); Execution Count:170 | 170 |
1054 | } | - |
1055 | bool QFont::fromString(const QString &descrip) | - |
1056 | { | - |
1057 | QStringList l(descrip.split(QLatin1Char(','))); | - |
1058 | | - |
1059 | int count = l.count(); | - |
1060 | if (!count || (count > 2 && count < 9) || count > 11) { partially evaluated: !count no Evaluation Count:0 | yes Evaluation Count:1 |
partially evaluated: count > 2 yes Evaluation Count:1 | no Evaluation Count:0 |
partially evaluated: count < 9 no Evaluation Count:0 | yes Evaluation Count:1 |
partially evaluated: count > 11 no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
1061 | QMessageLogger("text/qfont.cpp", 2079, __PRETTY_FUNCTION__).warning("QFont::fromString: Invalid description '%s'", | - |
1062 | descrip.isEmpty() ? "(empty)" : descrip.toLatin1().data()); | - |
1063 | return false; never executed: return false; | 0 |
1064 | } | - |
1065 | | - |
1066 | setFamily(l[0]); | - |
1067 | if (count > 1 && l[1].toDouble() > 0.0) partially evaluated: count > 1 yes Evaluation Count:1 | no Evaluation Count:0 |
partially evaluated: l[1].toDouble() > 0.0 yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
1068 | setPointSizeF(l[1].toDouble()); executed: setPointSizeF(l[1].toDouble()); Execution Count:1 | 1 |
1069 | if (count == 9) { partially evaluated: count == 9 no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
1070 | setStyleHint((StyleHint) l[2].toInt()); | - |
1071 | setWeight(qMax(qMin(99, l[3].toInt()), 0)); | - |
1072 | setItalic(l[4].toInt()); | - |
1073 | setUnderline(l[5].toInt()); | - |
1074 | setStrikeOut(l[6].toInt()); | - |
1075 | setFixedPitch(l[7].toInt()); | - |
1076 | setRawMode(l[8].toInt()); | - |
1077 | } else if (count == 10) { partially evaluated: count == 10 yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
1078 | if (l[2].toInt() > 0) partially evaluated: l[2].toInt() > 0 no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
1079 | setPixelSize(l[2].toInt()); never executed: setPixelSize(l[2].toInt()); | 0 |
1080 | setStyleHint((StyleHint) l[3].toInt()); | - |
1081 | setWeight(qMax(qMin(99, l[4].toInt()), 0)); | - |
1082 | setStyle((QFont::Style)l[5].toInt()); | - |
1083 | setUnderline(l[6].toInt()); | - |
1084 | setStrikeOut(l[7].toInt()); | - |
1085 | setFixedPitch(l[8].toInt()); | - |
1086 | setRawMode(l[9].toInt()); | - |
1087 | } executed: } Execution Count:1 | 1 |
1088 | if (count >= 9 && !d->request.fixedPitch) partially evaluated: count >= 9 yes Evaluation Count:1 | no Evaluation Count:0 |
partially evaluated: !d->request.fixedPitch yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
1089 | d->request.ignorePitch = true; executed: d->request.ignorePitch = true; Execution Count:1 | 1 |
1090 | | - |
1091 | return true; executed: return true; Execution Count:1 | 1 |
1092 | } | - |
1093 | | - |
1094 | | - |
1095 | | - |
1096 | | - |
1097 | | - |
1098 | void QFont::cacheStatistics() | - |
1099 | { | - |
1100 | | - |
1101 | | - |
1102 | } | - |
1103 | QDataStream &operator<<(QDataStream &s, const QFont &font) | - |
1104 | { | - |
1105 | if (s.version() == 1) { partially evaluated: s.version() == 1 no Evaluation Count:0 | yes Evaluation Count:88 |
| 0-88 |
1106 | s << font.d->request.family.toLatin1(); | - |
1107 | } else { | 0 |
1108 | s << font.d->request.family; | - |
1109 | } executed: } Execution Count:88 | 88 |
1110 | | - |
1111 | if (s.version() >= QDataStream::Qt_4_0) { partially evaluated: s.version() >= QDataStream::Qt_4_0 yes Evaluation Count:88 | no Evaluation Count:0 |
| 0-88 |
1112 | | - |
1113 | double pointSize = font.d->request.pointSize; | - |
1114 | qint32 pixelSize = font.d->request.pixelSize; | - |
1115 | s << pointSize; | - |
1116 | s << pixelSize; | - |
1117 | } else if (s.version() <= 3) { executed: } Execution Count:88 never evaluated: s.version() <= 3 | 0-88 |
1118 | qint16 pointSize = (qint16) (font.d->request.pointSize * 10); | - |
1119 | if (pointSize < 0) { never evaluated: pointSize < 0 | 0 |
1120 | pointSize = (qint16)QFontInfo(font).pointSize() * 10; | - |
1121 | } | 0 |
1122 | s << pointSize; | - |
1123 | } else { | 0 |
1124 | s << (qint16) (font.d->request.pointSize * 10); | - |
1125 | s << (qint16) font.d->request.pixelSize; | - |
1126 | } | 0 |
1127 | | - |
1128 | s << (quint8) font.d->request.styleHint; | - |
1129 | if (s.version() >= QDataStream::Qt_3_1) partially evaluated: s.version() >= QDataStream::Qt_3_1 yes Evaluation Count:88 | no Evaluation Count:0 |
| 0-88 |
1130 | s << (quint8) font.d->request.styleStrategy; executed: s << (quint8) font.d->request.styleStrategy; Execution Count:88 | 88 |
1131 | s << (quint8) 0 | - |
1132 | << (quint8) font.d->request.weight | - |
1133 | << get_font_bits(s.version(), font.d.data()); | - |
1134 | if (s.version() >= QDataStream::Qt_4_3) partially evaluated: s.version() >= QDataStream::Qt_4_3 yes Evaluation Count:88 | no Evaluation Count:0 |
| 0-88 |
1135 | s << (quint16)font.d->request.stretch; executed: s << (quint16)font.d->request.stretch; Execution Count:88 | 88 |
1136 | if (s.version() >= QDataStream::Qt_4_4) partially evaluated: s.version() >= QDataStream::Qt_4_4 yes Evaluation Count:88 | no Evaluation Count:0 |
| 0-88 |
1137 | s << get_extended_font_bits(font.d.data()); executed: s << get_extended_font_bits(font.d.data()); Execution Count:88 | 88 |
1138 | if (s.version() >= QDataStream::Qt_4_5) { partially evaluated: s.version() >= QDataStream::Qt_4_5 yes Evaluation Count:88 | no Evaluation Count:0 |
| 0-88 |
1139 | s << font.d->letterSpacing.value(); | - |
1140 | s << font.d->wordSpacing.value(); | - |
1141 | } executed: } Execution Count:88 | 88 |
1142 | return s; executed: return s; Execution Count:88 | 88 |
1143 | } | - |
1144 | QDataStream &operator>>(QDataStream &s, QFont &font) | - |
1145 | { | - |
1146 | font.d = new QFontPrivate; | - |
1147 | font.resolve_mask = QFont::AllPropertiesResolved; | - |
1148 | | - |
1149 | quint8 styleHint, styleStrategy = QFont::PreferDefault, charSet, weight, bits; | - |
1150 | | - |
1151 | if (s.version() == 1) { partially evaluated: s.version() == 1 no Evaluation Count:0 | yes Evaluation Count:88 |
| 0-88 |
1152 | QByteArray fam; | - |
1153 | s >> fam; | - |
1154 | font.d->request.family = QString::fromLatin1(fam); | - |
1155 | } else { | 0 |
1156 | s >> font.d->request.family; | - |
1157 | } executed: } Execution Count:88 | 88 |
1158 | | - |
1159 | if (s.version() >= QDataStream::Qt_4_0) { partially evaluated: s.version() >= QDataStream::Qt_4_0 yes Evaluation Count:88 | no Evaluation Count:0 |
| 0-88 |
1160 | | - |
1161 | double pointSize; | - |
1162 | qint32 pixelSize; | - |
1163 | s >> pointSize; | - |
1164 | s >> pixelSize; | - |
1165 | font.d->request.pointSize = qreal(pointSize); | - |
1166 | font.d->request.pixelSize = pixelSize; | - |
1167 | } else { executed: } Execution Count:88 | 88 |
1168 | qint16 pointSize, pixelSize = -1; | - |
1169 | s >> pointSize; | - |
1170 | if (s.version() >= 4) never evaluated: s.version() >= 4 | 0 |
1171 | s >> pixelSize; never executed: s >> pixelSize; | 0 |
1172 | font.d->request.pointSize = qreal(pointSize / 10.); | - |
1173 | font.d->request.pixelSize = pixelSize; | - |
1174 | } | 0 |
1175 | s >> styleHint; | - |
1176 | if (s.version() >= QDataStream::Qt_3_1) partially evaluated: s.version() >= QDataStream::Qt_3_1 yes Evaluation Count:88 | no Evaluation Count:0 |
| 0-88 |
1177 | s >> styleStrategy; executed: s >> styleStrategy; Execution Count:88 | 88 |
1178 | | - |
1179 | s >> charSet; | - |
1180 | s >> weight; | - |
1181 | s >> bits; | - |
1182 | | - |
1183 | font.d->request.styleHint = styleHint; | - |
1184 | font.d->request.styleStrategy = styleStrategy; | - |
1185 | font.d->request.weight = weight; | - |
1186 | | - |
1187 | set_font_bits(s.version(), bits, font.d.data()); | - |
1188 | | - |
1189 | if (s.version() >= QDataStream::Qt_4_3) { partially evaluated: s.version() >= QDataStream::Qt_4_3 yes Evaluation Count:88 | no Evaluation Count:0 |
| 0-88 |
1190 | quint16 stretch; | - |
1191 | s >> stretch; | - |
1192 | font.d->request.stretch = stretch; | - |
1193 | } executed: } Execution Count:88 | 88 |
1194 | | - |
1195 | if (s.version() >= QDataStream::Qt_4_4) { partially evaluated: s.version() >= QDataStream::Qt_4_4 yes Evaluation Count:88 | no Evaluation Count:0 |
| 0-88 |
1196 | quint8 extendedBits; | - |
1197 | s >> extendedBits; | - |
1198 | set_extended_font_bits(extendedBits, font.d.data()); | - |
1199 | } executed: } Execution Count:88 | 88 |
1200 | if (s.version() >= QDataStream::Qt_4_5) { partially evaluated: s.version() >= QDataStream::Qt_4_5 yes Evaluation Count:88 | no Evaluation Count:0 |
| 0-88 |
1201 | int value; | - |
1202 | s >> value; | - |
1203 | font.d->letterSpacing.setValue(value); | - |
1204 | s >> value; | - |
1205 | font.d->wordSpacing.setValue(value); | - |
1206 | } executed: } Execution Count:88 | 88 |
1207 | | - |
1208 | return s; executed: return s; Execution Count:88 | 88 |
1209 | } | - |
1210 | QFontInfo::QFontInfo(const QFont &font) | - |
1211 | : d(font.d.data()) | - |
1212 | { | - |
1213 | } executed: } Execution Count:483 | 483 |
1214 | | - |
1215 | | - |
1216 | | - |
1217 | | - |
1218 | QFontInfo::QFontInfo(const QFontInfo &fi) | - |
1219 | : d(fi.d.data()) | - |
1220 | { | - |
1221 | } | 0 |
1222 | | - |
1223 | | - |
1224 | | - |
1225 | | - |
1226 | QFontInfo::~QFontInfo() | - |
1227 | { | - |
1228 | } | - |
1229 | | - |
1230 | | - |
1231 | | - |
1232 | | - |
1233 | QFontInfo &QFontInfo::operator=(const QFontInfo &fi) | - |
1234 | { | - |
1235 | d = fi.d.data(); | - |
1236 | return *this; never executed: return *this; | 0 |
1237 | } | - |
1238 | QString QFontInfo::family() const | - |
1239 | { | - |
1240 | QFontEngine *engine = d->engineForScript(QUnicodeTables::Common); | - |
1241 | qt_noop(); | - |
1242 | return engine->fontDef.family; executed: return engine->fontDef.family; Execution Count:44367 | 44367 |
1243 | } | - |
1244 | QString QFontInfo::styleName() const | - |
1245 | { | - |
1246 | QFontEngine *engine = d->engineForScript(QUnicodeTables::Common); | - |
1247 | qt_noop(); | - |
1248 | return engine->fontDef.styleName; never executed: return engine->fontDef.styleName; | 0 |
1249 | } | - |
1250 | | - |
1251 | | - |
1252 | | - |
1253 | | - |
1254 | | - |
1255 | | - |
1256 | int QFontInfo::pointSize() const | - |
1257 | { | - |
1258 | QFontEngine *engine = d->engineForScript(QUnicodeTables::Common); | - |
1259 | qt_noop(); | - |
1260 | return qRound(engine->fontDef.pointSize); executed: return qRound(engine->fontDef.pointSize); Execution Count:3 | 3 |
1261 | } | - |
1262 | | - |
1263 | | - |
1264 | | - |
1265 | | - |
1266 | | - |
1267 | | - |
1268 | qreal QFontInfo::pointSizeF() const | - |
1269 | { | - |
1270 | QFontEngine *engine = d->engineForScript(QUnicodeTables::Common); | - |
1271 | qt_noop(); | - |
1272 | return engine->fontDef.pointSize; never executed: return engine->fontDef.pointSize; | 0 |
1273 | } | - |
1274 | | - |
1275 | | - |
1276 | | - |
1277 | | - |
1278 | | - |
1279 | | - |
1280 | int QFontInfo::pixelSize() const | - |
1281 | { | - |
1282 | QFontEngine *engine = d->engineForScript(QUnicodeTables::Common); | - |
1283 | qt_noop(); | - |
1284 | return engine->fontDef.pixelSize; executed: return engine->fontDef.pixelSize; Execution Count:1 | 1 |
1285 | } | - |
1286 | | - |
1287 | | - |
1288 | | - |
1289 | | - |
1290 | | - |
1291 | | - |
1292 | bool QFontInfo::italic() const | - |
1293 | { | - |
1294 | QFontEngine *engine = d->engineForScript(QUnicodeTables::Common); | - |
1295 | qt_noop(); | - |
1296 | return engine->fontDef.style != QFont::StyleNormal; never executed: return engine->fontDef.style != QFont::StyleNormal; | 0 |
1297 | } | - |
1298 | | - |
1299 | | - |
1300 | | - |
1301 | | - |
1302 | | - |
1303 | | - |
1304 | QFont::Style QFontInfo::style() const | - |
1305 | { | - |
1306 | QFontEngine *engine = d->engineForScript(QUnicodeTables::Common); | - |
1307 | qt_noop(); | - |
1308 | return (QFont::Style)engine->fontDef.style; never executed: return (QFont::Style)engine->fontDef.style; | 0 |
1309 | } | - |
1310 | | - |
1311 | | - |
1312 | | - |
1313 | | - |
1314 | | - |
1315 | | - |
1316 | int QFontInfo::weight() const | - |
1317 | { | - |
1318 | QFontEngine *engine = d->engineForScript(QUnicodeTables::Common); | - |
1319 | qt_noop(); | - |
1320 | return engine->fontDef.weight; never executed: return engine->fontDef.weight; | 0 |
1321 | | - |
1322 | } | - |
1323 | bool QFontInfo::underline() const | - |
1324 | { | - |
1325 | return d->underline; never executed: return d->underline; | 0 |
1326 | } | - |
1327 | bool QFontInfo::overline() const | - |
1328 | { | - |
1329 | return d->overline; never executed: return d->overline; | 0 |
1330 | } | - |
1331 | bool QFontInfo::strikeOut() const | - |
1332 | { | - |
1333 | return d->strikeOut; never executed: return d->strikeOut; | 0 |
1334 | } | - |
1335 | | - |
1336 | | - |
1337 | | - |
1338 | | - |
1339 | | - |
1340 | | - |
1341 | bool QFontInfo::fixedPitch() const | - |
1342 | { | - |
1343 | QFontEngine *engine = d->engineForScript(QUnicodeTables::Common); | - |
1344 | qt_noop(); | - |
1345 | return engine->fontDef.fixedPitch; executed: return engine->fontDef.fixedPitch; Execution Count:2 | 2 |
1346 | } | - |
1347 | QFont::StyleHint QFontInfo::styleHint() const | - |
1348 | { | - |
1349 | QFontEngine *engine = d->engineForScript(QUnicodeTables::Common); | - |
1350 | qt_noop(); | - |
1351 | return (QFont::StyleHint) engine->fontDef.styleHint; never executed: return (QFont::StyleHint) engine->fontDef.styleHint; | 0 |
1352 | } | - |
1353 | bool QFontInfo::rawMode() const | - |
1354 | { | - |
1355 | return d->rawMode; never executed: return d->rawMode; | 0 |
1356 | } | - |
1357 | | - |
1358 | | - |
1359 | | - |
1360 | | - |
1361 | | - |
1362 | | - |
1363 | | - |
1364 | bool QFontInfo::exactMatch() const | - |
1365 | { | - |
1366 | QFontEngine *engine = d->engineForScript(QUnicodeTables::Common); | - |
1367 | qt_noop(); | - |
1368 | return (d->rawMode | 5 |
1369 | ? engine->type() != QFontEngine::Box | 5 |
1370 | : d->request.exactMatch(engine->fontDef)); executed: return (d->rawMode ? engine->type() != QFontEngine::Box : d->request.exactMatch(engine->fontDef)); Execution Count:5 | 5 |
1371 | } | - |
1372 | static const int fast_timeout = 10000; | - |
1373 | static const int slow_timeout = 300000; | - |
1374 | | - |
1375 | | - |
1376 | const uint QFontCache::min_cost = 4*1024; | - |
1377 | static QThreadStorage<QFontCache *> *theFontCache() { static QGlobalStatic<QThreadStorage<QFontCache *> > thisGlobalStatic = { { (0) }, false }; if (!thisGlobalStatic.pointer.load() && !thisGlobalStatic.destroyed) { QThreadStorage<QFontCache *> *x = new QThreadStorage<QFontCache *>; if (!thisGlobalStatic.pointer.testAndSetOrdered(0, x)) delete x; else static QGlobalStaticDeleter<QThreadStorage<QFontCache *> > cleanup(thisGlobalStatic); } return thisGlobalStatic.pointer.load(); } never executed: delete x; executed: return thisGlobalStatic.pointer.load(); Execution Count:387197 partially evaluated: !thisGlobalStatic.pointer.testAndSetOrdered(0, x) no Evaluation Count:0 | yes Evaluation Count:185 |
evaluated: !thisGlobalStatic.pointer.load() yes Evaluation Count:185 | yes Evaluation Count:387012 |
partially evaluated: !thisGlobalStatic.destroyed yes Evaluation Count:185 | no Evaluation Count:0 |
| 0-387197 |
1378 | | - |
1379 | QFontCache *QFontCache::instance() | - |
1380 | { | - |
1381 | QFontCache *&fontCache = theFontCache()->localData(); | - |
1382 | if (!fontCache) evaluated: !fontCache yes Evaluation Count:110 | yes Evaluation Count:386800 |
| 110-386800 |
1383 | fontCache = new QFontCache; executed: fontCache = new QFontCache; Execution Count:110 | 110 |
1384 | return fontCache; executed: return fontCache; Execution Count:386910 | 386910 |
1385 | } | - |
1386 | | - |
1387 | void QFontCache::cleanup() | - |
1388 | { | - |
1389 | QThreadStorage<QFontCache *> *cache = 0; | - |
1390 | if (true) { partially evaluated: true yes Evaluation Count:287 | no Evaluation Count:0 |
| 0-287 |
1391 | cache = theFontCache(); | - |
1392 | } else { executed: } Execution Count:287 | 287 |
1393 | | - |
1394 | } | 0 |
1395 | if (cache && cache->hasLocalData()) partially evaluated: cache yes Evaluation Count:287 | no Evaluation Count:0 |
evaluated: cache->hasLocalData() yes Evaluation Count:109 | yes Evaluation Count:178 |
| 0-287 |
1396 | cache->setLocalData(0); executed: cache->setLocalData(0); Execution Count:109 | 109 |
1397 | } executed: } Execution Count:287 | 287 |
1398 | | - |
1399 | | - |
1400 | QFontCache::QFontCache() | - |
1401 | : QObject(), total_cost(0), max_cost(min_cost), | - |
1402 | current_timestamp(0), fast(false), timer_id(-1) | - |
1403 | { | - |
1404 | } executed: } Execution Count:110 | 110 |
1405 | | - |
1406 | QFontCache::~QFontCache() | - |
1407 | { | - |
1408 | clear(); | - |
1409 | { | - |
1410 | EngineDataCache::ConstIterator it = engineDataCache.constBegin(), | - |
1411 | end = engineDataCache.constEnd(); | - |
1412 | while (it != end) { evaluated: it != end yes Evaluation Count:610 | yes Evaluation Count:110 |
| 110-610 |
1413 | if (it.value()->ref.load() == 0) evaluated: it.value()->ref.load() == 0 yes Evaluation Count:510 | yes Evaluation Count:100 |
| 100-510 |
1414 | delete it.value(); executed: delete it.value(); Execution Count:510 | 510 |
1415 | else | - |
1416 | if (false) QMessageLogger("text/qfont.cpp", 2646, __PRETTY_FUNCTION__).debug("QFontCache::~QFontCache: engineData %p still has refcount %d", partially evaluated: false no Evaluation Count:0 | yes Evaluation Count:100 |
| 0-100 |
1417 | it.value(), it.value()->ref.load()); never executed: QMessageLogger("text/qfont.cpp", 2646, __PRETTY_FUNCTION__).debug("QFontCache::~QFontCache: engineData %p still has refcount %d", it.value(), it.value()->ref.load()); | 0 |
1418 | ++it; | - |
1419 | } executed: } Execution Count:610 | 610 |
1420 | } | - |
1421 | EngineCache::ConstIterator it = engineCache.constBegin(), | - |
1422 | end = engineCache.constEnd(); | - |
1423 | while (it != end) { partially evaluated: it != end no Evaluation Count:0 | yes Evaluation Count:110 |
| 0-110 |
1424 | if (--it.value().data->cache_count == 0) { never evaluated: --it.value().data->cache_count == 0 | 0 |
1425 | if (it.value().data->ref.load() == 0) { never evaluated: it.value().data->ref.load() == 0 | 0 |
1426 | if (false) QMessageLogger("text/qfont.cpp", 2656, __PRETTY_FUNCTION__).debug("QFontCache::~QFontCache: deleting engine %p key=(%d / %g %g %d %d %d)", | 0 |
1427 | it.value().data, it.key().script, it.key().def.pointSize, | 0 |
1428 | it.key().def.pixelSize, it.key().def.weight, it.key().def.style, | 0 |
1429 | it.key().def.fixedPitch); never executed: QMessageLogger("text/qfont.cpp", 2656, __PRETTY_FUNCTION__).debug("QFontCache::~QFontCache: deleting engine %p key=(%d / %g %g %d %d %d)", it.value().data, it.key().script, it.key().def.pointSize, it.key().def.pixelSize, it.key().def.weight, it.key().def.style, it.key().def.fixedPitch); | 0 |
1430 | | - |
1431 | delete it.value().data; | - |
1432 | } else { | 0 |
1433 | if (false) QMessageLogger("text/qfont.cpp", 2663, __PRETTY_FUNCTION__).debug("QFontCache::~QFontCache: engine = %p still has refcount %d", | 0 |
1434 | it.value().data, it.value().data->ref.load()); never executed: QMessageLogger("text/qfont.cpp", 2663, __PRETTY_FUNCTION__).debug("QFontCache::~QFontCache: engine = %p still has refcount %d", it.value().data, it.value().data->ref.load()); | 0 |
1435 | } | 0 |
1436 | } | - |
1437 | ++it; | - |
1438 | } | 0 |
1439 | } executed: } Execution Count:110 | 110 |
1440 | | - |
1441 | void QFontCache::clear() | - |
1442 | { | - |
1443 | { | - |
1444 | EngineDataCache::Iterator it = engineDataCache.begin(), | - |
1445 | end = engineDataCache.end(); | - |
1446 | while (it != end) { evaluated: it != end yes Evaluation Count:1278 | yes Evaluation Count:152 |
| 152-1278 |
1447 | QFontEngineData *data = it.value(); | - |
1448 | for (int i = 0; i < QUnicodeTables::ScriptCount; ++i) { evaluated: i < QUnicodeTables::ScriptCount yes Evaluation Count:35784 | yes Evaluation Count:1278 |
| 1278-35784 |
1449 | if (data->engines[i]) { evaluated: data->engines[i] yes Evaluation Count:1285 | yes Evaluation Count:34499 |
| 1285-34499 |
1450 | data->engines[i]->ref.deref(); | - |
1451 | data->engines[i] = 0; | - |
1452 | } executed: } Execution Count:1285 | 1285 |
1453 | } executed: } Execution Count:35784 | 35784 |
1454 | ++it; | - |
1455 | } executed: } Execution Count:1278 | 1278 |
1456 | } | - |
1457 | | - |
1458 | for (EngineCache::Iterator it = engineCache.begin(), end = engineCache.end(); | - |
1459 | it != end; ++it) { evaluated: it != end yes Evaluation Count:1226 | yes Evaluation Count:152 |
| 152-1226 |
1460 | if (it->data->ref.load() == 0) { evaluated: it->data->ref.load() == 0 yes Evaluation Count:614 | yes Evaluation Count:612 |
| 612-614 |
1461 | delete it->data; | - |
1462 | it->data = 0; | - |
1463 | } executed: } Execution Count:614 | 614 |
1464 | } executed: } Execution Count:1226 | 1226 |
1465 | | - |
1466 | for (EngineCache::Iterator it = engineCache.begin(), end = engineCache.end(); | - |
1467 | it != end; ++it) { evaluated: it != end yes Evaluation Count:1226 | yes Evaluation Count:152 |
| 152-1226 |
1468 | if (it->data && it->data->ref.load() == 0) { evaluated: it->data yes Evaluation Count:612 | yes Evaluation Count:614 |
evaluated: it->data->ref.load() == 0 yes Evaluation Count:580 | yes Evaluation Count:32 |
| 32-614 |
1469 | delete it->data; | - |
1470 | it->data = 0; | - |
1471 | } executed: } Execution Count:580 | 580 |
1472 | } executed: } Execution Count:1226 | 1226 |
1473 | | - |
1474 | engineCache.clear(); | - |
1475 | } executed: } Execution Count:152 | 152 |
1476 | | - |
1477 | | - |
1478 | QFontEngineData *QFontCache::findEngineData(const QFontDef &def) const | - |
1479 | { | - |
1480 | EngineDataCache::ConstIterator it = engineDataCache.constFind(def); | - |
1481 | if (it == engineDataCache.constEnd()) evaluated: it == engineDataCache.constEnd() yes Evaluation Count:610 | yes Evaluation Count:29300 |
| 610-29300 |
1482 | return 0; executed: return 0; Execution Count:610 | 610 |
1483 | | - |
1484 | | - |
1485 | return it.value(); executed: return it.value(); Execution Count:29300 | 29300 |
1486 | } | - |
1487 | | - |
1488 | void QFontCache::insertEngineData(const QFontDef &def, QFontEngineData *engineData) | - |
1489 | { | - |
1490 | if (false) QMessageLogger("text/qfont.cpp", 2720, __PRETTY_FUNCTION__).debug("QFontCache: inserting new engine data %p", engineData); never executed: QMessageLogger("text/qfont.cpp", 2720, __PRETTY_FUNCTION__).debug("QFontCache: inserting new engine data %p", engineData); partially evaluated: false no Evaluation Count:0 | yes Evaluation Count:610 |
| 0-610 |
1491 | | - |
1492 | engineDataCache.insert(def, engineData); | - |
1493 | increaseCost(sizeof(QFontEngineData)); | - |
1494 | } executed: } Execution Count:610 | 610 |
1495 | | - |
1496 | QFontEngine *QFontCache::findEngine(const Key &key) | - |
1497 | { | - |
1498 | EngineCache::Iterator it = engineCache.find(key), | - |
1499 | end = engineCache.end(); | - |
1500 | if (it == end) return 0; executed: return 0; Execution Count:2572 evaluated: it == end yes Evaluation Count:2572 | yes Evaluation Count:18 |
| 18-2572 |
1501 | | - |
1502 | updateHitCountAndTimeStamp(it.value()); | - |
1503 | | - |
1504 | return it.value().data; executed: return it.value().data; Execution Count:18 | 18 |
1505 | } | - |
1506 | | - |
1507 | void QFontCache::updateHitCountAndTimeStamp(Engine &value) | - |
1508 | { | - |
1509 | value.hits++; | - |
1510 | value.timestamp = ++current_timestamp; | - |
1511 | | - |
1512 | if (false) QMessageLogger("text/qfont.cpp", 2742, __PRETTY_FUNCTION__).debug("QFontCache: found font engine\n" partially evaluated: false no Evaluation Count:0 | yes Evaluation Count:18 |
| 0-18 |
1513 | " %p: timestamp %4u hits %3u ref %2d/%2d, type '%s'", | 0 |
1514 | value.data, value.timestamp, value.hits, | 0 |
1515 | value.data->ref.load(), value.data->cache_count, | 0 |
1516 | value.data->name()); never executed: QMessageLogger("text/qfont.cpp", 2742, __PRETTY_FUNCTION__).debug("QFontCache: found font engine\n" " %p: timestamp %4u hits %3u ref %2d/%2d, type '%s'", value.data, value.timestamp, value.hits, value.data->ref.load(), value.data->cache_count, value.data->name()); | 0 |
1517 | } executed: } Execution Count:18 | 18 |
1518 | | - |
1519 | void QFontCache::insertEngine(const Key &key, QFontEngine *engine, bool insertMulti) | - |
1520 | { | - |
1521 | if (false) QMessageLogger("text/qfont.cpp", 2751, __PRETTY_FUNCTION__).debug("QFontCache: inserting new engine %p", engine); never executed: QMessageLogger("text/qfont.cpp", 2751, __PRETTY_FUNCTION__).debug("QFontCache: inserting new engine %p", engine); partially evaluated: false no Evaluation Count:0 | yes Evaluation Count:1226 |
| 0-1226 |
1522 | | - |
1523 | Engine data(engine); | - |
1524 | data.timestamp = ++current_timestamp; | - |
1525 | | - |
1526 | if (insertMulti) partially evaluated: insertMulti no Evaluation Count:0 | yes Evaluation Count:1226 |
| 0-1226 |
1527 | engineCache.insertMulti(key, data); never executed: engineCache.insertMulti(key, data); | 0 |
1528 | else | - |
1529 | engineCache.insert(key, data); executed: engineCache.insert(key, data); Execution Count:1226 | 1226 |
1530 | | - |
1531 | | - |
1532 | if (engine->cache_count == 0) partially evaluated: engine->cache_count == 0 yes Evaluation Count:1226 | no Evaluation Count:0 |
| 0-1226 |
1533 | increaseCost(engine->cache_cost); executed: increaseCost(engine->cache_cost); Execution Count:1226 | 1226 |
1534 | | - |
1535 | ++engine->cache_count; | - |
1536 | } executed: } Execution Count:1226 | 1226 |
1537 | | - |
1538 | void QFontCache::increaseCost(uint cost) | - |
1539 | { | - |
1540 | cost = (cost + 512) / 1024; | - |
1541 | cost = cost > 0 ? cost : 1; partially evaluated: cost > 0 no Evaluation Count:0 | yes Evaluation Count:1836 |
| 0-1836 |
1542 | total_cost += cost; | - |
1543 | | - |
1544 | if (false) QMessageLogger("text/qfont.cpp", 2774, __PRETTY_FUNCTION__).debug(" COST: increased %u kb, total_cost %u kb, max_cost %u kb", partially evaluated: false no Evaluation Count:0 | yes Evaluation Count:1836 |
| 0-1836 |
1545 | cost, total_cost, max_cost); never executed: QMessageLogger("text/qfont.cpp", 2774, __PRETTY_FUNCTION__).debug(" COST: increased %u kb, total_cost %u kb, max_cost %u kb", cost, total_cost, max_cost); | 0 |
1546 | | - |
1547 | if (total_cost > max_cost) { partially evaluated: total_cost > max_cost no Evaluation Count:0 | yes Evaluation Count:1836 |
| 0-1836 |
1548 | max_cost = total_cost; | - |
1549 | | - |
1550 | if (timer_id == -1 || ! fast) { never evaluated: timer_id == -1 | 0 |
1551 | if (false) QMessageLogger("text/qfont.cpp", 2781, __PRETTY_FUNCTION__).debug(" TIMER: starting fast timer (%d ms)", fast_timeout); never executed: QMessageLogger("text/qfont.cpp", 2781, __PRETTY_FUNCTION__).debug(" TIMER: starting fast timer (%d ms)", fast_timeout); | 0 |
1552 | | - |
1553 | if (timer_id != -1) killTimer(timer_id); never executed: killTimer(timer_id); never evaluated: timer_id != -1 | 0 |
1554 | timer_id = startTimer(fast_timeout); | - |
1555 | fast = true; | - |
1556 | } | 0 |
1557 | } | 0 |
1558 | } executed: } Execution Count:1836 | 1836 |
1559 | | - |
1560 | void QFontCache::decreaseCost(uint cost) | - |
1561 | { | - |
1562 | cost = (cost + 512) / 1024; | - |
1563 | cost = cost > 0 ? cost : 1; never evaluated: cost > 0 | 0 |
1564 | qt_noop(); | - |
1565 | total_cost -= cost; | - |
1566 | | - |
1567 | if (false) QMessageLogger("text/qfont.cpp", 2797, __PRETTY_FUNCTION__).debug(" COST: decreased %u kb, total_cost %u kb, max_cost %u kb", | 0 |
1568 | cost, total_cost, max_cost); never executed: QMessageLogger("text/qfont.cpp", 2797, __PRETTY_FUNCTION__).debug(" COST: decreased %u kb, total_cost %u kb, max_cost %u kb", cost, total_cost, max_cost); | 0 |
1569 | } | 0 |
1570 | | - |
1571 | void QFontCache::timerEvent(QTimerEvent *) | - |
1572 | { | - |
1573 | if (false) QMessageLogger("text/qfont.cpp", 2803, __PRETTY_FUNCTION__).debug("QFontCache::timerEvent: performing cache maintenance (timestamp %u)", | 0 |
1574 | current_timestamp); never executed: QMessageLogger("text/qfont.cpp", 2803, __PRETTY_FUNCTION__).debug("QFontCache::timerEvent: performing cache maintenance (timestamp %u)", current_timestamp); | 0 |
1575 | | - |
1576 | if (total_cost <= max_cost && max_cost <= min_cost) { never evaluated: total_cost <= max_cost never evaluated: max_cost <= min_cost | 0 |
1577 | if (false) QMessageLogger("text/qfont.cpp", 2807, __PRETTY_FUNCTION__).debug(" cache redused sufficiently, stopping timer"); never executed: QMessageLogger("text/qfont.cpp", 2807, __PRETTY_FUNCTION__).debug(" cache redused sufficiently, stopping timer"); | 0 |
1578 | | - |
1579 | killTimer(timer_id); | - |
1580 | timer_id = -1; | - |
1581 | fast = false; | - |
1582 | | - |
1583 | return; | 0 |
1584 | } | - |
1585 | | - |
1586 | | - |
1587 | uint in_use_cost = 0; | - |
1588 | | - |
1589 | { | - |
1590 | if (false) QMessageLogger("text/qfont.cpp", 2820, __PRETTY_FUNCTION__).debug(" SWEEP engine data:"); never executed: QMessageLogger("text/qfont.cpp", 2820, __PRETTY_FUNCTION__).debug(" SWEEP engine data:"); | 0 |
1591 | | - |
1592 | | - |
1593 | const uint engine_data_cost = | - |
1594 | sizeof(QFontEngineData) > 1024 ? sizeof(QFontEngineData) : 1024; never evaluated: sizeof(QFontEngineData) > 1024 | 0 |
1595 | | - |
1596 | EngineDataCache::ConstIterator it = engineDataCache.constBegin(), | - |
1597 | end = engineDataCache.constEnd(); | - |
1598 | for (; it != end; ++it) { never evaluated: it != end | 0 |
1599 | | - |
1600 | | - |
1601 | | - |
1602 | | - |
1603 | | - |
1604 | if (it.value()->ref.load() != 0) never evaluated: it.value()->ref.load() != 0 | 0 |
1605 | in_use_cost += engine_data_cost; never executed: in_use_cost += engine_data_cost; | 0 |
1606 | } | 0 |
1607 | } | - |
1608 | | - |
1609 | { | - |
1610 | if (false) QMessageLogger("text/qfont.cpp", 2840, __PRETTY_FUNCTION__).debug(" SWEEP engine:"); never executed: QMessageLogger("text/qfont.cpp", 2840, __PRETTY_FUNCTION__).debug(" SWEEP engine:"); | 0 |
1611 | | - |
1612 | EngineCache::ConstIterator it = engineCache.constBegin(), | - |
1613 | end = engineCache.constEnd(); | - |
1614 | for (; it != end; ++it) { never evaluated: it != end | 0 |
1615 | if (false) QMessageLogger("text/qfont.cpp", 2845, __PRETTY_FUNCTION__).debug(" %p: timestamp %4u hits %2u ref %2d/%2d, cost %u bytes", | 0 |
1616 | it.value().data, it.value().timestamp, it.value().hits, | 0 |
1617 | it.value().data->ref.load(), it.value().data->cache_count, | 0 |
1618 | it.value().data->cache_cost); never executed: QMessageLogger("text/qfont.cpp", 2845, __PRETTY_FUNCTION__).debug(" %p: timestamp %4u hits %2u ref %2d/%2d, cost %u bytes", it.value().data, it.value().timestamp, it.value().hits, it.value().data->ref.load(), it.value().data->cache_count, it.value().data->cache_cost); | 0 |
1619 | | - |
1620 | if (it.value().data->ref.load() != 0) never evaluated: it.value().data->ref.load() != 0 | 0 |
1621 | in_use_cost += it.value().data->cache_cost / it.value().data->cache_count; never executed: in_use_cost += it.value().data->cache_cost / it.value().data->cache_count; | 0 |
1622 | } | 0 |
1623 | | - |
1624 | | - |
1625 | in_use_cost += engineCache.size(); | - |
1626 | } | - |
1627 | | - |
1628 | in_use_cost = (in_use_cost + 512) / 1024; | - |
1629 | uint new_max_cost = qMax(qMax(max_cost / 2, in_use_cost), min_cost); | - |
1630 | | - |
1631 | if (false) QMessageLogger("text/qfont.cpp", 2870, __PRETTY_FUNCTION__).debug(" after sweep, in use %u kb, total %u kb, max %u kb, new max %u kb", | 0 |
1632 | in_use_cost, total_cost, max_cost, new_max_cost); never executed: QMessageLogger("text/qfont.cpp", 2870, __PRETTY_FUNCTION__).debug(" after sweep, in use %u kb, total %u kb, max %u kb, new max %u kb", in_use_cost, total_cost, max_cost, new_max_cost); | 0 |
1633 | | - |
1634 | if (new_max_cost == max_cost) { never evaluated: new_max_cost == max_cost | 0 |
1635 | if (fast) { | 0 |
1636 | if (false) QMessageLogger("text/qfont.cpp", 2875, __PRETTY_FUNCTION__).debug(" cannot shrink cache, slowing timer"); never executed: QMessageLogger("text/qfont.cpp", 2875, __PRETTY_FUNCTION__).debug(" cannot shrink cache, slowing timer"); | 0 |
1637 | | - |
1638 | killTimer(timer_id); | - |
1639 | timer_id = startTimer(slow_timeout); | - |
1640 | fast = false; | - |
1641 | } | 0 |
1642 | | - |
1643 | return; | 0 |
1644 | } else if (! fast) { | 0 |
1645 | if (false) QMessageLogger("text/qfont.cpp", 2884, __PRETTY_FUNCTION__).debug(" dropping into passing gear"); never executed: QMessageLogger("text/qfont.cpp", 2884, __PRETTY_FUNCTION__).debug(" dropping into passing gear"); | 0 |
1646 | | - |
1647 | killTimer(timer_id); | - |
1648 | timer_id = startTimer(fast_timeout); | - |
1649 | fast = true; | - |
1650 | } | 0 |
1651 | | - |
1652 | max_cost = new_max_cost; | - |
1653 | | - |
1654 | { | - |
1655 | if (false) QMessageLogger("text/qfont.cpp", 2894, __PRETTY_FUNCTION__).debug(" CLEAN engine data:"); never executed: QMessageLogger("text/qfont.cpp", 2894, __PRETTY_FUNCTION__).debug(" CLEAN engine data:"); | 0 |
1656 | | - |
1657 | | - |
1658 | EngineDataCache::Iterator it = engineDataCache.begin(), | - |
1659 | end = engineDataCache.end(); | - |
1660 | while (it != end) { never evaluated: it != end | 0 |
1661 | if (it.value()->ref.load() != 0) { never evaluated: it.value()->ref.load() != 0 | 0 |
1662 | ++it; | - |
1663 | continue; never executed: continue; | 0 |
1664 | } | - |
1665 | | - |
1666 | EngineDataCache::Iterator rem = it++; | - |
1667 | | - |
1668 | decreaseCost(sizeof(QFontEngineData)); | - |
1669 | | - |
1670 | if (false) QMessageLogger("text/qfont.cpp", 2909, __PRETTY_FUNCTION__).debug(" %p", rem.value()); never executed: QMessageLogger("text/qfont.cpp", 2909, __PRETTY_FUNCTION__).debug(" %p", rem.value()); | 0 |
1671 | | - |
1672 | delete rem.value(); | - |
1673 | engineDataCache.erase(rem); | - |
1674 | } | 0 |
1675 | } | - |
1676 | | - |
1677 | | - |
1678 | uint current_cost; | - |
1679 | do { | - |
1680 | current_cost = total_cost; | - |
1681 | | - |
1682 | EngineCache::Iterator it = engineCache.begin(), | - |
1683 | end = engineCache.end(); | - |
1684 | | - |
1685 | uint oldest = ~0u; | - |
1686 | uint least_popular = ~0u; | - |
1687 | | - |
1688 | for (; it != end; ++it) { never evaluated: it != end | 0 |
1689 | if (it.value().data->ref.load() != 0) never evaluated: it.value().data->ref.load() != 0 | 0 |
1690 | continue; never executed: continue; | 0 |
1691 | | - |
1692 | if (it.value().timestamp < oldest && never evaluated: it.value().timestamp < oldest | 0 |
1693 | it.value().hits <= least_popular) { never evaluated: it.value().hits <= least_popular | 0 |
1694 | oldest = it.value().timestamp; | - |
1695 | least_popular = it.value().hits; | - |
1696 | } | 0 |
1697 | } | 0 |
1698 | | - |
1699 | if (false) QMessageLogger("text/qfont.cpp", 2938, __PRETTY_FUNCTION__).debug(" oldest %u least popular %u", oldest, least_popular); never executed: QMessageLogger("text/qfont.cpp", 2938, __PRETTY_FUNCTION__).debug(" oldest %u least popular %u", oldest, least_popular); | 0 |
1700 | | - |
1701 | for (it = engineCache.begin(); it != end; ++it) { never evaluated: it != end | 0 |
1702 | if (it.value().data->ref.load() == 0 && never evaluated: it.value().data->ref.load() == 0 | 0 |
1703 | it.value().timestamp == oldest && never evaluated: it.value().timestamp == oldest | 0 |
1704 | it.value().hits == least_popular) never evaluated: it.value().hits == least_popular | 0 |
1705 | break; | 0 |
1706 | } | 0 |
1707 | | - |
1708 | if (it != end) { never evaluated: it != end | 0 |
1709 | if (false) QMessageLogger("text/qfont.cpp", 2948, __PRETTY_FUNCTION__).debug(" %p: timestamp %4u hits %2u ref %2d/%2d, type '%s'", | 0 |
1710 | it.value().data, it.value().timestamp, it.value().hits, | 0 |
1711 | it.value().data->ref.load(), it.value().data->cache_count, | 0 |
1712 | it.value().data->name()); never executed: QMessageLogger("text/qfont.cpp", 2948, __PRETTY_FUNCTION__).debug(" %p: timestamp %4u hits %2u ref %2d/%2d, type '%s'", it.value().data, it.value().timestamp, it.value().hits, it.value().data->ref.load(), it.value().data->cache_count, it.value().data->name()); | 0 |
1713 | | - |
1714 | if (--it.value().data->cache_count == 0) { never evaluated: --it.value().data->cache_count == 0 | 0 |
1715 | if (false) QMessageLogger("text/qfont.cpp", 2954, __PRETTY_FUNCTION__).debug(" DELETE: last occurrence in cache"); never executed: QMessageLogger("text/qfont.cpp", 2954, __PRETTY_FUNCTION__).debug(" DELETE: last occurrence in cache"); | 0 |
1716 | | - |
1717 | decreaseCost(it.value().data->cache_cost); | - |
1718 | delete it.value().data; | - |
1719 | } else { | 0 |
1720 | | - |
1721 | | - |
1722 | | - |
1723 | | - |
1724 | | - |
1725 | current_cost = 0; | - |
1726 | } | 0 |
1727 | | - |
1728 | engineCache.erase(it); | - |
1729 | } | 0 |
1730 | } while (current_cost != total_cost && total_cost > max_cost); never evaluated: current_cost != total_cost never evaluated: total_cost > max_cost | 0 |
1731 | } | 0 |
1732 | | - |
1733 | | - |
1734 | | - |
1735 | QDebug operator<<(QDebug stream, const QFont &font) | - |
1736 | { | - |
1737 | return stream << "QFont(" << font.toString() << ')'; executed: return stream << "QFont(" << font.toString() << ')'; Execution Count:1 | 1 |
1738 | } | - |
1739 | | - |
1740 | | - |
1741 | | - |
1742 | | - |
| | |