| Line | Source Code | Coverage |
|---|
| 1 | /**************************************************************************** | - |
| 2 | ** | - |
| 3 | ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). | - |
| 4 | ** Contact: http://www.qt-project.org/legal | - |
| 5 | ** | - |
| 6 | ** This file is part of the QtGui module of the Qt Toolkit. | - |
| 7 | ** | - |
| 8 | ** $QT_BEGIN_LICENSE:LGPL$ | - |
| 9 | ** Commercial License Usage | - |
| 10 | ** Licensees holding valid commercial Qt licenses may use this file in | - |
| 11 | ** accordance with the commercial license agreement provided with the | - |
| 12 | ** Software or, alternatively, in accordance with the terms contained in | - |
| 13 | ** a written agreement between you and Digia. For licensing terms and | - |
| 14 | ** conditions see http://qt.digia.com/licensing. For further information | - |
| 15 | ** use the contact form at http://qt.digia.com/contact-us. | - |
| 16 | ** | - |
| 17 | ** GNU Lesser General Public License Usage | - |
| 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser | - |
| 19 | ** General Public License version 2.1 as published by the Free Software | - |
| 20 | ** Foundation and appearing in the file LICENSE.LGPL included in the | - |
| 21 | ** packaging of this file. Please review the following information to | - |
| 22 | ** ensure the GNU Lesser General Public License version 2.1 requirements | - |
| 23 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. | - |
| 24 | ** | - |
| 25 | ** In addition, as a special exception, Digia gives you certain additional | - |
| 26 | ** rights. These rights are described in the Digia Qt LGPL Exception | - |
| 27 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. | - |
| 28 | ** | - |
| 29 | ** GNU General Public License Usage | - |
| 30 | ** Alternatively, this file may be used under the terms of the GNU | - |
| 31 | ** General Public License version 3.0 as published by the Free Software | - |
| 32 | ** Foundation and appearing in the file LICENSE.GPL included in the | - |
| 33 | ** packaging of this file. Please review the following information to | - |
| 34 | ** ensure the GNU General Public License version 3.0 requirements will be | - |
| 35 | ** met: http://www.gnu.org/copyleft/gpl.html. | - |
| 36 | ** | - |
| 37 | ** | - |
| 38 | ** $QT_END_LICENSE$ | - |
| 39 | ** | - |
| 40 | ****************************************************************************/ | - |
| 41 | | - |
| 42 | #include "qfont.h" | - |
| 43 | #include "qdebug.h" | - |
| 44 | #include "qpaintdevice.h" | - |
| 45 | #include "qfontdatabase.h" | - |
| 46 | #include "qfontmetrics.h" | - |
| 47 | #include "qfontinfo.h" | - |
| 48 | #include "qpainter.h" | - |
| 49 | #include "qhash.h" | - |
| 50 | #include "qdatastream.h" | - |
| 51 | #include "qguiapplication.h" | - |
| 52 | #include "qstringlist.h" | - |
| 53 | #include "qscreen.h" | - |
| 54 | | - |
| 55 | #include "qthread.h" | - |
| 56 | #include "qthreadstorage.h" | - |
| 57 | | - |
| 58 | #include <private/qunicodetables_p.h> | - |
| 59 | #include "qfont_p.h" | - |
| 60 | #include <private/qfontengine_p.h> | - |
| 61 | #include <private/qpainter_p.h> | - |
| 62 | #include <private/qtextengine_p.h> | - |
| 63 | #include <limits.h> | - |
| 64 | | - |
| 65 | #include <qpa/qplatformscreen.h> | - |
| 66 | #include <QtGui/private/qguiapplication_p.h> | - |
| 67 | | - |
| 68 | #include <QtCore/QMutexLocker> | - |
| 69 | #include <QtCore/QMutex> | - |
| 70 | | - |
| 71 | // #define QFONTCACHE_DEBUG | - |
| 72 | #ifdef QFONTCACHE_DEBUG | - |
| 73 | # define FC_DEBUG qDebug | - |
| 74 | #else | - |
| 75 | # define FC_DEBUG if (false) qDebug | - |
| 76 | #endif | - |
| 77 | | - |
| 78 | QT_BEGIN_NAMESPACE | - |
| 79 | | - |
| 80 | | - |
| 81 | | - |
| 82 | bool QFontDef::exactMatch(const QFontDef &other) const | - |
| 83 | { | - |
| 84 | /* | - |
| 85 | QFontDef comparison is more complicated than just simple | - |
| 86 | per-member comparisons. | - |
| 87 | | - |
| 88 | When comparing point/pixel sizes, either point or pixelsize | - |
| 89 | could be -1. in This case we have to compare the non negative | - |
| 90 | size value. | - |
| 91 | | - |
| 92 | This test will fail if the point-sizes differ by 1/2 point or | - |
| 93 | more or they do not round to the same value. We have to do this | - |
| 94 | since our API still uses 'int' point-sizes in the API, but store | - |
| 95 | deci-point-sizes internally. | - |
| 96 | | - |
| 97 | To compare the family members, we need to parse the font names | - |
| 98 | and compare the family/foundry strings separately. This allows | - |
| 99 | us to compare e.g. "Helvetica" and "Helvetica [Adobe]" with | - |
| 100 | positive results. | - |
| 101 | */ | - |
| 102 | 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 |
| 103 | if (pixelSize != other.pixelSize) never evaluated: pixelSize != other.pixelSize | 0 |
| 104 | return false; never executed: return false; | 0 |
| 105 | } else if (pointSize != -1 && other.pointSize != -1) { never executed: } 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 |
| 106 | if (pointSize != other.pointSize) evaluated: pointSize != other.pointSize| yes Evaluation Count:10 | yes Evaluation Count:2 |
| 2-10 |
| 107 | return false; executed: return false;Execution Count:10 | 10 |
| 108 | } else { executed: }Execution Count:2 | 2 |
| 109 | return false; never executed: return false; | 0 |
| 110 | } | - |
| 111 | | - |
| 112 | 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 |
| 113 | return false; never executed: return false; | 0 |
| 114 | | - |
| 115 | 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 |
| 116 | return false; never executed: return false; | 0 |
| 117 | | - |
| 118 | QString this_family, this_foundry, other_family, other_foundry; executed (the execution status of this line is deduced): QString this_family, this_foundry, other_family, other_foundry; | - |
| 119 | QFontDatabase::parseFontName(family, this_foundry, this_family); executed (the execution status of this line is deduced): QFontDatabase::parseFontName(family, this_foundry, this_family); | - |
| 120 | QFontDatabase::parseFontName(other.family, other_foundry, other_family); executed (the execution status of this line is deduced): QFontDatabase::parseFontName(other.family, other_foundry, other_family); | - |
| 121 | | - |
| 122 | this_family = QFontDatabase::resolveFontFamilyAlias(this_family); executed (the execution status of this line is deduced): this_family = QFontDatabase::resolveFontFamilyAlias(this_family); | - |
| 123 | other_family = QFontDatabase::resolveFontFamilyAlias(other_family); executed (the execution status of this line is deduced): other_family = QFontDatabase::resolveFontFamilyAlias(other_family); | - |
| 124 | | - |
| 125 | return (styleHint == other.styleHint 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 |
| 126 | && styleStrategy == other.styleStrategy 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 |
| 127 | && weight == other.weight 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 |
| 128 | && style == other.style 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 |
| 129 | && this_family == other_family 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 |
| 130 | && (styleName.isEmpty() || other.styleName.isEmpty() || styleName == other.styleName) 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 |
| 131 | && (this_foundry.isEmpty() 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 |
| 132 | || other_foundry.isEmpty() 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 |
| 133 | || this_foundry == other_foundry) 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 |
| 134 | ); 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 |
| 135 | } | - |
| 136 | | - |
| 137 | extern bool qt_is_gui_used; | - |
| 138 | | - |
| 139 | Q_GUI_EXPORT int qt_defaultDpiX() | - |
| 140 | { | - |
| 141 | if (qApp->testAttribute(Qt::AA_Use96Dpi)) evaluated: (static_cast<QGuiApplication *>(QCoreApplication::instance()))->testAttribute(Qt::AA_Use96Dpi)| yes Evaluation Count:183637 | yes Evaluation Count:194 |
| 194-183637 |
| 142 | return 96; executed: return 96;Execution Count:183637 | 183637 |
| 143 | | - |
| 144 | if (!qt_is_gui_used) partially evaluated: !qt_is_gui_used| no Evaluation Count:0 | yes Evaluation Count:194 |
| 0-194 |
| 145 | return 75; never executed: return 75; | 0 |
| 146 | | - |
| 147 | if (const QScreen *screen = QGuiApplication::primaryScreen()) partially evaluated: const QScreen *screen = QGuiApplication::primaryScreen()| yes Evaluation Count:194 | no Evaluation Count:0 |
| 0-194 |
| 148 | return qRound(screen->logicalDotsPerInchX()); executed: return qRound(screen->logicalDotsPerInchX());Execution Count:194 | 194 |
| 149 | | - |
| 150 | //PI has not been initialised, or it is being initialised. Give a default dpi | - |
| 151 | return 100; never executed: return 100; | 0 |
| 152 | } | - |
| 153 | | - |
| 154 | Q_GUI_EXPORT int qt_defaultDpiY() | - |
| 155 | { | - |
| 156 | if (qApp->testAttribute(Qt::AA_Use96Dpi)) evaluated: (static_cast<QGuiApplication *>(QCoreApplication::instance()))->testAttribute(Qt::AA_Use96Dpi)| yes Evaluation Count:233306 | yes Evaluation Count:503 |
| 503-233306 |
| 157 | return 96; executed: return 96;Execution Count:233306 | 233306 |
| 158 | | - |
| 159 | if (!qt_is_gui_used) partially evaluated: !qt_is_gui_used| no Evaluation Count:0 | yes Evaluation Count:503 |
| 0-503 |
| 160 | return 75; never executed: return 75; | 0 |
| 161 | | - |
| 162 | if (const QScreen *screen = QGuiApplication::primaryScreen()) evaluated: const QScreen *screen = QGuiApplication::primaryScreen()| yes Evaluation Count:491 | yes Evaluation Count:12 |
| 12-491 |
| 163 | return qRound(screen->logicalDotsPerInchY()); executed: return qRound(screen->logicalDotsPerInchY());Execution Count:491 | 491 |
| 164 | | - |
| 165 | //PI has not been initialised, or it is being initialised. Give a default dpi | - |
| 166 | return 100; executed: return 100;Execution Count:12 | 12 |
| 167 | } | - |
| 168 | | - |
| 169 | Q_GUI_EXPORT int qt_defaultDpi() | - |
| 170 | { | - |
| 171 | return qt_defaultDpiY(); executed: return qt_defaultDpiY();Execution Count:50824 | 50824 |
| 172 | } | - |
| 173 | | - |
| 174 | QFontPrivate::QFontPrivate() | - |
| 175 | : engineData(0), dpi(qt_defaultDpi()), screen(0), | - |
| 176 | rawMode(false), underline(false), overline(false), strikeOut(false), kerning(true), | - |
| 177 | capital(0), letterSpacingIsAbsolute(false), scFont(0) | - |
| 178 | { | - |
| 179 | } executed: }Execution Count:1921 | 1921 |
| 180 | | - |
| 181 | QFontPrivate::QFontPrivate(const QFontPrivate &other) | - |
| 182 | : request(other.request), engineData(0), dpi(other.dpi), screen(other.screen), | - |
| 183 | rawMode(other.rawMode), underline(other.underline), overline(other.overline), | - |
| 184 | strikeOut(other.strikeOut), kerning(other.kerning), | - |
| 185 | capital(other.capital), letterSpacingIsAbsolute(other.letterSpacingIsAbsolute), | - |
| 186 | letterSpacing(other.letterSpacing), wordSpacing(other.wordSpacing), | - |
| 187 | scFont(other.scFont) | - |
| 188 | { | - |
| 189 | if (scFont && scFont != this) partially evaluated: scFont| no Evaluation Count:0 | yes Evaluation Count:40097 |
never evaluated: scFont != this | 0-40097 |
| 190 | scFont->ref.ref(); never executed: scFont->ref.ref(); | 0 |
| 191 | } executed: }Execution Count:40097 | 40097 |
| 192 | | - |
| 193 | QFontPrivate::~QFontPrivate() | - |
| 194 | { | - |
| 195 | if (engineData) evaluated: engineData| yes Evaluation Count:29982 | yes Evaluation Count:12002 |
| 12002-29982 |
| 196 | engineData->ref.deref(); executed: engineData->ref.deref();Execution Count:29982 | 29982 |
| 197 | engineData = 0; executed (the execution status of this line is deduced): engineData = 0; | - |
| 198 | if (scFont && scFont != this) partially evaluated: scFont| no Evaluation Count:0 | yes Evaluation Count:41984 |
never evaluated: scFont != this | 0-41984 |
| 199 | scFont->ref.deref(); never executed: scFont->ref.deref(); | 0 |
| 200 | scFont = 0; executed (the execution status of this line is deduced): scFont = 0; | - |
| 201 | } executed: }Execution Count:41984 | 41984 |
| 202 | | - |
| 203 | extern QMutex *qt_fontdatabase_mutex(); | - |
| 204 | | - |
| 205 | #define QT_FONT_ENGINE_FROM_DATA(data, script) data->engines[script] | - |
| 206 | | - |
| 207 | QFontEngine *QFontPrivate::engineForScript(int script) const | - |
| 208 | { | - |
| 209 | QMutexLocker locker(qt_fontdatabase_mutex()); executed (the execution status of this line is deduced): QMutexLocker locker(qt_fontdatabase_mutex()); | - |
| 210 | if (script >= QUnicodeTables::Inherited) partially evaluated: script >= QUnicodeTables::Inherited| no Evaluation Count:0 | yes Evaluation Count:380606 |
| 0-380606 |
| 211 | script = QUnicodeTables::Common; never executed: script = QUnicodeTables::Common; | 0 |
| 212 | 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 |
| 213 | // throw out engineData that came from a different thread | - |
| 214 | engineData->ref.deref(); never executed (the execution status of this line is deduced): engineData->ref.deref(); | - |
| 215 | engineData = 0; never executed (the execution status of this line is deduced): engineData = 0; | - |
| 216 | } | 0 |
| 217 | if (!engineData || !QT_FONT_ENGINE_FROM_DATA(engineData, 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 |
| 218 | QFontDatabase::load(this, script); executed: QFontDatabase::load(this, script);Execution Count:29929 | 29929 |
| 219 | return QT_FONT_ENGINE_FROM_DATA(engineData, script); executed: return engineData->engines[script];Execution Count:380606 | 380606 |
| 220 | } | - |
| 221 | | - |
| 222 | void QFontPrivate::alterCharForCapitalization(QChar &c) const { | - |
| 223 | switch (capital) { | - |
| 224 | case QFont::AllUppercase: | - |
| 225 | case QFont::SmallCaps: | - |
| 226 | c = c.toUpper(); never executed (the execution status of this line is deduced): c = c.toUpper(); | - |
| 227 | break; | 0 |
| 228 | case QFont::AllLowercase: | - |
| 229 | c = c.toLower(); never executed (the execution status of this line is deduced): c = c.toLower(); | - |
| 230 | break; | 0 |
| 231 | case QFont::MixedCase: | - |
| 232 | break; executed: break;Execution Count:1974 | 1974 |
| 233 | } | - |
| 234 | } executed: }Execution Count:1974 | 1974 |
| 235 | | - |
| 236 | QFontPrivate *QFontPrivate::smallCapsFontPrivate() const | - |
| 237 | { | - |
| 238 | if (scFont) | 0 |
| 239 | return scFont; never executed: return scFont; | 0 |
| 240 | QFont font(const_cast<QFontPrivate *>(this)); never executed (the execution status of this line is deduced): QFont font(const_cast<QFontPrivate *>(this)); | - |
| 241 | qreal pointSize = font.pointSizeF(); never executed (the execution status of this line is deduced): qreal pointSize = font.pointSizeF(); | - |
| 242 | if (pointSize > 0) never evaluated: pointSize > 0 | 0 |
| 243 | font.setPointSizeF(pointSize * .7); never executed: font.setPointSizeF(pointSize * .7); | 0 |
| 244 | else | - |
| 245 | font.setPixelSize((font.pixelSize() * 7 + 5) / 10); never executed: font.setPixelSize((font.pixelSize() * 7 + 5) / 10); | 0 |
| 246 | scFont = font.d.data(); never executed (the execution status of this line is deduced): scFont = font.d.data(); | - |
| 247 | if (scFont != this) never evaluated: scFont != this | 0 |
| 248 | scFont->ref.ref(); never executed: scFont->ref.ref(); | 0 |
| 249 | return scFont; never executed: return scFont; | 0 |
| 250 | } | - |
| 251 | | - |
| 252 | | - |
| 253 | void QFontPrivate::resolve(uint mask, const QFontPrivate *other) | - |
| 254 | { | - |
| 255 | Q_ASSERT(other != 0); executed (the execution status of this line is deduced): qt_noop(); | - |
| 256 | | - |
| 257 | dpi = other->dpi; executed (the execution status of this line is deduced): dpi = other->dpi; | - |
| 258 | | - |
| 259 | if ((mask & QFont::AllPropertiesResolved) == QFont::AllPropertiesResolved) return; never executed: return; partially evaluated: (mask & QFont::AllPropertiesResolved) == QFont::AllPropertiesResolved| no Evaluation Count:0 | yes Evaluation Count:5312 |
| 0-5312 |
| 260 | | - |
| 261 | // assign the unset-bits with the set-bits of the other font def | - |
| 262 | if (! (mask & QFont::FamilyResolved)) evaluated: ! (mask & QFont::FamilyResolved)| yes Evaluation Count:1825 | yes Evaluation Count:3487 |
| 1825-3487 |
| 263 | request.family = other->request.family; executed: request.family = other->request.family;Execution Count:1825 | 1825 |
| 264 | | - |
| 265 | if (! (mask & QFont::StyleNameResolved)) evaluated: ! (mask & QFont::StyleNameResolved)| yes Evaluation Count:5222 | yes Evaluation Count:90 |
| 90-5222 |
| 266 | request.styleName = other->request.styleName; executed: request.styleName = other->request.styleName;Execution Count:5222 | 5222 |
| 267 | | - |
| 268 | if (! (mask & QFont::SizeResolved)) { evaluated: ! (mask & QFont::SizeResolved)| yes Evaluation Count:2187 | yes Evaluation Count:3125 |
| 2187-3125 |
| 269 | request.pointSize = other->request.pointSize; executed (the execution status of this line is deduced): request.pointSize = other->request.pointSize; | - |
| 270 | request.pixelSize = other->request.pixelSize; executed (the execution status of this line is deduced): request.pixelSize = other->request.pixelSize; | - |
| 271 | } executed: }Execution Count:2187 | 2187 |
| 272 | | - |
| 273 | if (! (mask & QFont::StyleHintResolved)) evaluated: ! (mask & QFont::StyleHintResolved)| yes Evaluation Count:2565 | yes Evaluation Count:2747 |
| 2565-2747 |
| 274 | request.styleHint = other->request.styleHint; executed: request.styleHint = other->request.styleHint;Execution Count:2565 | 2565 |
| 275 | | - |
| 276 | if (! (mask & QFont::StyleStrategyResolved)) evaluated: ! (mask & QFont::StyleStrategyResolved)| yes Evaluation Count:2559 | yes Evaluation Count:2753 |
| 2559-2753 |
| 277 | request.styleStrategy = other->request.styleStrategy; executed: request.styleStrategy = other->request.styleStrategy;Execution Count:2559 | 2559 |
| 278 | | - |
| 279 | if (! (mask & QFont::WeightResolved)) evaluated: ! (mask & QFont::WeightResolved)| yes Evaluation Count:1729 | yes Evaluation Count:3583 |
| 1729-3583 |
| 280 | request.weight = other->request.weight; executed: request.weight = other->request.weight;Execution Count:1729 | 1729 |
| 281 | | - |
| 282 | if (! (mask & QFont::StyleResolved)) evaluated: ! (mask & QFont::StyleResolved)| yes Evaluation Count:2415 | yes Evaluation Count:2897 |
| 2415-2897 |
| 283 | request.style = other->request.style; executed: request.style = other->request.style;Execution Count:2415 | 2415 |
| 284 | | - |
| 285 | if (! (mask & QFont::FixedPitchResolved)) evaluated: ! (mask & QFont::FixedPitchResolved)| yes Evaluation Count:4770 | yes Evaluation Count:542 |
| 542-4770 |
| 286 | request.fixedPitch = other->request.fixedPitch; executed: request.fixedPitch = other->request.fixedPitch;Execution Count:4770 | 4770 |
| 287 | | - |
| 288 | if (! (mask & QFont::StretchResolved)) evaluated: ! (mask & QFont::StretchResolved)| yes Evaluation Count:2563 | yes Evaluation Count:2749 |
| 2563-2749 |
| 289 | request.stretch = other->request.stretch; executed: request.stretch = other->request.stretch;Execution Count:2563 | 2563 |
| 290 | | - |
| 291 | if (! (mask & QFont::HintingPreferenceResolved)) partially evaluated: ! (mask & QFont::HintingPreferenceResolved)| yes Evaluation Count:5312 | no Evaluation Count:0 |
| 0-5312 |
| 292 | request.hintingPreference = other->request.hintingPreference; executed: request.hintingPreference = other->request.hintingPreference;Execution Count:5312 | 5312 |
| 293 | | - |
| 294 | if (! (mask & QFont::UnderlineResolved)) evaluated: ! (mask & QFont::UnderlineResolved)| yes Evaluation Count:2378 | yes Evaluation Count:2934 |
| 2378-2934 |
| 295 | underline = other->underline; executed: underline = other->underline;Execution Count:2378 | 2378 |
| 296 | | - |
| 297 | if (! (mask & QFont::OverlineResolved)) evaluated: ! (mask & QFont::OverlineResolved)| yes Evaluation Count:2556 | yes Evaluation Count:2756 |
| 2556-2756 |
| 298 | overline = other->overline; executed: overline = other->overline;Execution Count:2556 | 2556 |
| 299 | | - |
| 300 | if (! (mask & QFont::StrikeOutResolved)) evaluated: ! (mask & QFont::StrikeOutResolved)| yes Evaluation Count:2463 | yes Evaluation Count:2849 |
| 2463-2849 |
| 301 | strikeOut = other->strikeOut; executed: strikeOut = other->strikeOut;Execution Count:2463 | 2463 |
| 302 | | - |
| 303 | if (! (mask & QFont::KerningResolved)) evaluated: ! (mask & QFont::KerningResolved)| yes Evaluation Count:2565 | yes Evaluation Count:2747 |
| 2565-2747 |
| 304 | kerning = other->kerning; executed: kerning = other->kerning;Execution Count:2565 | 2565 |
| 305 | | - |
| 306 | if (! (mask & QFont::LetterSpacingResolved)) { evaluated: ! (mask & QFont::LetterSpacingResolved)| yes Evaluation Count:2565 | yes Evaluation Count:2747 |
| 2565-2747 |
| 307 | letterSpacing = other->letterSpacing; executed (the execution status of this line is deduced): letterSpacing = other->letterSpacing; | - |
| 308 | letterSpacingIsAbsolute = other->letterSpacingIsAbsolute; executed (the execution status of this line is deduced): letterSpacingIsAbsolute = other->letterSpacingIsAbsolute; | - |
| 309 | } executed: }Execution Count:2565 | 2565 |
| 310 | if (! (mask & QFont::WordSpacingResolved)) evaluated: ! (mask & QFont::WordSpacingResolved)| yes Evaluation Count:2563 | yes Evaluation Count:2749 |
| 2563-2749 |
| 311 | wordSpacing = other->wordSpacing; executed: wordSpacing = other->wordSpacing;Execution Count:2563 | 2563 |
| 312 | if (! (mask & QFont::CapitalizationResolved)) evaluated: ! (mask & QFont::CapitalizationResolved)| yes Evaluation Count:2559 | yes Evaluation Count:2753 |
| 2559-2753 |
| 313 | capital = other->capital; executed: capital = other->capital;Execution Count:2559 | 2559 |
| 314 | } executed: }Execution Count:5312 | 5312 |
| 315 | | - |
| 316 | | - |
| 317 | | - |
| 318 | | - |
| 319 | QFontEngineData::QFontEngineData() | - |
| 320 | : ref(1), fontCache(QFontCache::instance()) | - |
| 321 | { | - |
| 322 | memset(engines, 0, QUnicodeTables::ScriptCount * sizeof(QFontEngine *)); executed (the execution status of this line is deduced): memset(engines, 0, QUnicodeTables::ScriptCount * sizeof(QFontEngine *)); | - |
| 323 | } executed: }Execution Count:610 | 610 |
| 324 | | - |
| 325 | QFontEngineData::~QFontEngineData() | - |
| 326 | { | - |
| 327 | for (int i = 0; i < QUnicodeTables::ScriptCount; ++i) { evaluated: i < QUnicodeTables::ScriptCount| yes Evaluation Count:14280 | yes Evaluation Count:510 |
| 510-14280 |
| 328 | if (engines[i]) partially evaluated: engines[i]| no Evaluation Count:0 | yes Evaluation Count:14280 |
| 0-14280 |
| 329 | engines[i]->ref.deref(); never executed: engines[i]->ref.deref(); | 0 |
| 330 | engines[i] = 0; executed (the execution status of this line is deduced): engines[i] = 0; | - |
| 331 | } executed: }Execution Count:14280 | 14280 |
| 332 | } executed: }Execution Count:510 | 510 |
| 333 | | - |
| 334 | | - |
| 335 | | - |
| 336 | | - |
| 337 | /*! | - |
| 338 | \class QFont | - |
| 339 | \reentrant | - |
| 340 | | - |
| 341 | \brief The QFont class specifies a font used for drawing text. | - |
| 342 | | - |
| 343 | \ingroup painting | - |
| 344 | \ingroup appearance | - |
| 345 | \ingroup shared | - |
| 346 | \ingroup richtext-processing | - |
| 347 | \inmodule QtGui | - |
| 348 | | - |
| 349 | | - |
| 350 | When you create a QFont object you specify various attributes that | - |
| 351 | you want the font to have. Qt will use the font with the specified | - |
| 352 | attributes, or if no matching font exists, Qt will use the closest | - |
| 353 | matching installed font. The attributes of the font that is | - |
| 354 | actually used are retrievable from a QFontInfo object. If the | - |
| 355 | window system provides an exact match exactMatch() returns true. | - |
| 356 | Use QFontMetrics to get measurements, e.g. the pixel length of a | - |
| 357 | string using QFontMetrics::width(). | - |
| 358 | | - |
| 359 | Note that a QGuiApplication instance must exist before a QFont can be | - |
| 360 | used. You can set the application's default font with | - |
| 361 | QGuiApplication::setFont(). | - |
| 362 | | - |
| 363 | If a chosen font does not include all the characters that | - |
| 364 | need to be displayed, QFont will try to find the characters in the | - |
| 365 | nearest equivalent fonts. When a QPainter draws a character from a | - |
| 366 | font the QFont will report whether or not it has the character; if | - |
| 367 | it does not, QPainter will draw an unfilled square. | - |
| 368 | | - |
| 369 | Create QFonts like this: | - |
| 370 | | - |
| 371 | \snippet code/src_gui_text_qfont.cpp 0 | - |
| 372 | | - |
| 373 | The attributes set in the constructor can also be set later, e.g. | - |
| 374 | setFamily(), setPointSize(), setPointSizeF(), setWeight() and | - |
| 375 | setItalic(). The remaining attributes must be set after | - |
| 376 | contstruction, e.g. setBold(), setUnderline(), setOverline(), | - |
| 377 | setStrikeOut() and setFixedPitch(). QFontInfo objects should be | - |
| 378 | created \e after the font's attributes have been set. A QFontInfo | - |
| 379 | object will not change, even if you change the font's | - |
| 380 | attributes. The corresponding "get" functions, e.g. family(), | - |
| 381 | pointSize(), etc., return the values that were set, even though | - |
| 382 | the values used may differ. The actual values are available from a | - |
| 383 | QFontInfo object. | - |
| 384 | | - |
| 385 | If the requested font family is unavailable you can influence the | - |
| 386 | \l{#fontmatching}{font matching algorithm} by choosing a | - |
| 387 | particular \l{QFont::StyleHint} and \l{QFont::StyleStrategy} with | - |
| 388 | setStyleHint(). The default family (corresponding to the current | - |
| 389 | style hint) is returned by defaultFamily(). | - |
| 390 | | - |
| 391 | The font-matching algorithm has a lastResortFamily() and | - |
| 392 | lastResortFont() in cases where a suitable match cannot be found. | - |
| 393 | You can provide substitutions for font family names using | - |
| 394 | insertSubstitution() and insertSubstitutions(). Substitutions can | - |
| 395 | be removed with removeSubstitutions(). Use substitute() to retrieve | - |
| 396 | a family's first substitute, or the family name itself if it has | - |
| 397 | no substitutes. Use substitutes() to retrieve a list of a family's | - |
| 398 | substitutes (which may be empty). | - |
| 399 | | - |
| 400 | Every QFont has a key() which you can use, for example, as the key | - |
| 401 | in a cache or dictionary. If you want to store a user's font | - |
| 402 | preferences you could use QSettings, writing the font information | - |
| 403 | with toString() and reading it back with fromString(). The | - |
| 404 | operator<<() and operator>>() functions are also available, but | - |
| 405 | they work on a data stream. | - |
| 406 | | - |
| 407 | It is possible to set the height of characters shown on the screen | - |
| 408 | to a specified number of pixels with setPixelSize(); however using | - |
| 409 | setPointSize() has a similar effect and provides device | - |
| 410 | independence. | - |
| 411 | | - |
| 412 | In X11 you can set a font using its system | - |
| 413 | specific name with setRawName(). | - |
| 414 | | - |
| 415 | Loading fonts can be expensive, especially on X11. QFont contains | - |
| 416 | extensive optimizations to make the copying of QFont objects fast, | - |
| 417 | and to cache the results of the slow window system functions it | - |
| 418 | depends upon. | - |
| 419 | | - |
| 420 | \target fontmatching | - |
| 421 | The font matching algorithm works as follows: | - |
| 422 | \list 1 | - |
| 423 | \li The specified font family is searched for. | - |
| 424 | \li If not found, the styleHint() is used to select a replacement | - |
| 425 | family. | - |
| 426 | \li Each replacement font family is searched for. | - |
| 427 | \li If none of these are found or there was no styleHint(), "helvetica" | - |
| 428 | will be searched for. | - |
| 429 | \li If "helvetica" isn't found Qt will try the lastResortFamily(). | - |
| 430 | \li If the lastResortFamily() isn't found Qt will try the | - |
| 431 | lastResortFont() which will always return a name of some kind. | - |
| 432 | \endlist | - |
| 433 | | - |
| 434 | Note that the actual font matching algorithm varies from platform to platform. | - |
| 435 | | - |
| 436 | In Windows a request for the "Courier" font is automatically changed to | - |
| 437 | "Courier New", an improved version of Courier that allows for smooth scaling. | - |
| 438 | The older "Courier" bitmap font can be selected by setting the PreferBitmap | - |
| 439 | style strategy (see setStyleStrategy()). | - |
| 440 | | - |
| 441 | Once a font is found, the remaining attributes are matched in order of | - |
| 442 | priority: | - |
| 443 | \list 1 | - |
| 444 | \li fixedPitch() | - |
| 445 | \li pointSize() (see below) | - |
| 446 | \li weight() | - |
| 447 | \li style() | - |
| 448 | \endlist | - |
| 449 | | - |
| 450 | If you have a font which matches on family, even if none of the | - |
| 451 | other attributes match, this font will be chosen in preference to | - |
| 452 | a font which doesn't match on family but which does match on the | - |
| 453 | other attributes. This is because font family is the dominant | - |
| 454 | search criteria. | - |
| 455 | | - |
| 456 | The point size is defined to match if it is within 20% of the | - |
| 457 | requested point size. When several fonts match and are only | - |
| 458 | distinguished by point size, the font with the closest point size | - |
| 459 | to the one requested will be chosen. | - |
| 460 | | - |
| 461 | The actual family, font size, weight and other font attributes | - |
| 462 | used for drawing text will depend on what's available for the | - |
| 463 | chosen family under the window system. A QFontInfo object can be | - |
| 464 | used to determine the actual values used for drawing the text. | - |
| 465 | | - |
| 466 | Examples: | - |
| 467 | | - |
| 468 | \snippet code/src_gui_text_qfont.cpp 1 | - |
| 469 | If you had both an Adobe and a Cronyx Helvetica, you might get | - |
| 470 | either. | - |
| 471 | | - |
| 472 | \snippet code/src_gui_text_qfont.cpp 2 | - |
| 473 | | - |
| 474 | You can specify the foundry you want in the family name. The font f | - |
| 475 | in the above example will be set to "Helvetica | - |
| 476 | [Cronyx]". | - |
| 477 | | - |
| 478 | To determine the attributes of the font actually used in the window | - |
| 479 | system, use a QFontInfo object, e.g. | - |
| 480 | | - |
| 481 | \snippet code/src_gui_text_qfont.cpp 3 | - |
| 482 | | - |
| 483 | To find out font metrics use a QFontMetrics object, e.g. | - |
| 484 | | - |
| 485 | \snippet code/src_gui_text_qfont.cpp 4 | - |
| 486 | | - |
| 487 | For more general information on fonts, see the | - |
| 488 | \l{comp.fonts FAQ}{comp.fonts FAQ}. | - |
| 489 | Information on encodings can be found from | - |
| 490 | \l{Roman Czyborra's} page. | - |
| 491 | | - |
| 492 | \sa QFontMetrics, QFontInfo, QFontDatabase, {Character Map Example} | - |
| 493 | */ | - |
| 494 | | - |
| 495 | /*! | - |
| 496 | \internal | - |
| 497 | \enum QFont::ResolveProperties | - |
| 498 | | - |
| 499 | This enum describes the properties of a QFont that can be set on a font | - |
| 500 | individually and then considered resolved. | - |
| 501 | | - |
| 502 | \value FamilyResolved | - |
| 503 | \value SizeResolved | - |
| 504 | \value StyleHintResolved | - |
| 505 | \value StyleStrategyResolved | - |
| 506 | \value WeightResolved | - |
| 507 | \value StyleResolved | - |
| 508 | \value UnderlineResolved | - |
| 509 | \value OverlineResolved | - |
| 510 | \value StrikeOutResolved | - |
| 511 | \value FixedPitchResolved | - |
| 512 | \value StretchResolved | - |
| 513 | \value KerningResolved | - |
| 514 | \value CapitalizationResolved | - |
| 515 | \value LetterSpacingResolved | - |
| 516 | \value WordSpacingResolved | - |
| 517 | \value CompletelyResolved | - |
| 518 | */ | - |
| 519 | | - |
| 520 | /*! | - |
| 521 | \enum QFont::Style | - |
| 522 | | - |
| 523 | This enum describes the different styles of glyphs that are used to | - |
| 524 | display text. | - |
| 525 | | - |
| 526 | \value StyleNormal Normal glyphs used in unstyled text. | - |
| 527 | \value StyleItalic Italic glyphs that are specifically designed for | - |
| 528 | the purpose of representing italicized text. | - |
| 529 | \value StyleOblique Glyphs with an italic appearance that are typically | - |
| 530 | based on the unstyled glyphs, but are not fine-tuned | - |
| 531 | for the purpose of representing italicized text. | - |
| 532 | | - |
| 533 | \sa Weight | - |
| 534 | */ | - |
| 535 | | - |
| 536 | /*! | - |
| 537 | \fn QString QFont::rawName() const | - |
| 538 | | - |
| 539 | Returns the name of the font within the underlying window system. | - |
| 540 | | - |
| 541 | On X11, this function will return an empty string. | - |
| 542 | | - |
| 543 | Using the return value of this function is usually \e not \e | - |
| 544 | portable. | - |
| 545 | | - |
| 546 | \sa setRawName() | - |
| 547 | */ | - |
| 548 | | - |
| 549 | /*! | - |
| 550 | \fn void QFont::setRawName(const QString &name) | - |
| 551 | | - |
| 552 | Sets a font by its system specific name. | - |
| 553 | | - |
| 554 | A font set with setRawName() is still a full-featured QFont. It can | - |
| 555 | be queried (for example with italic()) or modified (for example with | - |
| 556 | setItalic()) and is therefore also suitable for rendering rich text. | - |
| 557 | | - |
| 558 | If Qt's internal font database cannot resolve the raw name, the | - |
| 559 | font becomes a raw font with \a name as its family. | - |
| 560 | | - |
| 561 | \sa rawName(), setRawMode(), setFamily() | - |
| 562 | */ | - |
| 563 | | - |
| 564 | /*! | - |
| 565 | \fn QString QFont::lastResortFamily() const | - |
| 566 | | - |
| 567 | Returns the "last resort" font family name. | - |
| 568 | | - |
| 569 | The current implementation tries a wide variety of common fonts, | - |
| 570 | returning the first one it finds. Is is possible that no family is | - |
| 571 | found in which case an empty string is returned. | - |
| 572 | | - |
| 573 | \sa lastResortFont() | - |
| 574 | */ | - |
| 575 | | - |
| 576 | /*! | - |
| 577 | \fn QString QFont::defaultFamily() const | - |
| 578 | | - |
| 579 | Returns the family name that corresponds to the current style | - |
| 580 | hint. | - |
| 581 | | - |
| 582 | \sa StyleHint, styleHint(), setStyleHint() | - |
| 583 | */ | - |
| 584 | | - |
| 585 | /*! | - |
| 586 | \fn QString QFont::lastResortFont() const | - |
| 587 | | - |
| 588 | Returns a "last resort" font name for the font matching algorithm. | - |
| 589 | This is used if the last resort family is not available. It will | - |
| 590 | always return a name, if necessary returning something like | - |
| 591 | "fixed" or "system". | - |
| 592 | | - |
| 593 | The current implementation tries a wide variety of common fonts, | - |
| 594 | returning the first one it finds. The implementation may change | - |
| 595 | at any time, but this function will always return a string | - |
| 596 | containing something. | - |
| 597 | | - |
| 598 | It is theoretically possible that there really isn't a | - |
| 599 | lastResortFont() in which case Qt will abort with an error | - |
| 600 | message. We have not been able to identify a case where this | - |
| 601 | happens. Please \l{bughowto.html}{report it as a bug} if | - |
| 602 | it does, preferably with a list of the fonts you have installed. | - |
| 603 | | - |
| 604 | \sa lastResortFamily(), rawName() | - |
| 605 | */ | - |
| 606 | | - |
| 607 | /*! | - |
| 608 | Constructs a font from \a font for use on the paint device \a pd. | - |
| 609 | */ | - |
| 610 | QFont::QFont(const QFont &font, QPaintDevice *pd) | - |
| 611 | : resolve_mask(font.resolve_mask) | - |
| 612 | { | - |
| 613 | Q_ASSERT(pd != 0); executed (the execution status of this line is deduced): qt_noop(); | - |
| 614 | int dpi = pd->logicalDpiY(); executed (the execution status of this line is deduced): int dpi = pd->logicalDpiY(); | - |
| 615 | const int screen = 0; executed (the execution status of this line is deduced): const int screen = 0; | - |
| 616 | 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 |
| 617 | d = new QFontPrivate(*font.d); executed (the execution status of this line is deduced): d = new QFontPrivate(*font.d); | - |
| 618 | d->dpi = dpi; executed (the execution status of this line is deduced): d->dpi = dpi; | - |
| 619 | d->screen = screen; executed (the execution status of this line is deduced): d->screen = screen; | - |
| 620 | } else { executed: }Execution Count:5208 | 5208 |
| 621 | d = font.d.data(); executed (the execution status of this line is deduced): d = font.d.data(); | - |
| 622 | } executed: }Execution Count:75046 | 75046 |
| 623 | } | - |
| 624 | | - |
| 625 | /*! | - |
| 626 | \internal | - |
| 627 | */ | - |
| 628 | QFont::QFont(QFontPrivate *data) | - |
| 629 | : d(data), resolve_mask(QFont::AllPropertiesResolved) | - |
| 630 | { | - |
| 631 | } executed: }Execution Count:43777 | 43777 |
| 632 | | - |
| 633 | /*! \internal | - |
| 634 | Detaches the font object from common font data. | - |
| 635 | */ | - |
| 636 | void QFont::detach() | - |
| 637 | { | - |
| 638 | if (d->ref.load() == 1) { evaluated: d->ref.load() == 1| yes Evaluation Count:17218 | yes Evaluation Count:34784 |
| 17218-34784 |
| 639 | if (d->engineData) partially evaluated: d->engineData| no Evaluation Count:0 | yes Evaluation Count:17218 |
| 0-17218 |
| 640 | d->engineData->ref.deref(); never executed: d->engineData->ref.deref(); | 0 |
| 641 | d->engineData = 0; executed (the execution status of this line is deduced): d->engineData = 0; | - |
| 642 | 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 |
| 643 | d->scFont->ref.deref(); never executed: d->scFont->ref.deref(); | 0 |
| 644 | d->scFont = 0; executed (the execution status of this line is deduced): d->scFont = 0; | - |
| 645 | return; executed: return;Execution Count:17218 | 17218 |
| 646 | } | - |
| 647 | | - |
| 648 | d.detach(); executed (the execution status of this line is deduced): d.detach(); | - |
| 649 | } executed: }Execution Count:34784 | 34784 |
| 650 | | - |
| 651 | /*! | - |
| 652 | \internal | - |
| 653 | Detaches the font object from common font attributes data. | - |
| 654 | Call this instead of QFont::detach() if the only font attributes data | - |
| 655 | has been changed (underline, letterSpacing, kerning, etc.). | - |
| 656 | */ | - |
| 657 | void QFontPrivate::detachButKeepEngineData(QFont *font) | - |
| 658 | { | - |
| 659 | if (font->d->ref.load() == 1) evaluated: font->d->ref.load() == 1| yes Evaluation Count:21829 | yes Evaluation Count:103 |
| 103-21829 |
| 660 | return; executed: return;Execution Count:21829 | 21829 |
| 661 | | - |
| 662 | QFontEngineData *engineData = font->d->engineData; executed (the execution status of this line is deduced): QFontEngineData *engineData = font->d->engineData; | - |
| 663 | if (engineData) evaluated: engineData| yes Evaluation Count:94 | yes Evaluation Count:9 |
| 9-94 |
| 664 | engineData->ref.ref(); executed: engineData->ref.ref();Execution Count:94 | 94 |
| 665 | font->d.detach(); executed (the execution status of this line is deduced): font->d.detach(); | - |
| 666 | font->d->engineData = engineData; executed (the execution status of this line is deduced): font->d->engineData = engineData; | - |
| 667 | } executed: }Execution Count:103 | 103 |
| 668 | | - |
| 669 | /*! | - |
| 670 | Constructs a font object that uses the application's default font. | - |
| 671 | | - |
| 672 | \sa QGuiApplication::setFont(), QGuiApplication::font() | - |
| 673 | */ | - |
| 674 | QFont::QFont() | - |
| 675 | : d(QGuiApplicationPrivate::instance() ? QGuiApplication::font().d.data() : new QFontPrivate()), resolve_mask(0) | - |
| 676 | { | - |
| 677 | } executed: }Execution Count:1041278 | 1041278 |
| 678 | | - |
| 679 | /*! | - |
| 680 | Constructs a font object with the specified \a family, \a | - |
| 681 | pointSize, \a weight and \a italic settings. | - |
| 682 | | - |
| 683 | If \a pointSize is zero or negative, the point size of the font | - |
| 684 | is set to a system-dependent default value. Generally, this is | - |
| 685 | 12 points. | - |
| 686 | | - |
| 687 | The \a family name may optionally also include a foundry name, | - |
| 688 | e.g. "Helvetica [Cronyx]". If the \a family is | - |
| 689 | available from more than one foundry and the foundry isn't | - |
| 690 | specified, an arbitrary foundry is chosen. If the family isn't | - |
| 691 | available a family will be set using the \l{QFont}{font matching} | - |
| 692 | algorithm. | - |
| 693 | | - |
| 694 | \sa Weight, setFamily(), setPointSize(), setWeight(), setItalic(), | - |
| 695 | setStyleHint(), QGuiApplication::font() | - |
| 696 | */ | - |
| 697 | QFont::QFont(const QString &family, int pointSize, int weight, bool italic) | - |
| 698 | : d(new QFontPrivate()), resolve_mask(QFont::FamilyResolved) | - |
| 699 | { | - |
| 700 | if (pointSize <= 0) { evaluated: pointSize <= 0| yes Evaluation Count:212 | yes Evaluation Count:1327 |
| 212-1327 |
| 701 | pointSize = 12; executed (the execution status of this line is deduced): pointSize = 12; | - |
| 702 | } else { executed: }Execution Count:212 | 212 |
| 703 | resolve_mask |= QFont::SizeResolved; executed (the execution status of this line is deduced): resolve_mask |= QFont::SizeResolved; | - |
| 704 | } executed: }Execution Count:1327 | 1327 |
| 705 | | - |
| 706 | if (weight < 0) { evaluated: weight < 0| yes Evaluation Count:537 | yes Evaluation Count:1002 |
| 537-1002 |
| 707 | weight = Normal; executed (the execution status of this line is deduced): weight = Normal; | - |
| 708 | } else { executed: }Execution Count:537 | 537 |
| 709 | resolve_mask |= QFont::WeightResolved | QFont::StyleResolved; executed (the execution status of this line is deduced): resolve_mask |= QFont::WeightResolved | QFont::StyleResolved; | - |
| 710 | } executed: }Execution Count:1002 | 1002 |
| 711 | | - |
| 712 | if (italic) evaluated: italic| yes Evaluation Count:72 | yes Evaluation Count:1467 |
| 72-1467 |
| 713 | resolve_mask |= QFont::StyleResolved; executed: resolve_mask |= QFont::StyleResolved;Execution Count:72 | 72 |
| 714 | | - |
| 715 | d->request.family = family; executed (the execution status of this line is deduced): d->request.family = family; | - |
| 716 | d->request.pointSize = qreal(pointSize); executed (the execution status of this line is deduced): d->request.pointSize = qreal(pointSize); | - |
| 717 | d->request.pixelSize = -1; executed (the execution status of this line is deduced): d->request.pixelSize = -1; | - |
| 718 | d->request.weight = weight; executed (the execution status of this line is deduced): d->request.weight = weight; | - |
| 719 | d->request.style = italic ? QFont::StyleItalic : QFont::StyleNormal; evaluated: italic| yes Evaluation Count:72 | yes Evaluation Count:1467 |
| 72-1467 |
| 720 | } executed: }Execution Count:1539 | 1539 |
| 721 | | - |
| 722 | /*! | - |
| 723 | Constructs a font that is a copy of \a font. | - |
| 724 | */ | - |
| 725 | QFont::QFont(const QFont &font) | - |
| 726 | : d(font.d.data()), resolve_mask(font.resolve_mask) | - |
| 727 | { | - |
| 728 | } executed: }Execution Count:2905296 | 2905296 |
| 729 | | - |
| 730 | /*! | - |
| 731 | Destroys the font object and frees all allocated resources. | - |
| 732 | */ | - |
| 733 | QFont::~QFont() | - |
| 734 | { | - |
| 735 | } | - |
| 736 | | - |
| 737 | /*! | - |
| 738 | Assigns \a font to this font and returns a reference to it. | - |
| 739 | */ | - |
| 740 | QFont &QFont::operator=(const QFont &font) | - |
| 741 | { | - |
| 742 | d = font.d.data(); executed (the execution status of this line is deduced): d = font.d.data(); | - |
| 743 | resolve_mask = font.resolve_mask; executed (the execution status of this line is deduced): resolve_mask = font.resolve_mask; | - |
| 744 | return *this; executed: return *this;Execution Count:421397 | 421397 |
| 745 | } | - |
| 746 | | - |
| 747 | /*! | - |
| 748 | \fn void QFont::swap(QFont &other) | - |
| 749 | \since 5.0 | - |
| 750 | | - |
| 751 | Swaps this font instance with \a other. This function is very fast | - |
| 752 | and never fails. | - |
| 753 | */ | - |
| 754 | | - |
| 755 | /*! | - |
| 756 | Returns the requested font family name, i.e. the name set in the | - |
| 757 | constructor or the last setFont() call. | - |
| 758 | | - |
| 759 | \sa setFamily(), substitutes(), substitute() | - |
| 760 | */ | - |
| 761 | QString QFont::family() const | - |
| 762 | { | - |
| 763 | return d->request.family; executed: return d->request.family;Execution Count:16119 | 16119 |
| 764 | } | - |
| 765 | | - |
| 766 | /*! | - |
| 767 | Sets the family name of the font. The name is case insensitive and | - |
| 768 | may include a foundry name. | - |
| 769 | | - |
| 770 | The \a family name may optionally also include a foundry name, | - |
| 771 | e.g. "Helvetica [Cronyx]". If the \a family is | - |
| 772 | available from more than one foundry and the foundry isn't | - |
| 773 | specified, an arbitrary foundry is chosen. If the family isn't | - |
| 774 | available a family will be set using the \l{QFont}{font matching} | - |
| 775 | algorithm. | - |
| 776 | | - |
| 777 | \sa family(), setStyleHint(), QFontInfo | - |
| 778 | */ | - |
| 779 | void QFont::setFamily(const QString &family) | - |
| 780 | { | - |
| 781 | 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 |
| 782 | return; | 0 |
| 783 | | - |
| 784 | detach(); executed (the execution status of this line is deduced): detach(); | - |
| 785 | | - |
| 786 | d->request.family = family; executed (the execution status of this line is deduced): d->request.family = family; | - |
| 787 | | - |
| 788 | resolve_mask |= QFont::FamilyResolved; executed (the execution status of this line is deduced): resolve_mask |= QFont::FamilyResolved; | - |
| 789 | } executed: }Execution Count:3597 | 3597 |
| 790 | | - |
| 791 | /*! | - |
| 792 | \since 4.8 | - |
| 793 | | - |
| 794 | Returns the requested font style name, it will be used to match the | - |
| 795 | font with irregular styles (that can't be normalized in other style | - |
| 796 | properties). It depends on system font support, thus only works for | - |
| 797 | Mac OS X and X11 so far. On Windows irregular styles will be added | - |
| 798 | as separate font families so there is no need for this. | - |
| 799 | | - |
| 800 | \sa setFamily(), setStyle() | - |
| 801 | */ | - |
| 802 | QString QFont::styleName() const | - |
| 803 | { | - |
| 804 | return d->request.styleName; executed: return d->request.styleName;Execution Count:2 | 2 |
| 805 | } | - |
| 806 | | - |
| 807 | /*! | - |
| 808 | \since 4.8 | - |
| 809 | | - |
| 810 | Sets the style name of the font to \a styleName. When set, other style properties | - |
| 811 | like \l style() and \l weight() will be ignored for font matching. | - |
| 812 | | - |
| 813 | \sa styleName() | - |
| 814 | */ | - |
| 815 | void QFont::setStyleName(const QString &styleName) | - |
| 816 | { | - |
| 817 | 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 |
| 818 | return; | 0 |
| 819 | | - |
| 820 | detach(); executed (the execution status of this line is deduced): detach(); | - |
| 821 | | - |
| 822 | d->request.styleName = styleName; executed (the execution status of this line is deduced): d->request.styleName = styleName; | - |
| 823 | resolve_mask |= QFont::StyleNameResolved; executed (the execution status of this line is deduced): resolve_mask |= QFont::StyleNameResolved; | - |
| 824 | } executed: }Execution Count:761 | 761 |
| 825 | | - |
| 826 | /*! | - |
| 827 | Returns the point size of the font. Returns -1 if the font size | - |
| 828 | was specified in pixels. | - |
| 829 | | - |
| 830 | \sa setPointSize(), pointSizeF() | - |
| 831 | */ | - |
| 832 | int QFont::pointSize() const | - |
| 833 | { | - |
| 834 | return qRound(d->request.pointSize); executed: return qRound(d->request.pointSize);Execution Count:300 | 300 |
| 835 | } | - |
| 836 | | - |
| 837 | /*! | - |
| 838 | \since 4.8 | - |
| 839 | | - |
| 840 | \enum QFont::HintingPreference | - |
| 841 | | - |
| 842 | This enum describes the different levels of hinting that can be applied | - |
| 843 | to glyphs to improve legibility on displays where it might be warranted | - |
| 844 | by the density of pixels. | - |
| 845 | | - |
| 846 | \value PreferDefaultHinting Use the default hinting level for the target platform. | - |
| 847 | \value PreferNoHinting If possible, render text without hinting the outlines | - |
| 848 | of the glyphs. The text layout will be typographically accurate and | - |
| 849 | scalable, using the same metrics as are used e.g. when printing. | - |
| 850 | \value PreferVerticalHinting If possible, render text with no horizontal hinting, | - |
| 851 | but align glyphs to the pixel grid in the vertical direction. The text will appear | - |
| 852 | crisper on displays where the density is too low to give an accurate rendering | - |
| 853 | of the glyphs. But since the horizontal metrics of the glyphs are unhinted, the text's | - |
| 854 | layout will be scalable to higher density devices (such as printers) without impacting | - |
| 855 | details such as line breaks. | - |
| 856 | \value PreferFullHinting If possible, render text with hinting in both horizontal and | - |
| 857 | vertical directions. The text will be altered to optimize legibility on the target | - |
| 858 | device, but since the metrics will depend on the target size of the text, the positions | - |
| 859 | of glyphs, line breaks, and other typographical detail will not scale, meaning that a | - |
| 860 | text layout may look different on devices with different pixel densities. | - |
| 861 | | - |
| 862 | Please note that this enum only describes a preference, as the full range of hinting levels | - |
| 863 | are not supported on all of Qt's supported platforms. The following table details the effect | - |
| 864 | of a given hinting preference on a selected set of target platforms. | - |
| 865 | | - |
| 866 | \table | - |
| 867 | \header | - |
| 868 | \li | - |
| 869 | \li PreferDefaultHinting | - |
| 870 | \li PreferNoHinting | - |
| 871 | \li PreferVerticalHinting | - |
| 872 | \li PreferFullHinting | - |
| 873 | \row | - |
| 874 | \li Windows Vista (w/o Platform Update) and earlier | - |
| 875 | \li Full hinting | - |
| 876 | \li Full hinting | - |
| 877 | \li Full hinting | - |
| 878 | \li Full hinting | - |
| 879 | \row | - |
| 880 | \li Windows 7 and Windows Vista (w/Platform Update) and DirectWrite enabled in Qt | - |
| 881 | \li Full hinting | - |
| 882 | \li Vertical hinting | - |
| 883 | \li Vertical hinting | - |
| 884 | \li Full hinting | - |
| 885 | \row | - |
| 886 | \li FreeType | - |
| 887 | \li Operating System setting | - |
| 888 | \li No hinting | - |
| 889 | \li Vertical hinting (light) | - |
| 890 | \li Full hinting | - |
| 891 | \row | - |
| 892 | \li Cocoa on Mac OS X | - |
| 893 | \li No hinting | - |
| 894 | \li No hinting | - |
| 895 | \li No hinting | - |
| 896 | \li No hinting | - |
| 897 | \endtable | - |
| 898 | | - |
| 899 | \note Please be aware that altering the hinting preference on Windows is available through | - |
| 900 | the DirectWrite font engine. This is available on Windows Vista after installing the platform | - |
| 901 | update, and on Windows 7. In order to use this extension, configure Qt using -directwrite. | - |
| 902 | The target application will then depend on the availability of DirectWrite on the target | - |
| 903 | system. | - |
| 904 | | - |
| 905 | */ | - |
| 906 | | - |
| 907 | /*! | - |
| 908 | \since 4.8 | - |
| 909 | | - |
| 910 | Set the preference for the hinting level of the glyphs to \a hintingPreference. This is a hint | - |
| 911 | to the underlying font rendering system to use a certain level of hinting, and has varying | - |
| 912 | support across platforms. See the table in the documentation for QFont::HintingPreference for | - |
| 913 | more details. | - |
| 914 | | - |
| 915 | The default hinting preference is QFont::PreferDefaultHinting. | - |
| 916 | */ | - |
| 917 | void QFont::setHintingPreference(HintingPreference hintingPreference) | - |
| 918 | { | - |
| 919 | 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 |
| 920 | return; | 0 |
| 921 | | - |
| 922 | detach(); executed (the execution status of this line is deduced): detach(); | - |
| 923 | | - |
| 924 | d->request.hintingPreference = hintingPreference; executed (the execution status of this line is deduced): d->request.hintingPreference = hintingPreference; | - |
| 925 | | - |
| 926 | resolve_mask |= QFont::HintingPreferenceResolved; executed (the execution status of this line is deduced): resolve_mask |= QFont::HintingPreferenceResolved; | - |
| 927 | } executed: }Execution Count:24 | 24 |
| 928 | | - |
| 929 | /*! | - |
| 930 | \since 4.8 | - |
| 931 | | - |
| 932 | Returns the currently preferred hinting level for glyphs rendered with this font. | - |
| 933 | */ | - |
| 934 | QFont::HintingPreference QFont::hintingPreference() const | - |
| 935 | { | - |
| 936 | return QFont::HintingPreference(d->request.hintingPreference); executed: return QFont::HintingPreference(d->request.hintingPreference);Execution Count:32 | 32 |
| 937 | } | - |
| 938 | | - |
| 939 | /*! | - |
| 940 | Sets the point size to \a pointSize. The point size must be | - |
| 941 | greater than zero. | - |
| 942 | | - |
| 943 | \sa pointSize(), setPointSizeF() | - |
| 944 | */ | - |
| 945 | void QFont::setPointSize(int pointSize) | - |
| 946 | { | - |
| 947 | if (pointSize <= 0) { partially evaluated: pointSize <= 0| no Evaluation Count:0 | yes Evaluation Count:62 |
| 0-62 |
| 948 | qWarning("QFont::setPointSize: Point size <= 0 (%d), must be greater than 0", pointSize); never executed (the execution status of this line is deduced): QMessageLogger("text/qfont.cpp", 948, __PRETTY_FUNCTION__).warning("QFont::setPointSize: Point size <= 0 (%d), must be greater than 0", pointSize); | - |
| 949 | return; | 0 |
| 950 | } | - |
| 951 | | - |
| 952 | 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 |
| 953 | return; | 0 |
| 954 | | - |
| 955 | detach(); executed (the execution status of this line is deduced): detach(); | - |
| 956 | | - |
| 957 | d->request.pointSize = qreal(pointSize); executed (the execution status of this line is deduced): d->request.pointSize = qreal(pointSize); | - |
| 958 | d->request.pixelSize = -1; executed (the execution status of this line is deduced): d->request.pixelSize = -1; | - |
| 959 | | - |
| 960 | resolve_mask |= QFont::SizeResolved; executed (the execution status of this line is deduced): resolve_mask |= QFont::SizeResolved; | - |
| 961 | } executed: }Execution Count:62 | 62 |
| 962 | | - |
| 963 | /*! | - |
| 964 | Sets the point size to \a pointSize. The point size must be | - |
| 965 | greater than zero. The requested precision may not be achieved on | - |
| 966 | all platforms. | - |
| 967 | | - |
| 968 | \sa pointSizeF(), setPointSize(), setPixelSize() | - |
| 969 | */ | - |
| 970 | void QFont::setPointSizeF(qreal pointSize) | - |
| 971 | { | - |
| 972 | if (pointSize <= 0) { partially evaluated: pointSize <= 0| no Evaluation Count:0 | yes Evaluation Count:3214 |
| 0-3214 |
| 973 | qWarning("QFont::setPointSizeF: Point size <= 0 (%f), must be greater than 0", pointSize); never executed (the execution status of this line is deduced): QMessageLogger("text/qfont.cpp", 973, __PRETTY_FUNCTION__).warning("QFont::setPointSizeF: Point size <= 0 (%f), must be greater than 0", pointSize); | - |
| 974 | return; | 0 |
| 975 | } | - |
| 976 | | - |
| 977 | 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 |
| 978 | return; | 0 |
| 979 | | - |
| 980 | detach(); executed (the execution status of this line is deduced): detach(); | - |
| 981 | | - |
| 982 | d->request.pointSize = pointSize; executed (the execution status of this line is deduced): d->request.pointSize = pointSize; | - |
| 983 | d->request.pixelSize = -1; executed (the execution status of this line is deduced): d->request.pixelSize = -1; | - |
| 984 | | - |
| 985 | resolve_mask |= QFont::SizeResolved; executed (the execution status of this line is deduced): resolve_mask |= QFont::SizeResolved; | - |
| 986 | } executed: }Execution Count:3214 | 3214 |
| 987 | | - |
| 988 | /*! | - |
| 989 | Returns the point size of the font. Returns -1 if the font size was | - |
| 990 | specified in pixels. | - |
| 991 | | - |
| 992 | \sa pointSize(), setPointSizeF(), pixelSize(), QFontInfo::pointSize(), QFontInfo::pixelSize() | - |
| 993 | */ | - |
| 994 | qreal QFont::pointSizeF() const | - |
| 995 | { | - |
| 996 | return d->request.pointSize; executed: return d->request.pointSize;Execution Count:14534 | 14534 |
| 997 | } | - |
| 998 | | - |
| 999 | /*! | - |
| 1000 | Sets the font size to \a pixelSize pixels. | - |
| 1001 | | - |
| 1002 | Using this function makes the font device dependent. Use | - |
| 1003 | setPointSize() or setPointSizeF() to set the size of the font | - |
| 1004 | in a device independent manner. | - |
| 1005 | | - |
| 1006 | \sa pixelSize() | - |
| 1007 | */ | - |
| 1008 | void QFont::setPixelSize(int pixelSize) | - |
| 1009 | { | - |
| 1010 | if (pixelSize <= 0) { partially evaluated: pixelSize <= 0| no Evaluation Count:0 | yes Evaluation Count:165 |
| 0-165 |
| 1011 | qWarning("QFont::setPixelSize: Pixel size <= 0 (%d)", pixelSize); never executed (the execution status of this line is deduced): QMessageLogger("text/qfont.cpp", 1011, __PRETTY_FUNCTION__).warning("QFont::setPixelSize: Pixel size <= 0 (%d)", pixelSize); | - |
| 1012 | return; | 0 |
| 1013 | } | - |
| 1014 | | - |
| 1015 | 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 |
| 1016 | return; | 0 |
| 1017 | | - |
| 1018 | detach(); executed (the execution status of this line is deduced): detach(); | - |
| 1019 | | - |
| 1020 | d->request.pixelSize = pixelSize; executed (the execution status of this line is deduced): d->request.pixelSize = pixelSize; | - |
| 1021 | d->request.pointSize = -1; executed (the execution status of this line is deduced): d->request.pointSize = -1; | - |
| 1022 | | - |
| 1023 | resolve_mask |= QFont::SizeResolved; executed (the execution status of this line is deduced): resolve_mask |= QFont::SizeResolved; | - |
| 1024 | } executed: }Execution Count:165 | 165 |
| 1025 | | - |
| 1026 | /*! | - |
| 1027 | Returns the pixel size of the font if it was set with | - |
| 1028 | setPixelSize(). Returns -1 if the size was set with setPointSize() | - |
| 1029 | or setPointSizeF(). | - |
| 1030 | | - |
| 1031 | \sa setPixelSize(), pointSize(), QFontInfo::pointSize(), QFontInfo::pixelSize() | - |
| 1032 | */ | - |
| 1033 | int QFont::pixelSize() const | - |
| 1034 | { | - |
| 1035 | return d->request.pixelSize; executed: return d->request.pixelSize;Execution Count:367 | 367 |
| 1036 | } | - |
| 1037 | | - |
| 1038 | /*! | - |
| 1039 | \fn bool QFont::italic() const | - |
| 1040 | | - |
| 1041 | Returns true if the style() of the font is not QFont::StyleNormal | - |
| 1042 | | - |
| 1043 | \sa setItalic(), style() | - |
| 1044 | */ | - |
| 1045 | | - |
| 1046 | /*! | - |
| 1047 | \fn void QFont::setItalic(bool enable) | - |
| 1048 | | - |
| 1049 | Sets the style() of the font to QFont::StyleItalic if \a enable is true; | - |
| 1050 | otherwise the style is set to QFont::StyleNormal. | - |
| 1051 | | - |
| 1052 | \sa italic(), QFontInfo | - |
| 1053 | */ | - |
| 1054 | | - |
| 1055 | /*! | - |
| 1056 | Returns the style of the font. | - |
| 1057 | | - |
| 1058 | \sa setStyle() | - |
| 1059 | */ | - |
| 1060 | QFont::Style QFont::style() const | - |
| 1061 | { | - |
| 1062 | return (QFont::Style)d->request.style; executed: return (QFont::Style)d->request.style;Execution Count:14811 | 14811 |
| 1063 | } | - |
| 1064 | | - |
| 1065 | | - |
| 1066 | /*! | - |
| 1067 | Sets the style of the font to \a style. | - |
| 1068 | | - |
| 1069 | \sa italic(), QFontInfo | - |
| 1070 | */ | - |
| 1071 | void QFont::setStyle(Style style) | - |
| 1072 | { | - |
| 1073 | 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 |
| 1074 | return; executed: return;Execution Count:429 | 429 |
| 1075 | | - |
| 1076 | detach(); executed (the execution status of this line is deduced): detach(); | - |
| 1077 | | - |
| 1078 | d->request.style = style; executed (the execution status of this line is deduced): d->request.style = style; | - |
| 1079 | resolve_mask |= QFont::StyleResolved; executed (the execution status of this line is deduced): resolve_mask |= QFont::StyleResolved; | - |
| 1080 | } executed: }Execution Count:3449 | 3449 |
| 1081 | | - |
| 1082 | /*! | - |
| 1083 | Returns the weight of the font which is one of the enumerated | - |
| 1084 | values from \l{QFont::Weight}. | - |
| 1085 | | - |
| 1086 | \sa setWeight(), Weight, QFontInfo | - |
| 1087 | */ | - |
| 1088 | int QFont::weight() const | - |
| 1089 | { | - |
| 1090 | return d->request.weight; executed: return d->request.weight;Execution Count:14711 | 14711 |
| 1091 | } | - |
| 1092 | | - |
| 1093 | /*! | - |
| 1094 | \enum QFont::Weight | - |
| 1095 | | - |
| 1096 | Qt uses a weighting scale from 0 to 99 similar to, but not the | - |
| 1097 | same as, the scales used in Windows or CSS. A weight of 0 is | - |
| 1098 | ultralight, whilst 99 will be an extremely black. | - |
| 1099 | | - |
| 1100 | This enum contains the predefined font weights: | - |
| 1101 | | - |
| 1102 | \value Light 25 | - |
| 1103 | \value Normal 50 | - |
| 1104 | \value DemiBold 63 | - |
| 1105 | \value Bold 75 | - |
| 1106 | \value Black 87 | - |
| 1107 | */ | - |
| 1108 | | - |
| 1109 | /*! | - |
| 1110 | Sets the weight the font to \a weight, which should be a value | - |
| 1111 | from the \l QFont::Weight enumeration. | - |
| 1112 | | - |
| 1113 | \sa weight(), QFontInfo | - |
| 1114 | */ | - |
| 1115 | void QFont::setWeight(int weight) | - |
| 1116 | { | - |
| 1117 | Q_ASSERT_X(weight >= 0 && weight <= 99, "QFont::setWeight", "Weight must be between 0 and 99"); executed (the execution status of this line is deduced): qt_noop(); | - |
| 1118 | | - |
| 1119 | 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 |
| 1120 | return; | 0 |
| 1121 | | - |
| 1122 | detach(); executed (the execution status of this line is deduced): detach(); | - |
| 1123 | | - |
| 1124 | d->request.weight = weight; executed (the execution status of this line is deduced): d->request.weight = weight; | - |
| 1125 | resolve_mask |= QFont::WeightResolved; executed (the execution status of this line is deduced): resolve_mask |= QFont::WeightResolved; | - |
| 1126 | } executed: }Execution Count:28628 | 28628 |
| 1127 | | - |
| 1128 | /*! | - |
| 1129 | \fn bool QFont::bold() const | - |
| 1130 | | - |
| 1131 | Returns true if weight() is a value greater than | - |
| 1132 | \l{Weight}{QFont::Normal}; otherwise returns false. | - |
| 1133 | | - |
| 1134 | \sa weight(), setBold(), QFontInfo::bold() | - |
| 1135 | */ | - |
| 1136 | | - |
| 1137 | /*! | - |
| 1138 | \fn void QFont::setBold(bool enable) | - |
| 1139 | | - |
| 1140 | If \a enable is true sets the font's weight to | - |
| 1141 | \l{Weight}{QFont::Bold}; | - |
| 1142 | otherwise sets the weight to \l{Weight}{QFont::Normal}. | - |
| 1143 | | - |
| 1144 | For finer boldness control use setWeight(). | - |
| 1145 | | - |
| 1146 | \sa bold(), setWeight() | - |
| 1147 | */ | - |
| 1148 | | - |
| 1149 | /*! | - |
| 1150 | Returns true if underline has been set; otherwise returns false. | - |
| 1151 | | - |
| 1152 | \sa setUnderline() | - |
| 1153 | */ | - |
| 1154 | bool QFont::underline() const | - |
| 1155 | { | - |
| 1156 | return d->underline; executed: return d->underline;Execution Count:14390 | 14390 |
| 1157 | } | - |
| 1158 | | - |
| 1159 | /*! | - |
| 1160 | If \a enable is true, sets underline on; otherwise sets underline | - |
| 1161 | off. | - |
| 1162 | | - |
| 1163 | \sa underline(), QFontInfo | - |
| 1164 | */ | - |
| 1165 | void QFont::setUnderline(bool enable) | - |
| 1166 | { | - |
| 1167 | 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 |
| 1168 | return; | 0 |
| 1169 | | - |
| 1170 | QFontPrivate::detachButKeepEngineData(this); executed (the execution status of this line is deduced): QFontPrivate::detachButKeepEngineData(this); | - |
| 1171 | | - |
| 1172 | d->underline = enable; executed (the execution status of this line is deduced): d->underline = enable; | - |
| 1173 | resolve_mask |= QFont::UnderlineResolved; executed (the execution status of this line is deduced): resolve_mask |= QFont::UnderlineResolved; | - |
| 1174 | } executed: }Execution Count:3567 | 3567 |
| 1175 | | - |
| 1176 | /*! | - |
| 1177 | Returns true if overline has been set; otherwise returns false. | - |
| 1178 | | - |
| 1179 | \sa setOverline() | - |
| 1180 | */ | - |
| 1181 | bool QFont::overline() const | - |
| 1182 | { | - |
| 1183 | return d->overline; executed: return d->overline;Execution Count:14202 | 14202 |
| 1184 | } | - |
| 1185 | | - |
| 1186 | /*! | - |
| 1187 | If \a enable is true, sets overline on; otherwise sets overline off. | - |
| 1188 | | - |
| 1189 | \sa overline(), QFontInfo | - |
| 1190 | */ | - |
| 1191 | void QFont::setOverline(bool enable) | - |
| 1192 | { | - |
| 1193 | 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 |
| 1194 | return; | 0 |
| 1195 | | - |
| 1196 | QFontPrivate::detachButKeepEngineData(this); executed (the execution status of this line is deduced): QFontPrivate::detachButKeepEngineData(this); | - |
| 1197 | | - |
| 1198 | d->overline = enable; executed (the execution status of this line is deduced): d->overline = enable; | - |
| 1199 | resolve_mask |= QFont::OverlineResolved; executed (the execution status of this line is deduced): resolve_mask |= QFont::OverlineResolved; | - |
| 1200 | } executed: }Execution Count:2988 | 2988 |
| 1201 | | - |
| 1202 | /*! | - |
| 1203 | Returns true if strikeout has been set; otherwise returns false. | - |
| 1204 | | - |
| 1205 | \sa setStrikeOut() | - |
| 1206 | */ | - |
| 1207 | bool QFont::strikeOut() const | - |
| 1208 | { | - |
| 1209 | return d->strikeOut; executed: return d->strikeOut;Execution Count:14373 | 14373 |
| 1210 | } | - |
| 1211 | | - |
| 1212 | /*! | - |
| 1213 | If \a enable is true, sets strikeout on; otherwise sets strikeout | - |
| 1214 | off. | - |
| 1215 | | - |
| 1216 | \sa strikeOut(), QFontInfo | - |
| 1217 | */ | - |
| 1218 | void QFont::setStrikeOut(bool enable) | - |
| 1219 | { | - |
| 1220 | 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 |
| 1221 | return; | 0 |
| 1222 | | - |
| 1223 | QFontPrivate::detachButKeepEngineData(this); executed (the execution status of this line is deduced): QFontPrivate::detachButKeepEngineData(this); | - |
| 1224 | | - |
| 1225 | d->strikeOut = enable; executed (the execution status of this line is deduced): d->strikeOut = enable; | - |
| 1226 | resolve_mask |= QFont::StrikeOutResolved; executed (the execution status of this line is deduced): resolve_mask |= QFont::StrikeOutResolved; | - |
| 1227 | } executed: }Execution Count:3483 | 3483 |
| 1228 | | - |
| 1229 | /*! | - |
| 1230 | Returns true if fixed pitch has been set; otherwise returns false. | - |
| 1231 | | - |
| 1232 | \sa setFixedPitch(), QFontInfo::fixedPitch() | - |
| 1233 | */ | - |
| 1234 | bool QFont::fixedPitch() const | - |
| 1235 | { | - |
| 1236 | return d->request.fixedPitch; executed: return d->request.fixedPitch;Execution Count:17851 | 17851 |
| 1237 | } | - |
| 1238 | | - |
| 1239 | /*! | - |
| 1240 | If \a enable is true, sets fixed pitch on; otherwise sets fixed | - |
| 1241 | pitch off. | - |
| 1242 | | - |
| 1243 | \sa fixedPitch(), QFontInfo | - |
| 1244 | */ | - |
| 1245 | void QFont::setFixedPitch(bool enable) | - |
| 1246 | { | - |
| 1247 | 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 |
| 1248 | return; | 0 |
| 1249 | | - |
| 1250 | detach(); executed (the execution status of this line is deduced): detach(); | - |
| 1251 | | - |
| 1252 | d->request.fixedPitch = enable; executed (the execution status of this line is deduced): d->request.fixedPitch = enable; | - |
| 1253 | d->request.ignorePitch = false; executed (the execution status of this line is deduced): d->request.ignorePitch = false; | - |
| 1254 | resolve_mask |= QFont::FixedPitchResolved; executed (the execution status of this line is deduced): resolve_mask |= QFont::FixedPitchResolved; | - |
| 1255 | } executed: }Execution Count:627 | 627 |
| 1256 | | - |
| 1257 | /*! | - |
| 1258 | Returns true if kerning should be used when drawing text with this font. | - |
| 1259 | | - |
| 1260 | \sa setKerning() | - |
| 1261 | */ | - |
| 1262 | bool QFont::kerning() const | - |
| 1263 | { | - |
| 1264 | return d->kerning; executed: return d->kerning;Execution Count:14006 | 14006 |
| 1265 | } | - |
| 1266 | | - |
| 1267 | /*! | - |
| 1268 | Enables kerning for this font if \a enable is true; otherwise | - |
| 1269 | disables it. By default, kerning is enabled. | - |
| 1270 | | - |
| 1271 | When kerning is enabled, glyph metrics do not add up anymore, | - |
| 1272 | even for Latin text. In other words, the assumption that | - |
| 1273 | width('a') + width('b') is equal to width("ab") is not | - |
| 1274 | neccesairly true. | - |
| 1275 | | - |
| 1276 | \sa kerning(), QFontMetrics | - |
| 1277 | */ | - |
| 1278 | void QFont::setKerning(bool enable) | - |
| 1279 | { | - |
| 1280 | 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 |
| 1281 | return; | 0 |
| 1282 | | - |
| 1283 | QFontPrivate::detachButKeepEngineData(this); executed (the execution status of this line is deduced): QFontPrivate::detachButKeepEngineData(this); | - |
| 1284 | | - |
| 1285 | d->kerning = enable; executed (the execution status of this line is deduced): d->kerning = enable; | - |
| 1286 | resolve_mask |= QFont::KerningResolved; executed (the execution status of this line is deduced): resolve_mask |= QFont::KerningResolved; | - |
| 1287 | } executed: }Execution Count:2971 | 2971 |
| 1288 | | - |
| 1289 | /*! | - |
| 1290 | Returns the StyleStrategy. | - |
| 1291 | | - |
| 1292 | The style strategy affects the \l{QFont}{font matching} algorithm. | - |
| 1293 | See \l QFont::StyleStrategy for the list of available strategies. | - |
| 1294 | | - |
| 1295 | \sa setStyleHint(), QFont::StyleHint | - |
| 1296 | */ | - |
| 1297 | QFont::StyleStrategy QFont::styleStrategy() const | - |
| 1298 | { | - |
| 1299 | return (StyleStrategy) d->request.styleStrategy; executed: return (StyleStrategy) d->request.styleStrategy;Execution Count:16986 | 16986 |
| 1300 | } | - |
| 1301 | | - |
| 1302 | /*! | - |
| 1303 | Returns the StyleHint. | - |
| 1304 | | - |
| 1305 | The style hint affects the \l{QFont}{font matching} algorithm. | - |
| 1306 | See \l QFont::StyleHint for the list of available hints. | - |
| 1307 | | - |
| 1308 | \sa setStyleHint(), QFont::StyleStrategy, QFontInfo::styleHint() | - |
| 1309 | */ | - |
| 1310 | QFont::StyleHint QFont::styleHint() const | - |
| 1311 | { | - |
| 1312 | return (StyleHint) d->request.styleHint; executed: return (StyleHint) d->request.styleHint;Execution Count:14342 | 14342 |
| 1313 | } | - |
| 1314 | | - |
| 1315 | /*! | - |
| 1316 | \enum QFont::StyleHint | - |
| 1317 | | - |
| 1318 | Style hints are used by the \l{QFont}{font matching} algorithm to | - |
| 1319 | find an appropriate default family if a selected font family is | - |
| 1320 | not available. | - |
| 1321 | | - |
| 1322 | \value AnyStyle leaves the font matching algorithm to choose the | - |
| 1323 | family. This is the default. | - |
| 1324 | | - |
| 1325 | \value SansSerif the font matcher prefer sans serif fonts. | - |
| 1326 | \value Helvetica is a synonym for \c SansSerif. | - |
| 1327 | | - |
| 1328 | \value Serif the font matcher prefers serif fonts. | - |
| 1329 | \value Times is a synonym for \c Serif. | - |
| 1330 | | - |
| 1331 | \value TypeWriter the font matcher prefers fixed pitch fonts. | - |
| 1332 | \value Courier a synonym for \c TypeWriter. | - |
| 1333 | | - |
| 1334 | \value OldEnglish the font matcher prefers decorative fonts. | - |
| 1335 | \value Decorative is a synonym for \c OldEnglish. | - |
| 1336 | | - |
| 1337 | \value Monospace the font matcher prefers fonts that map to the | - |
| 1338 | CSS generic font-family 'monospace'. | - |
| 1339 | | - |
| 1340 | \value Fantasy the font matcher prefers fonts that map to the | - |
| 1341 | CSS generic font-family 'fantasy'. | - |
| 1342 | | - |
| 1343 | \value Cursive the font matcher prefers fonts that map to the | - |
| 1344 | CSS generic font-family 'cursive'. | - |
| 1345 | | - |
| 1346 | \value System the font matcher prefers system fonts. | - |
| 1347 | */ | - |
| 1348 | | - |
| 1349 | /*! | - |
| 1350 | \enum QFont::StyleStrategy | - |
| 1351 | | - |
| 1352 | The style strategy tells the \l{QFont}{font matching} algorithm | - |
| 1353 | what type of fonts should be used to find an appropriate default | - |
| 1354 | family. | - |
| 1355 | | - |
| 1356 | The following strategies are available: | - |
| 1357 | | - |
| 1358 | \value PreferDefault the default style strategy. It does not prefer | - |
| 1359 | any type of font. | - |
| 1360 | \value PreferBitmap prefers bitmap fonts (as opposed to outline | - |
| 1361 | fonts). | - |
| 1362 | \value PreferDevice prefers device fonts. | - |
| 1363 | \value PreferOutline prefers outline fonts (as opposed to bitmap fonts). | - |
| 1364 | \value ForceOutline forces the use of outline fonts. | - |
| 1365 | \value NoAntialias don't antialias the fonts. | - |
| 1366 | \value PreferAntialias antialias if possible. | - |
| 1367 | \value OpenGLCompatible forces the use of OpenGL compatible | - |
| 1368 | fonts. | - |
| 1369 | \value NoFontMerging If the font selected for a certain writing system | - |
| 1370 | does not contain a character requested to draw, then Qt automatically chooses a similar | - |
| 1371 | looking font that contains the character. The NoFontMerging flag disables this feature. | - |
| 1372 | Please note that enabling this flag will not prevent Qt from automatically picking a | - |
| 1373 | suitable font when the selected font does not support the writing system of the text. | - |
| 1374 | | - |
| 1375 | Any of these may be OR-ed with one of these flags: | - |
| 1376 | | - |
| 1377 | \value PreferMatch prefer an exact match. The font matcher will try to | - |
| 1378 | use the exact font size that has been specified. | - |
| 1379 | \value PreferQuality prefer the best quality font. The font matcher | - |
| 1380 | will use the nearest standard point size that the font | - |
| 1381 | supports. | - |
| 1382 | \value ForceIntegerMetrics forces the use of integer values in font engines that support fractional | - |
| 1383 | font metrics. | - |
| 1384 | */ | - |
| 1385 | | - |
| 1386 | /*! | - |
| 1387 | Sets the style hint and strategy to \a hint and \a strategy, | - |
| 1388 | respectively. | - |
| 1389 | | - |
| 1390 | If these aren't set explicitly the style hint will default to | - |
| 1391 | \c AnyStyle and the style strategy to \c PreferDefault. | - |
| 1392 | | - |
| 1393 | Qt does not support style hints on X11 since this information | - |
| 1394 | is not provided by the window system. | - |
| 1395 | | - |
| 1396 | \sa StyleHint, styleHint(), StyleStrategy, styleStrategy(), QFontInfo | - |
| 1397 | */ | - |
| 1398 | void QFont::setStyleHint(StyleHint hint, StyleStrategy strategy) | - |
| 1399 | { | - |
| 1400 | 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 |
| 1401 | (StyleHint) d->request.styleHint == hint && never evaluated: (StyleHint) d->request.styleHint == hint | 0 |
| 1402 | (StyleStrategy) d->request.styleStrategy == strategy) never evaluated: (StyleStrategy) d->request.styleStrategy == strategy | 0 |
| 1403 | return; | 0 |
| 1404 | | - |
| 1405 | detach(); executed (the execution status of this line is deduced): detach(); | - |
| 1406 | | - |
| 1407 | d->request.styleHint = hint; executed (the execution status of this line is deduced): d->request.styleHint = hint; | - |
| 1408 | d->request.styleStrategy = strategy; executed (the execution status of this line is deduced): d->request.styleStrategy = strategy; | - |
| 1409 | resolve_mask |= QFont::StyleHintResolved; executed (the execution status of this line is deduced): resolve_mask |= QFont::StyleHintResolved; | - |
| 1410 | resolve_mask |= QFont::StyleStrategyResolved; executed (the execution status of this line is deduced): resolve_mask |= QFont::StyleStrategyResolved; | - |
| 1411 | | - |
| 1412 | } executed: }Execution Count:2979 | 2979 |
| 1413 | | - |
| 1414 | /*! | - |
| 1415 | Sets the style strategy for the font to \a s. | - |
| 1416 | | - |
| 1417 | \sa QFont::StyleStrategy | - |
| 1418 | */ | - |
| 1419 | void QFont::setStyleStrategy(StyleStrategy s) | - |
| 1420 | { | - |
| 1421 | if ((resolve_mask & QFont::StyleStrategyResolved) && evaluated: (resolve_mask & QFont::StyleStrategyResolved)| yes Evaluation Count:2980 | yes Evaluation Count:8 |
| 8-2980 |
| 1422 | s == (StyleStrategy)d->request.styleStrategy) evaluated: s == (StyleStrategy)d->request.styleStrategy| yes Evaluation Count:2966 | yes Evaluation Count:14 |
| 14-2966 |
| 1423 | return; executed: return;Execution Count:2966 | 2966 |
| 1424 | | - |
| 1425 | detach(); executed (the execution status of this line is deduced): detach(); | - |
| 1426 | | - |
| 1427 | d->request.styleStrategy = s; executed (the execution status of this line is deduced): d->request.styleStrategy = s; | - |
| 1428 | resolve_mask |= QFont::StyleStrategyResolved; executed (the execution status of this line is deduced): resolve_mask |= QFont::StyleStrategyResolved; | - |
| 1429 | } executed: }Execution Count:22 | 22 |
| 1430 | | - |
| 1431 | | - |
| 1432 | /*! | - |
| 1433 | \enum QFont::Stretch | - |
| 1434 | | - |
| 1435 | Predefined stretch values that follow the CSS naming convention. The higher | - |
| 1436 | the value, the more stretched the text is. | - |
| 1437 | | - |
| 1438 | \value UltraCondensed 50 | - |
| 1439 | \value ExtraCondensed 62 | - |
| 1440 | \value Condensed 75 | - |
| 1441 | \value SemiCondensed 87 | - |
| 1442 | \value Unstretched 100 | - |
| 1443 | \value SemiExpanded 112 | - |
| 1444 | \value Expanded 125 | - |
| 1445 | \value ExtraExpanded 150 | - |
| 1446 | \value UltraExpanded 200 | - |
| 1447 | | - |
| 1448 | \sa setStretch(), stretch() | - |
| 1449 | */ | - |
| 1450 | | - |
| 1451 | /*! | - |
| 1452 | Returns the stretch factor for the font. | - |
| 1453 | | - |
| 1454 | \sa setStretch() | - |
| 1455 | */ | - |
| 1456 | int QFont::stretch() const | - |
| 1457 | { | - |
| 1458 | return d->request.stretch; executed: return d->request.stretch;Execution Count:14006 | 14006 |
| 1459 | } | - |
| 1460 | | - |
| 1461 | /*! | - |
| 1462 | Sets the stretch factor for the font. | - |
| 1463 | | - |
| 1464 | The stretch factor changes the width of all characters in the font | - |
| 1465 | by \a factor percent. For example, setting \a factor to 150 | - |
| 1466 | results in all characters in the font being 1.5 times (ie. 150%) | - |
| 1467 | wider. The default stretch factor is 100. The minimum stretch | - |
| 1468 | factor is 1, and the maximum stretch factor is 4000. | - |
| 1469 | | - |
| 1470 | The stretch factor is only applied to outline fonts. The stretch | - |
| 1471 | factor is ignored for bitmap fonts. | - |
| 1472 | | - |
| 1473 | \sa stretch(), QFont::Stretch | - |
| 1474 | */ | - |
| 1475 | void QFont::setStretch(int factor) | - |
| 1476 | { | - |
| 1477 | 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 |
| 1478 | qWarning("QFont::setStretch: Parameter '%d' out of range", factor); never executed (the execution status of this line is deduced): QMessageLogger("text/qfont.cpp", 1478, __PRETTY_FUNCTION__).warning("QFont::setStretch: Parameter '%d' out of range", factor); | - |
| 1479 | return; | 0 |
| 1480 | } | - |
| 1481 | | - |
| 1482 | if ((resolve_mask & QFont::StretchResolved) && partially evaluated: (resolve_mask & QFont::StretchResolved)| no Evaluation Count:0 | yes Evaluation Count:2983 |
| 0-2983 |
| 1483 | d->request.stretch == (uint)factor) never evaluated: d->request.stretch == (uint)factor | 0 |
| 1484 | return; | 0 |
| 1485 | | - |
| 1486 | detach(); executed (the execution status of this line is deduced): detach(); | - |
| 1487 | | - |
| 1488 | d->request.stretch = (uint)factor; executed (the execution status of this line is deduced): d->request.stretch = (uint)factor; | - |
| 1489 | resolve_mask |= QFont::StretchResolved; executed (the execution status of this line is deduced): resolve_mask |= QFont::StretchResolved; | - |
| 1490 | } executed: }Execution Count:2983 | 2983 |
| 1491 | | - |
| 1492 | /*! | - |
| 1493 | \enum QFont::SpacingType | - |
| 1494 | \since 4.4 | - |
| 1495 | | - |
| 1496 | \value PercentageSpacing A value of 100 will keep the spacing unchanged; a value of 200 will enlarge the | - |
| 1497 | spacing after a character by the width of the character itself. | - |
| 1498 | \value AbsoluteSpacing A positive value increases the letter spacing by the corresponding pixels; a negative | - |
| 1499 | value decreases the spacing. | - |
| 1500 | */ | - |
| 1501 | | - |
| 1502 | /*! | - |
| 1503 | \since 4.4 | - |
| 1504 | Returns the letter spacing for the font. | - |
| 1505 | | - |
| 1506 | \sa setLetterSpacing(), letterSpacingType(), setWordSpacing() | - |
| 1507 | */ | - |
| 1508 | qreal QFont::letterSpacing() const | - |
| 1509 | { | - |
| 1510 | return d->letterSpacing.toReal(); executed: return d->letterSpacing.toReal();Execution Count:14007 | 14007 |
| 1511 | } | - |
| 1512 | | - |
| 1513 | /*! | - |
| 1514 | \since 4.4 | - |
| 1515 | Sets the letter spacing for the font to \a spacing and the type | - |
| 1516 | of spacing to \a type. | - |
| 1517 | | - |
| 1518 | Letter spacing changes the default spacing between individual | - |
| 1519 | letters in the font. The spacing between the letters can be | - |
| 1520 | made smaller as well as larger. | - |
| 1521 | | - |
| 1522 | \sa letterSpacing(), letterSpacingType(), setWordSpacing() | - |
| 1523 | */ | - |
| 1524 | void QFont::setLetterSpacing(SpacingType type, qreal spacing) | - |
| 1525 | { | - |
| 1526 | const QFixed newSpacing = QFixed::fromReal(spacing); executed (the execution status of this line is deduced): const QFixed newSpacing = QFixed::fromReal(spacing); | - |
| 1527 | const bool absoluteSpacing = type == AbsoluteSpacing; executed (the execution status of this line is deduced): const bool absoluteSpacing = type == AbsoluteSpacing; | - |
| 1528 | if ((resolve_mask & QFont::LetterSpacingResolved) && partially evaluated: (resolve_mask & QFont::LetterSpacingResolved)| no Evaluation Count:0 | yes Evaluation Count:2970 |
| 0-2970 |
| 1529 | d->letterSpacingIsAbsolute == absoluteSpacing && never evaluated: d->letterSpacingIsAbsolute == absoluteSpacing | 0 |
| 1530 | d->letterSpacing == newSpacing) never evaluated: d->letterSpacing == newSpacing | 0 |
| 1531 | return; | 0 |
| 1532 | | - |
| 1533 | QFontPrivate::detachButKeepEngineData(this); executed (the execution status of this line is deduced): QFontPrivate::detachButKeepEngineData(this); | - |
| 1534 | | - |
| 1535 | d->letterSpacing = newSpacing; executed (the execution status of this line is deduced): d->letterSpacing = newSpacing; | - |
| 1536 | d->letterSpacingIsAbsolute = absoluteSpacing; executed (the execution status of this line is deduced): d->letterSpacingIsAbsolute = absoluteSpacing; | - |
| 1537 | resolve_mask |= QFont::LetterSpacingResolved; executed (the execution status of this line is deduced): resolve_mask |= QFont::LetterSpacingResolved; | - |
| 1538 | } executed: }Execution Count:2970 | 2970 |
| 1539 | | - |
| 1540 | /*! | - |
| 1541 | \since 4.4 | - |
| 1542 | Returns the spacing type used for letter spacing. | - |
| 1543 | | - |
| 1544 | \sa letterSpacing(), setLetterSpacing(), setWordSpacing() | - |
| 1545 | */ | - |
| 1546 | QFont::SpacingType QFont::letterSpacingType() const | - |
| 1547 | { | - |
| 1548 | return d->letterSpacingIsAbsolute ? AbsoluteSpacing : PercentageSpacing; executed: return d->letterSpacingIsAbsolute ? AbsoluteSpacing : PercentageSpacing;Execution Count:14005 | 14005 |
| 1549 | } | - |
| 1550 | | - |
| 1551 | /*! | - |
| 1552 | \since 4.4 | - |
| 1553 | Returns the word spacing for the font. | - |
| 1554 | | - |
| 1555 | \sa setWordSpacing(), setLetterSpacing() | - |
| 1556 | */ | - |
| 1557 | qreal QFont::wordSpacing() const | - |
| 1558 | { | - |
| 1559 | return d->wordSpacing.toReal(); executed: return d->wordSpacing.toReal();Execution Count:14007 | 14007 |
| 1560 | } | - |
| 1561 | | - |
| 1562 | /*! | - |
| 1563 | \since 4.4 | - |
| 1564 | Sets the word spacing for the font to \a spacing. | - |
| 1565 | | - |
| 1566 | Word spacing changes the default spacing between individual | - |
| 1567 | words. A positive value increases the word spacing | - |
| 1568 | by a corresponding amount of pixels, while a negative value | - |
| 1569 | decreases the inter-word spacing accordingly. | - |
| 1570 | | - |
| 1571 | Word spacing will not apply to writing systems, where indiviaul | - |
| 1572 | words are not separated by white space. | - |
| 1573 | | - |
| 1574 | \sa wordSpacing(), setLetterSpacing() | - |
| 1575 | */ | - |
| 1576 | void QFont::setWordSpacing(qreal spacing) | - |
| 1577 | { | - |
| 1578 | const QFixed newSpacing = QFixed::fromReal(spacing); executed (the execution status of this line is deduced): const QFixed newSpacing = QFixed::fromReal(spacing); | - |
| 1579 | if ((resolve_mask & QFont::WordSpacingResolved) && partially evaluated: (resolve_mask & QFont::WordSpacingResolved)| no Evaluation Count:0 | yes Evaluation Count:2973 |
| 0-2973 |
| 1580 | d->wordSpacing == newSpacing) never evaluated: d->wordSpacing == newSpacing | 0 |
| 1581 | return; | 0 |
| 1582 | | - |
| 1583 | QFontPrivate::detachButKeepEngineData(this); executed (the execution status of this line is deduced): QFontPrivate::detachButKeepEngineData(this); | - |
| 1584 | | - |
| 1585 | d->wordSpacing = newSpacing; executed (the execution status of this line is deduced): d->wordSpacing = newSpacing; | - |
| 1586 | resolve_mask |= QFont::WordSpacingResolved; executed (the execution status of this line is deduced): resolve_mask |= QFont::WordSpacingResolved; | - |
| 1587 | } executed: }Execution Count:2973 | 2973 |
| 1588 | | - |
| 1589 | /*! | - |
| 1590 | \enum QFont::Capitalization | - |
| 1591 | \since 4.4 | - |
| 1592 | | - |
| 1593 | Rendering option for text this font applies to. | - |
| 1594 | | - |
| 1595 | | - |
| 1596 | \value MixedCase This is the normal text rendering option where no capitalization change is applied. | - |
| 1597 | \value AllUppercase This alters the text to be rendered in all uppercase type. | - |
| 1598 | \value AllLowercase This alters the text to be rendered in all lowercase type. | - |
| 1599 | \value SmallCaps This alters the text to be rendered in small-caps type. | - |
| 1600 | \value Capitalize This alters the text to be rendered with the first character of each word as an uppercase character. | - |
| 1601 | */ | - |
| 1602 | | - |
| 1603 | /*! | - |
| 1604 | \since 4.4 | - |
| 1605 | Sets the capitalization of the text in this font to \a caps. | - |
| 1606 | | - |
| 1607 | A font's capitalization makes the text appear in the selected capitalization mode. | - |
| 1608 | | - |
| 1609 | \sa capitalization() | - |
| 1610 | */ | - |
| 1611 | void QFont::setCapitalization(Capitalization caps) | - |
| 1612 | { | - |
| 1613 | if ((resolve_mask & QFont::CapitalizationResolved) && evaluated: (resolve_mask & QFont::CapitalizationResolved)| yes Evaluation Count:1 | yes Evaluation Count:2979 |
| 1-2979 |
| 1614 | capitalization() == caps) partially evaluated: capitalization() == caps| no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
| 1615 | return; | 0 |
| 1616 | | - |
| 1617 | QFontPrivate::detachButKeepEngineData(this); executed (the execution status of this line is deduced): QFontPrivate::detachButKeepEngineData(this); | - |
| 1618 | | - |
| 1619 | d->capital = caps; executed (the execution status of this line is deduced): d->capital = caps; | - |
| 1620 | resolve_mask |= QFont::CapitalizationResolved; executed (the execution status of this line is deduced): resolve_mask |= QFont::CapitalizationResolved; | - |
| 1621 | } executed: }Execution Count:2980 | 2980 |
| 1622 | | - |
| 1623 | /*! | - |
| 1624 | \since 4.4 | - |
| 1625 | Returns the current capitalization type of the font. | - |
| 1626 | | - |
| 1627 | \sa setCapitalization() | - |
| 1628 | */ | - |
| 1629 | QFont::Capitalization QFont::capitalization() const | - |
| 1630 | { | - |
| 1631 | return static_cast<QFont::Capitalization> (d->capital); executed: return static_cast<QFont::Capitalization> (d->capital);Execution Count:19400 | 19400 |
| 1632 | } | - |
| 1633 | | - |
| 1634 | | - |
| 1635 | /*! | - |
| 1636 | If \a enable is true, turns raw mode on; otherwise turns raw mode | - |
| 1637 | off. This function only has an effect under X11. | - |
| 1638 | | - |
| 1639 | If raw mode is enabled, Qt will search for an X font with a | - |
| 1640 | complete font name matching the family name, ignoring all other | - |
| 1641 | values set for the QFont. If the font name matches several fonts, | - |
| 1642 | Qt will use the first font returned by X. QFontInfo \e cannot be | - |
| 1643 | used to fetch information about a QFont using raw mode (it will | - |
| 1644 | return the values set in the QFont for all parameters, including | - |
| 1645 | the family name). | - |
| 1646 | | - |
| 1647 | \warning Do not use raw mode unless you really, really need it! In | - |
| 1648 | most (if not all) cases, setRawName() is a much better choice. | - |
| 1649 | | - |
| 1650 | \sa rawMode(), setRawName() | - |
| 1651 | */ | - |
| 1652 | void QFont::setRawMode(bool enable) | - |
| 1653 | { | - |
| 1654 | 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 |
| 1655 | | - |
| 1656 | // might change behavior, thus destroy engine data | - |
| 1657 | detach(); never executed (the execution status of this line is deduced): detach(); | - |
| 1658 | | - |
| 1659 | d->rawMode = enable; never executed (the execution status of this line is deduced): d->rawMode = enable; | - |
| 1660 | } | 0 |
| 1661 | | - |
| 1662 | /*! | - |
| 1663 | Returns true if a window system font exactly matching the settings | - |
| 1664 | of this font is available. | - |
| 1665 | | - |
| 1666 | \sa QFontInfo | - |
| 1667 | */ | - |
| 1668 | bool QFont::exactMatch() const | - |
| 1669 | { | - |
| 1670 | QFontEngine *engine = d->engineForScript(QUnicodeTables::Common); executed (the execution status of this line is deduced): QFontEngine *engine = d->engineForScript(QUnicodeTables::Common); | - |
| 1671 | Q_ASSERT(engine != 0); executed (the execution status of this line is deduced): qt_noop(); | - |
| 1672 | return (d->rawMode executed: return (d->rawMode ? engine->type() != QFontEngine::Box : d->request.exactMatch(engine->fontDef));Execution Count:7 | 7 |
| 1673 | ? engine->type() != QFontEngine::Box executed: return (d->rawMode ? engine->type() != QFontEngine::Box : d->request.exactMatch(engine->fontDef));Execution Count:7 | 7 |
| 1674 | : d->request.exactMatch(engine->fontDef)); executed: return (d->rawMode ? engine->type() != QFontEngine::Box : d->request.exactMatch(engine->fontDef));Execution Count:7 | 7 |
| 1675 | } | - |
| 1676 | | - |
| 1677 | /*! | - |
| 1678 | Returns true if this font is equal to \a f; otherwise returns | - |
| 1679 | false. | - |
| 1680 | | - |
| 1681 | Two QFonts are considered equal if their font attributes are | - |
| 1682 | equal. If rawMode() is enabled for both fonts, only the family | - |
| 1683 | fields are compared. | - |
| 1684 | | - |
| 1685 | \sa operator!=(), isCopyOf() | - |
| 1686 | */ | - |
| 1687 | bool QFont::operator==(const QFont &f) const | - |
| 1688 | { | - |
| 1689 | return (f.d == d 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 |
| 1690 | || (f.d->request == d->request 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 |
| 1691 | && f.d->request.pointSize == d->request.pointSize 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 |
| 1692 | && f.d->underline == d->underline 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 |
| 1693 | && f.d->overline == d->overline 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 |
| 1694 | && f.d->strikeOut == d->strikeOut 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 |
| 1695 | && f.d->kerning == d->kerning 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 |
| 1696 | && f.d->capital == d->capital 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 |
| 1697 | && f.d->letterSpacingIsAbsolute == d->letterSpacingIsAbsolute 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 |
| 1698 | && f.d->letterSpacing == d->letterSpacing 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 |
| 1699 | && f.d->wordSpacing == d->wordSpacing 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 |
| 1700 | )); 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 |
| 1701 | } | - |
| 1702 | | - |
| 1703 | | - |
| 1704 | /*! | - |
| 1705 | Provides an arbitrary comparison of this font and font \a f. | - |
| 1706 | All that is guaranteed is that the operator returns false if both | - |
| 1707 | fonts are equal and that (f1 \< f2) == !(f2 \< f1) if the fonts | - |
| 1708 | are not equal. | - |
| 1709 | | - |
| 1710 | This function is useful in some circumstances, for example if you | - |
| 1711 | want to use QFont objects as keys in a QMap. | - |
| 1712 | | - |
| 1713 | \sa operator==(), operator!=(), isCopyOf() | - |
| 1714 | */ | - |
| 1715 | bool QFont::operator<(const QFont &f) const | - |
| 1716 | { | - |
| 1717 | 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 |
| 1718 | // the < operator for fontdefs ignores point sizes. | - |
| 1719 | QFontDef &r1 = f.d->request; executed (the execution status of this line is deduced): QFontDef &r1 = f.d->request; | - |
| 1720 | QFontDef &r2 = d->request; executed (the execution status of this line is deduced): QFontDef &r2 = d->request; | - |
| 1721 | 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 |
| 1722 | 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 |
| 1723 | 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 |
| 1724 | 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 |
| 1725 | 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 |
| 1726 | 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 |
| 1727 | 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 |
| 1728 | 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 |
| 1729 | 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 |
| 1730 | | - |
| 1731 | 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 |
| 1732 | 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 |
| 1733 | 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 |
| 1734 | | - |
| 1735 | int f1attrs = (f.d->underline << 3) + (f.d->overline << 2) + (f.d->strikeOut<<1) + f.d->kerning; executed (the execution status of this line is deduced): int f1attrs = (f.d->underline << 3) + (f.d->overline << 2) + (f.d->strikeOut<<1) + f.d->kerning; | - |
| 1736 | int f2attrs = (d->underline << 3) + (d->overline << 2) + (d->strikeOut<<1) + d->kerning; executed (the execution status of this line is deduced): int f2attrs = (d->underline << 3) + (d->overline << 2) + (d->strikeOut<<1) + d->kerning; | - |
| 1737 | return f1attrs < f2attrs; executed: return f1attrs < f2attrs;Execution Count:12 | 12 |
| 1738 | } | - |
| 1739 | | - |
| 1740 | | - |
| 1741 | /*! | - |
| 1742 | Returns true if this font is different from \a f; otherwise | - |
| 1743 | returns false. | - |
| 1744 | | - |
| 1745 | Two QFonts are considered to be different if their font attributes | - |
| 1746 | are different. If rawMode() is enabled for both fonts, only the | - |
| 1747 | family fields are compared. | - |
| 1748 | | - |
| 1749 | \sa operator==() | - |
| 1750 | */ | - |
| 1751 | bool QFont::operator!=(const QFont &f) const | - |
| 1752 | { | - |
| 1753 | return !(operator==(f)); executed: return !(operator==(f));Execution Count:683 | 683 |
| 1754 | } | - |
| 1755 | | - |
| 1756 | /*! | - |
| 1757 | Returns the font as a QVariant | - |
| 1758 | */ | - |
| 1759 | QFont::operator QVariant() const | - |
| 1760 | { | - |
| 1761 | return QVariant(QVariant::Font, this); executed: return QVariant(QVariant::Font, this);Execution Count:4752 | 4752 |
| 1762 | } | - |
| 1763 | | - |
| 1764 | /*! | - |
| 1765 | Returns true if this font and \a f are copies of each other, i.e. | - |
| 1766 | one of them was created as a copy of the other and neither has | - |
| 1767 | been modified since. This is much stricter than equality. | - |
| 1768 | | - |
| 1769 | \sa operator=(), operator==() | - |
| 1770 | */ | - |
| 1771 | bool QFont::isCopyOf(const QFont & f) const | - |
| 1772 | { | - |
| 1773 | return d == f.d; executed: return d == f.d;Execution Count:78998 | 78998 |
| 1774 | } | - |
| 1775 | | - |
| 1776 | /*! | - |
| 1777 | Returns true if raw mode is used for font name matching; otherwise | - |
| 1778 | returns false. | - |
| 1779 | | - |
| 1780 | \sa setRawMode(), rawName() | - |
| 1781 | */ | - |
| 1782 | bool QFont::rawMode() const | - |
| 1783 | { | - |
| 1784 | return d->rawMode; executed: return d->rawMode;Execution Count:170 | 170 |
| 1785 | } | - |
| 1786 | | - |
| 1787 | /*! | - |
| 1788 | Returns a new QFont that has attributes copied from \a other that | - |
| 1789 | have not been previously set on this font. | - |
| 1790 | */ | - |
| 1791 | QFont QFont::resolve(const QFont &other) const | - |
| 1792 | { | - |
| 1793 | if (*this == other evaluated: *this == other| yes Evaluation Count:68801 | yes Evaluation Count:1961 |
| 1961-68801 |
| 1794 | && (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 |
| 1795 | && d->dpi == other.d->dpi) { evaluated: d->dpi == other.d->dpi| yes Evaluation Count:65450 | yes Evaluation Count:497 |
| 497-65450 |
| 1796 | QFont o = other; executed (the execution status of this line is deduced): QFont o = other; | - |
| 1797 | o.resolve_mask = resolve_mask; executed (the execution status of this line is deduced): o.resolve_mask = resolve_mask; | - |
| 1798 | return o; executed: return o;Execution Count:65450 | 65450 |
| 1799 | } | - |
| 1800 | | - |
| 1801 | QFont font(*this); executed (the execution status of this line is deduced): QFont font(*this); | - |
| 1802 | font.detach(); executed (the execution status of this line is deduced): font.detach(); | - |
| 1803 | font.d->resolve(resolve_mask, other.d.data()); executed (the execution status of this line is deduced): font.d->resolve(resolve_mask, other.d.data()); | - |
| 1804 | | - |
| 1805 | return font; executed: return font;Execution Count:5312 | 5312 |
| 1806 | } | - |
| 1807 | | - |
| 1808 | /*! | - |
| 1809 | \fn uint QFont::resolve() const | - |
| 1810 | \internal | - |
| 1811 | */ | - |
| 1812 | | - |
| 1813 | /*! | - |
| 1814 | \fn void QFont::resolve(uint mask) | - |
| 1815 | \internal | - |
| 1816 | */ | - |
| 1817 | | - |
| 1818 | | - |
| 1819 | /***************************************************************************** | - |
| 1820 | QFont substitution management | - |
| 1821 | *****************************************************************************/ | - |
| 1822 | | - |
| 1823 | typedef QHash<QString, QStringList> QFontSubst; | - |
| 1824 | Q_GLOBAL_STATIC(QFontSubst, globalFontSubst) 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 |
| 1825 | | - |
| 1826 | /*! | - |
| 1827 | Returns the first family name to be used whenever \a familyName is | - |
| 1828 | specified. The lookup is case insensitive. | - |
| 1829 | | - |
| 1830 | If there is no substitution for \a familyName, \a familyName is | - |
| 1831 | returned. | - |
| 1832 | | - |
| 1833 | To obtain a list of substitutions use substitutes(). | - |
| 1834 | | - |
| 1835 | \sa setFamily(), insertSubstitutions(), insertSubstitution(), removeSubstitutions() | - |
| 1836 | */ | - |
| 1837 | QString QFont::substitute(const QString &familyName) | - |
| 1838 | { | - |
| 1839 | QFontSubst *fontSubst = globalFontSubst(); never executed (the execution status of this line is deduced): QFontSubst *fontSubst = globalFontSubst(); | - |
| 1840 | Q_ASSERT(fontSubst != 0); never executed (the execution status of this line is deduced): qt_noop(); | - |
| 1841 | QFontSubst::ConstIterator it = fontSubst->constFind(familyName.toLower()); never executed (the execution status of this line is deduced): QFontSubst::ConstIterator it = fontSubst->constFind(familyName.toLower()); | - |
| 1842 | if (it != fontSubst->constEnd() && !(*it).isEmpty()) never evaluated: it != fontSubst->constEnd() never evaluated: !(*it).isEmpty() | 0 |
| 1843 | return (*it).first(); never executed: return (*it).first(); | 0 |
| 1844 | | - |
| 1845 | return familyName; never executed: return familyName; | 0 |
| 1846 | } | - |
| 1847 | | - |
| 1848 | | - |
| 1849 | /*! | - |
| 1850 | Returns a list of family names to be used whenever \a familyName | - |
| 1851 | is specified. The lookup is case insensitive. | - |
| 1852 | | - |
| 1853 | If there is no substitution for \a familyName, an empty list is | - |
| 1854 | returned. | - |
| 1855 | | - |
| 1856 | \sa substitute(), insertSubstitutions(), insertSubstitution(), removeSubstitutions() | - |
| 1857 | */ | - |
| 1858 | QStringList QFont::substitutes(const QString &familyName) | - |
| 1859 | { | - |
| 1860 | QFontSubst *fontSubst = globalFontSubst(); executed (the execution status of this line is deduced): QFontSubst *fontSubst = globalFontSubst(); | - |
| 1861 | Q_ASSERT(fontSubst != 0); executed (the execution status of this line is deduced): qt_noop(); | - |
| 1862 | return fontSubst->value(familyName.toLower(), QStringList()); executed: return fontSubst->value(familyName.toLower(), QStringList());Execution Count:645 | 645 |
| 1863 | } | - |
| 1864 | | - |
| 1865 | | - |
| 1866 | /*! | - |
| 1867 | Inserts \a substituteName into the substitution | - |
| 1868 | table for the family \a familyName. | - |
| 1869 | | - |
| 1870 | \sa insertSubstitutions(), removeSubstitutions(), substitutions(), substitute(), substitutes() | - |
| 1871 | */ | - |
| 1872 | void QFont::insertSubstitution(const QString &familyName, | - |
| 1873 | const QString &substituteName) | - |
| 1874 | { | - |
| 1875 | QFontSubst *fontSubst = globalFontSubst(); executed (the execution status of this line is deduced): QFontSubst *fontSubst = globalFontSubst(); | - |
| 1876 | Q_ASSERT(fontSubst != 0); executed (the execution status of this line is deduced): qt_noop(); | - |
| 1877 | QStringList &list = (*fontSubst)[familyName.toLower()]; executed (the execution status of this line is deduced): QStringList &list = (*fontSubst)[familyName.toLower()]; | - |
| 1878 | QString s = substituteName.toLower(); executed (the execution status of this line is deduced): QString s = substituteName.toLower(); | - |
| 1879 | if (!list.contains(s)) partially evaluated: !list.contains(s)| yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
| 1880 | list.append(s); executed: list.append(s);Execution Count:1 | 1 |
| 1881 | } executed: }Execution Count:1 | 1 |
| 1882 | | - |
| 1883 | | - |
| 1884 | /*! | - |
| 1885 | Inserts the list of families \a substituteNames into the | - |
| 1886 | substitution list for \a familyName. | - |
| 1887 | | - |
| 1888 | \sa insertSubstitution(), removeSubstitutions(), substitutions(), substitute() | - |
| 1889 | */ | - |
| 1890 | void QFont::insertSubstitutions(const QString &familyName, | - |
| 1891 | const QStringList &substituteNames) | - |
| 1892 | { | - |
| 1893 | QFontSubst *fontSubst = globalFontSubst(); executed (the execution status of this line is deduced): QFontSubst *fontSubst = globalFontSubst(); | - |
| 1894 | Q_ASSERT(fontSubst != 0); executed (the execution status of this line is deduced): qt_noop(); | - |
| 1895 | QStringList &list = (*fontSubst)[familyName.toLower()]; executed (the execution status of this line is deduced): QStringList &list = (*fontSubst)[familyName.toLower()]; | - |
| 1896 | foreach (const QString &substituteName, substituteNames) { executed (the execution status of this line is deduced): 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;})) { | - |
| 1897 | const QString lowerSubstituteName = substituteName.toLower(); executed (the execution status of this line is deduced): const QString lowerSubstituteName = substituteName.toLower(); | - |
| 1898 | if (!list.contains(lowerSubstituteName)) partially evaluated: !list.contains(lowerSubstituteName)| yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
| 1899 | list.append(lowerSubstituteName); executed: list.append(lowerSubstituteName);Execution Count:2 | 2 |
| 1900 | } executed: }Execution Count:2 | 2 |
| 1901 | } executed: }Execution Count:1 | 1 |
| 1902 | | - |
| 1903 | /*! \fn void QFont::initialize() | - |
| 1904 | \internal | - |
| 1905 | | - |
| 1906 | Internal function that initializes the font system. The font cache | - |
| 1907 | and font dict do not alloc the keys. The key is a QString which is | - |
| 1908 | shared between QFontPrivate and QXFontName. | - |
| 1909 | */ | - |
| 1910 | | - |
| 1911 | /*! \fn void QFont::cleanup() | - |
| 1912 | \internal | - |
| 1913 | | - |
| 1914 | Internal function that cleans up the font system. | - |
| 1915 | */ | - |
| 1916 | | - |
| 1917 | /*! | - |
| 1918 | Removes all the substitutions for \a familyName. | - |
| 1919 | | - |
| 1920 | \sa insertSubstitutions(), insertSubstitution(), substitutions(), substitute() | - |
| 1921 | \since 5.0 | - |
| 1922 | */ | - |
| 1923 | void QFont::removeSubstitutions(const QString &familyName) | - |
| 1924 | { | - |
| 1925 | QFontSubst *fontSubst = globalFontSubst(); executed (the execution status of this line is deduced): QFontSubst *fontSubst = globalFontSubst(); | - |
| 1926 | Q_ASSERT(fontSubst != 0); executed (the execution status of this line is deduced): qt_noop(); | - |
| 1927 | fontSubst->remove(familyName.toLower()); executed (the execution status of this line is deduced): fontSubst->remove(familyName.toLower()); | - |
| 1928 | } executed: }Execution Count:2 | 2 |
| 1929 | | - |
| 1930 | /*! | - |
| 1931 | \fn void QFont::removeSubstitution(const QString &familyName) | - |
| 1932 | | - |
| 1933 | \obsolete | - |
| 1934 | | - |
| 1935 | This function is deprecated. Use removeSubstitutions() instead. | - |
| 1936 | */ | - |
| 1937 | | - |
| 1938 | /*! | - |
| 1939 | Returns a sorted list of substituted family names. | - |
| 1940 | | - |
| 1941 | \sa insertSubstitution(), removeSubstitution(), substitute() | - |
| 1942 | */ | - |
| 1943 | QStringList QFont::substitutions() | - |
| 1944 | { | - |
| 1945 | typedef QFontSubst::const_iterator QFontSubstConstIterator; never executed (the execution status of this line is deduced): typedef QFontSubst::const_iterator QFontSubstConstIterator; | - |
| 1946 | | - |
| 1947 | QFontSubst *fontSubst = globalFontSubst(); never executed (the execution status of this line is deduced): QFontSubst *fontSubst = globalFontSubst(); | - |
| 1948 | Q_ASSERT(fontSubst != 0); never executed (the execution status of this line is deduced): qt_noop(); | - |
| 1949 | QStringList ret; never executed (the execution status of this line is deduced): QStringList ret; | - |
| 1950 | const QFontSubstConstIterator cend = fontSubst->constEnd(); never executed (the execution status of this line is deduced): const QFontSubstConstIterator cend = fontSubst->constEnd(); | - |
| 1951 | for (QFontSubstConstIterator it = fontSubst->constBegin(); it != cend; ++it) never evaluated: it != cend | 0 |
| 1952 | ret.append(it.key()); never executed: ret.append(it.key()); | 0 |
| 1953 | | - |
| 1954 | ret.sort(); never executed (the execution status of this line is deduced): ret.sort(); | - |
| 1955 | return ret; never executed: return ret; | 0 |
| 1956 | } | - |
| 1957 | | - |
| 1958 | | - |
| 1959 | /* \internal | - |
| 1960 | Internal function. Converts boolean font settings to an unsigned | - |
| 1961 | 8-bit number. Used for serialization etc. | - |
| 1962 | */ | - |
| 1963 | static quint8 get_font_bits(int version, const QFontPrivate *f) | - |
| 1964 | { | - |
| 1965 | Q_ASSERT(f != 0); executed (the execution status of this line is deduced): qt_noop(); | - |
| 1966 | quint8 bits = 0; executed (the execution status of this line is deduced): quint8 bits = 0; | - |
| 1967 | if (f->request.style) evaluated: f->request.style| yes Evaluation Count:36 | yes Evaluation Count:52 |
| 36-52 |
| 1968 | bits |= 0x01; executed: bits |= 0x01;Execution Count:36 | 36 |
| 1969 | if (f->underline) evaluated: f->underline| yes Evaluation Count:18 | yes Evaluation Count:70 |
| 18-70 |
| 1970 | bits |= 0x02; executed: bits |= 0x02;Execution Count:18 | 18 |
| 1971 | if (f->overline) partially evaluated: f->overline| no Evaluation Count:0 | yes Evaluation Count:88 |
| 0-88 |
| 1972 | bits |= 0x40; never executed: bits |= 0x40; | 0 |
| 1973 | if (f->strikeOut) evaluated: f->strikeOut| yes Evaluation Count:24 | yes Evaluation Count:64 |
| 24-64 |
| 1974 | bits |= 0x04; executed: bits |= 0x04;Execution Count:24 | 24 |
| 1975 | if (f->request.fixedPitch) evaluated: f->request.fixedPitch| yes Evaluation Count:18 | yes Evaluation Count:70 |
| 18-70 |
| 1976 | bits |= 0x08; executed: bits |= 0x08;Execution Count:18 | 18 |
| 1977 | // if (f.hintSetByUser) | - |
| 1978 | // bits |= 0x10; | - |
| 1979 | if (f->rawMode) partially evaluated: f->rawMode| no Evaluation Count:0 | yes Evaluation Count:88 |
| 0-88 |
| 1980 | bits |= 0x20; never executed: bits |= 0x20; | 0 |
| 1981 | if (version >= QDataStream::Qt_4_0) { partially evaluated: version >= QDataStream::Qt_4_0| yes Evaluation Count:88 | no Evaluation Count:0 |
| 0-88 |
| 1982 | if (f->kerning) partially evaluated: f->kerning| yes Evaluation Count:88 | no Evaluation Count:0 |
| 0-88 |
| 1983 | bits |= 0x10; executed: bits |= 0x10;Execution Count:88 | 88 |
| 1984 | } executed: }Execution Count:88 | 88 |
| 1985 | if (f->request.style == QFont::StyleOblique) partially evaluated: f->request.style == QFont::StyleOblique| no Evaluation Count:0 | yes Evaluation Count:88 |
| 0-88 |
| 1986 | bits |= 0x80; never executed: bits |= 0x80; | 0 |
| 1987 | return bits; executed: return bits;Execution Count:88 | 88 |
| 1988 | } | - |
| 1989 | | - |
| 1990 | static quint8 get_extended_font_bits(const QFontPrivate *f) | - |
| 1991 | { | - |
| 1992 | Q_ASSERT(f != 0); executed (the execution status of this line is deduced): qt_noop(); | - |
| 1993 | quint8 bits = 0; executed (the execution status of this line is deduced): quint8 bits = 0; | - |
| 1994 | if (f->request.ignorePitch) evaluated: f->request.ignorePitch| yes Evaluation Count:46 | yes Evaluation Count:42 |
| 42-46 |
| 1995 | bits |= 0x01; executed: bits |= 0x01;Execution Count:46 | 46 |
| 1996 | if (f->letterSpacingIsAbsolute) evaluated: f->letterSpacingIsAbsolute| yes Evaluation Count:2 | yes Evaluation Count:86 |
| 2-86 |
| 1997 | bits |= 0x02; executed: bits |= 0x02;Execution Count:2 | 2 |
| 1998 | return bits; executed: return bits;Execution Count:88 | 88 |
| 1999 | } | - |
| 2000 | | - |
| 2001 | #ifndef QT_NO_DATASTREAM | - |
| 2002 | | - |
| 2003 | /* \internal | - |
| 2004 | Internal function. Sets boolean font settings from an unsigned | - |
| 2005 | 8-bit number. Used for serialization etc. | - |
| 2006 | */ | - |
| 2007 | static void set_font_bits(int version, quint8 bits, QFontPrivate *f) | - |
| 2008 | { | - |
| 2009 | Q_ASSERT(f != 0); executed (the execution status of this line is deduced): qt_noop(); | - |
| 2010 | f->request.style = (bits & 0x01) != 0 ? QFont::StyleItalic : QFont::StyleNormal; evaluated: (bits & 0x01) != 0| yes Evaluation Count:36 | yes Evaluation Count:52 |
| 36-52 |
| 2011 | f->underline = (bits & 0x02) != 0; executed (the execution status of this line is deduced): f->underline = (bits & 0x02) != 0; | - |
| 2012 | f->overline = (bits & 0x40) != 0; executed (the execution status of this line is deduced): f->overline = (bits & 0x40) != 0; | - |
| 2013 | f->strikeOut = (bits & 0x04) != 0; executed (the execution status of this line is deduced): f->strikeOut = (bits & 0x04) != 0; | - |
| 2014 | f->request.fixedPitch = (bits & 0x08) != 0; executed (the execution status of this line is deduced): f->request.fixedPitch = (bits & 0x08) != 0; | - |
| 2015 | // f->hintSetByUser = (bits & 0x10) != 0; | - |
| 2016 | f->rawMode = (bits & 0x20) != 0; executed (the execution status of this line is deduced): f->rawMode = (bits & 0x20) != 0; | - |
| 2017 | if (version >= QDataStream::Qt_4_0) partially evaluated: version >= QDataStream::Qt_4_0| yes Evaluation Count:88 | no Evaluation Count:0 |
| 0-88 |
| 2018 | f->kerning = (bits & 0x10) != 0; executed: f->kerning = (bits & 0x10) != 0;Execution Count:88 | 88 |
| 2019 | if ((bits & 0x80) != 0) partially evaluated: (bits & 0x80) != 0| no Evaluation Count:0 | yes Evaluation Count:88 |
| 0-88 |
| 2020 | f->request.style = QFont::StyleOblique; never executed: f->request.style = QFont::StyleOblique; | 0 |
| 2021 | } executed: }Execution Count:88 | 88 |
| 2022 | | - |
| 2023 | static void set_extended_font_bits(quint8 bits, QFontPrivate *f) | - |
| 2024 | { | - |
| 2025 | Q_ASSERT(f != 0); executed (the execution status of this line is deduced): qt_noop(); | - |
| 2026 | f->request.ignorePitch = (bits & 0x01) != 0; executed (the execution status of this line is deduced): f->request.ignorePitch = (bits & 0x01) != 0; | - |
| 2027 | f->letterSpacingIsAbsolute = (bits & 0x02) != 0; executed (the execution status of this line is deduced): f->letterSpacingIsAbsolute = (bits & 0x02) != 0; | - |
| 2028 | } executed: }Execution Count:88 | 88 |
| 2029 | #endif | - |
| 2030 | | - |
| 2031 | | - |
| 2032 | /*! | - |
| 2033 | Returns the font's key, a textual representation of a font. It is | - |
| 2034 | typically used as the key for a cache or dictionary of fonts. | - |
| 2035 | | - |
| 2036 | \sa QMap | - |
| 2037 | */ | - |
| 2038 | QString QFont::key() const | - |
| 2039 | { | - |
| 2040 | return toString(); never executed: return toString(); | 0 |
| 2041 | } | - |
| 2042 | | - |
| 2043 | /*! | - |
| 2044 | Returns a description of the font. The description is a | - |
| 2045 | comma-separated list of the attributes, perfectly suited for use | - |
| 2046 | in QSettings. | - |
| 2047 | | - |
| 2048 | \sa fromString() | - |
| 2049 | */ | - |
| 2050 | QString QFont::toString() const | - |
| 2051 | { | - |
| 2052 | const QChar comma(QLatin1Char(',')); executed (the execution status of this line is deduced): const QChar comma(QLatin1Char(',')); | - |
| 2053 | return family() + comma + 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 |
| 2054 | QString::number( pointSizeF()) + comma + 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 |
| 2055 | QString::number( pixelSize()) + comma + 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 |
| 2056 | QString::number((int) styleHint()) + comma + 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 |
| 2057 | QString::number( weight()) + comma + 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 |
| 2058 | QString::number((int) style()) + comma + 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 |
| 2059 | QString::number((int) underline()) + comma + 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 |
| 2060 | QString::number((int) strikeOut()) + comma + 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 |
| 2061 | QString::number((int)fixedPitch()) + comma + 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 |
| 2062 | 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 |
| 2063 | } | - |
| 2064 | | - |
| 2065 | | - |
| 2066 | /*! | - |
| 2067 | Sets this font to match the description \a descrip. The description | - |
| 2068 | is a comma-separated list of the font attributes, as returned by | - |
| 2069 | toString(). | - |
| 2070 | | - |
| 2071 | \sa toString() | - |
| 2072 | */ | - |
| 2073 | bool QFont::fromString(const QString &descrip) | - |
| 2074 | { | - |
| 2075 | QStringList l(descrip.split(QLatin1Char(','))); executed (the execution status of this line is deduced): QStringList l(descrip.split(QLatin1Char(','))); | - |
| 2076 | | - |
| 2077 | int count = l.count(); executed (the execution status of this line is deduced): int count = l.count(); | - |
| 2078 | 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 |
| 2079 | qWarning("QFont::fromString: Invalid description '%s'", never executed (the execution status of this line is deduced): QMessageLogger("text/qfont.cpp", 2079, __PRETTY_FUNCTION__).warning("QFont::fromString: Invalid description '%s'", | - |
| 2080 | descrip.isEmpty() ? "(empty)" : descrip.toLatin1().data()); never executed (the execution status of this line is deduced): descrip.isEmpty() ? "(empty)" : descrip.toLatin1().data()); | - |
| 2081 | return false; never executed: return false; | 0 |
| 2082 | } | - |
| 2083 | | - |
| 2084 | setFamily(l[0]); executed (the execution status of this line is deduced): setFamily(l[0]); | - |
| 2085 | 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 |
| 2086 | setPointSizeF(l[1].toDouble()); executed: setPointSizeF(l[1].toDouble());Execution Count:1 | 1 |
| 2087 | if (count == 9) { partially evaluated: count == 9| no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
| 2088 | setStyleHint((StyleHint) l[2].toInt()); never executed (the execution status of this line is deduced): setStyleHint((StyleHint) l[2].toInt()); | - |
| 2089 | setWeight(qMax(qMin(99, l[3].toInt()), 0)); never executed (the execution status of this line is deduced): setWeight(qMax(qMin(99, l[3].toInt()), 0)); | - |
| 2090 | setItalic(l[4].toInt()); never executed (the execution status of this line is deduced): setItalic(l[4].toInt()); | - |
| 2091 | setUnderline(l[5].toInt()); never executed (the execution status of this line is deduced): setUnderline(l[5].toInt()); | - |
| 2092 | setStrikeOut(l[6].toInt()); never executed (the execution status of this line is deduced): setStrikeOut(l[6].toInt()); | - |
| 2093 | setFixedPitch(l[7].toInt()); never executed (the execution status of this line is deduced): setFixedPitch(l[7].toInt()); | - |
| 2094 | setRawMode(l[8].toInt()); never executed (the execution status of this line is deduced): setRawMode(l[8].toInt()); | - |
| 2095 | } else if (count == 10) { never executed: } partially evaluated: count == 10| yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
| 2096 | if (l[2].toInt() > 0) partially evaluated: l[2].toInt() > 0| no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
| 2097 | setPixelSize(l[2].toInt()); never executed: setPixelSize(l[2].toInt()); | 0 |
| 2098 | setStyleHint((StyleHint) l[3].toInt()); executed (the execution status of this line is deduced): setStyleHint((StyleHint) l[3].toInt()); | - |
| 2099 | setWeight(qMax(qMin(99, l[4].toInt()), 0)); executed (the execution status of this line is deduced): setWeight(qMax(qMin(99, l[4].toInt()), 0)); | - |
| 2100 | setStyle((QFont::Style)l[5].toInt()); executed (the execution status of this line is deduced): setStyle((QFont::Style)l[5].toInt()); | - |
| 2101 | setUnderline(l[6].toInt()); executed (the execution status of this line is deduced): setUnderline(l[6].toInt()); | - |
| 2102 | setStrikeOut(l[7].toInt()); executed (the execution status of this line is deduced): setStrikeOut(l[7].toInt()); | - |
| 2103 | setFixedPitch(l[8].toInt()); executed (the execution status of this line is deduced): setFixedPitch(l[8].toInt()); | - |
| 2104 | setRawMode(l[9].toInt()); executed (the execution status of this line is deduced): setRawMode(l[9].toInt()); | - |
| 2105 | } executed: }Execution Count:1 | 1 |
| 2106 | if (count >= 9 && !d->request.fixedPitch) // assume 'false' fixedPitch equals default 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 |
| 2107 | d->request.ignorePitch = true; executed: d->request.ignorePitch = true;Execution Count:1 | 1 |
| 2108 | | - |
| 2109 | return true; executed: return true;Execution Count:1 | 1 |
| 2110 | } | - |
| 2111 | | - |
| 2112 | /*! \internal | - |
| 2113 | | - |
| 2114 | Internal function that dumps font cache statistics. | - |
| 2115 | */ | - |
| 2116 | void QFont::cacheStatistics() | - |
| 2117 | { | - |
| 2118 | | - |
| 2119 | | - |
| 2120 | } | - |
| 2121 | | - |
| 2122 | | - |
| 2123 | | - |
| 2124 | /***************************************************************************** | - |
| 2125 | QFont stream functions | - |
| 2126 | *****************************************************************************/ | - |
| 2127 | #ifndef QT_NO_DATASTREAM | - |
| 2128 | | - |
| 2129 | /*! | - |
| 2130 | \relates QFont | - |
| 2131 | | - |
| 2132 | Writes the font \a font to the data stream \a s. (toString() | - |
| 2133 | writes to a text stream.) | - |
| 2134 | | - |
| 2135 | \sa{Serializing Qt Data Types}{Format of the QDataStream operators} | - |
| 2136 | */ | - |
| 2137 | QDataStream &operator<<(QDataStream &s, const QFont &font) | - |
| 2138 | { | - |
| 2139 | if (s.version() == 1) { partially evaluated: s.version() == 1| no Evaluation Count:0 | yes Evaluation Count:88 |
| 0-88 |
| 2140 | s << font.d->request.family.toLatin1(); never executed (the execution status of this line is deduced): s << font.d->request.family.toLatin1(); | - |
| 2141 | } else { | 0 |
| 2142 | s << font.d->request.family; executed (the execution status of this line is deduced): s << font.d->request.family; | - |
| 2143 | } executed: }Execution Count:88 | 88 |
| 2144 | | - |
| 2145 | 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 |
| 2146 | // 4.0 | - |
| 2147 | double pointSize = font.d->request.pointSize; executed (the execution status of this line is deduced): double pointSize = font.d->request.pointSize; | - |
| 2148 | qint32 pixelSize = font.d->request.pixelSize; executed (the execution status of this line is deduced): qint32 pixelSize = font.d->request.pixelSize; | - |
| 2149 | s << pointSize; executed (the execution status of this line is deduced): s << pointSize; | - |
| 2150 | s << pixelSize; executed (the execution status of this line is deduced): s << pixelSize; | - |
| 2151 | } else if (s.version() <= 3) { executed: }Execution Count:88 never evaluated: s.version() <= 3 | 0-88 |
| 2152 | qint16 pointSize = (qint16) (font.d->request.pointSize * 10); never executed (the execution status of this line is deduced): qint16 pointSize = (qint16) (font.d->request.pointSize * 10); | - |
| 2153 | if (pointSize < 0) { never evaluated: pointSize < 0 | 0 |
| 2154 | pointSize = (qint16)QFontInfo(font).pointSize() * 10; never executed (the execution status of this line is deduced): pointSize = (qint16)QFontInfo(font).pointSize() * 10; | - |
| 2155 | } | 0 |
| 2156 | s << pointSize; never executed (the execution status of this line is deduced): s << pointSize; | - |
| 2157 | } else { | 0 |
| 2158 | s << (qint16) (font.d->request.pointSize * 10); never executed (the execution status of this line is deduced): s << (qint16) (font.d->request.pointSize * 10); | - |
| 2159 | s << (qint16) font.d->request.pixelSize; never executed (the execution status of this line is deduced): s << (qint16) font.d->request.pixelSize; | - |
| 2160 | } | 0 |
| 2161 | | - |
| 2162 | s << (quint8) font.d->request.styleHint; executed (the execution status of this line is deduced): s << (quint8) font.d->request.styleHint; | - |
| 2163 | 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 |
| 2164 | s << (quint8) font.d->request.styleStrategy; executed: s << (quint8) font.d->request.styleStrategy;Execution Count:88 | 88 |
| 2165 | s << (quint8) 0 executed (the execution status of this line is deduced): s << (quint8) 0 | - |
| 2166 | << (quint8) font.d->request.weight executed (the execution status of this line is deduced): << (quint8) font.d->request.weight | - |
| 2167 | << get_font_bits(s.version(), font.d.data()); executed (the execution status of this line is deduced): << get_font_bits(s.version(), font.d.data()); | - |
| 2168 | 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 |
| 2169 | s << (quint16)font.d->request.stretch; executed: s << (quint16)font.d->request.stretch;Execution Count:88 | 88 |
| 2170 | 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 |
| 2171 | s << get_extended_font_bits(font.d.data()); executed: s << get_extended_font_bits(font.d.data());Execution Count:88 | 88 |
| 2172 | 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 |
| 2173 | s << font.d->letterSpacing.value(); executed (the execution status of this line is deduced): s << font.d->letterSpacing.value(); | - |
| 2174 | s << font.d->wordSpacing.value(); executed (the execution status of this line is deduced): s << font.d->wordSpacing.value(); | - |
| 2175 | } executed: }Execution Count:88 | 88 |
| 2176 | return s; executed: return s;Execution Count:88 | 88 |
| 2177 | } | - |
| 2178 | | - |
| 2179 | | - |
| 2180 | /*! | - |
| 2181 | \relates QFont | - |
| 2182 | | - |
| 2183 | Reads the font \a font from the data stream \a s. (fromString() | - |
| 2184 | reads from a text stream.) | - |
| 2185 | | - |
| 2186 | \sa{Serializing Qt Data Types}{Format of the QDataStream operators} | - |
| 2187 | */ | - |
| 2188 | QDataStream &operator>>(QDataStream &s, QFont &font) | - |
| 2189 | { | - |
| 2190 | font.d = new QFontPrivate; executed (the execution status of this line is deduced): font.d = new QFontPrivate; | - |
| 2191 | font.resolve_mask = QFont::AllPropertiesResolved; executed (the execution status of this line is deduced): font.resolve_mask = QFont::AllPropertiesResolved; | - |
| 2192 | | - |
| 2193 | quint8 styleHint, styleStrategy = QFont::PreferDefault, charSet, weight, bits; executed (the execution status of this line is deduced): quint8 styleHint, styleStrategy = QFont::PreferDefault, charSet, weight, bits; | - |
| 2194 | | - |
| 2195 | if (s.version() == 1) { partially evaluated: s.version() == 1| no Evaluation Count:0 | yes Evaluation Count:88 |
| 0-88 |
| 2196 | QByteArray fam; never executed (the execution status of this line is deduced): QByteArray fam; | - |
| 2197 | s >> fam; never executed (the execution status of this line is deduced): s >> fam; | - |
| 2198 | font.d->request.family = QString::fromLatin1(fam); never executed (the execution status of this line is deduced): font.d->request.family = QString::fromLatin1(fam); | - |
| 2199 | } else { | 0 |
| 2200 | s >> font.d->request.family; executed (the execution status of this line is deduced): s >> font.d->request.family; | - |
| 2201 | } executed: }Execution Count:88 | 88 |
| 2202 | | - |
| 2203 | 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 |
| 2204 | // 4.0 | - |
| 2205 | double pointSize; executed (the execution status of this line is deduced): double pointSize; | - |
| 2206 | qint32 pixelSize; executed (the execution status of this line is deduced): qint32 pixelSize; | - |
| 2207 | s >> pointSize; executed (the execution status of this line is deduced): s >> pointSize; | - |
| 2208 | s >> pixelSize; executed (the execution status of this line is deduced): s >> pixelSize; | - |
| 2209 | font.d->request.pointSize = qreal(pointSize); executed (the execution status of this line is deduced): font.d->request.pointSize = qreal(pointSize); | - |
| 2210 | font.d->request.pixelSize = pixelSize; executed (the execution status of this line is deduced): font.d->request.pixelSize = pixelSize; | - |
| 2211 | } else { executed: }Execution Count:88 | 88 |
| 2212 | qint16 pointSize, pixelSize = -1; never executed (the execution status of this line is deduced): qint16 pointSize, pixelSize = -1; | - |
| 2213 | s >> pointSize; never executed (the execution status of this line is deduced): s >> pointSize; | - |
| 2214 | if (s.version() >= 4) never evaluated: s.version() >= 4 | 0 |
| 2215 | s >> pixelSize; never executed: s >> pixelSize; | 0 |
| 2216 | font.d->request.pointSize = qreal(pointSize / 10.); never executed (the execution status of this line is deduced): font.d->request.pointSize = qreal(pointSize / 10.); | - |
| 2217 | font.d->request.pixelSize = pixelSize; never executed (the execution status of this line is deduced): font.d->request.pixelSize = pixelSize; | - |
| 2218 | } | 0 |
| 2219 | s >> styleHint; executed (the execution status of this line is deduced): s >> styleHint; | - |
| 2220 | 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 |
| 2221 | s >> styleStrategy; executed: s >> styleStrategy;Execution Count:88 | 88 |
| 2222 | | - |
| 2223 | s >> charSet; executed (the execution status of this line is deduced): s >> charSet; | - |
| 2224 | s >> weight; executed (the execution status of this line is deduced): s >> weight; | - |
| 2225 | s >> bits; executed (the execution status of this line is deduced): s >> bits; | - |
| 2226 | | - |
| 2227 | font.d->request.styleHint = styleHint; executed (the execution status of this line is deduced): font.d->request.styleHint = styleHint; | - |
| 2228 | font.d->request.styleStrategy = styleStrategy; executed (the execution status of this line is deduced): font.d->request.styleStrategy = styleStrategy; | - |
| 2229 | font.d->request.weight = weight; executed (the execution status of this line is deduced): font.d->request.weight = weight; | - |
| 2230 | | - |
| 2231 | set_font_bits(s.version(), bits, font.d.data()); executed (the execution status of this line is deduced): set_font_bits(s.version(), bits, font.d.data()); | - |
| 2232 | | - |
| 2233 | 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 |
| 2234 | quint16 stretch; executed (the execution status of this line is deduced): quint16 stretch; | - |
| 2235 | s >> stretch; executed (the execution status of this line is deduced): s >> stretch; | - |
| 2236 | font.d->request.stretch = stretch; executed (the execution status of this line is deduced): font.d->request.stretch = stretch; | - |
| 2237 | } executed: }Execution Count:88 | 88 |
| 2238 | | - |
| 2239 | 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 |
| 2240 | quint8 extendedBits; executed (the execution status of this line is deduced): quint8 extendedBits; | - |
| 2241 | s >> extendedBits; executed (the execution status of this line is deduced): s >> extendedBits; | - |
| 2242 | set_extended_font_bits(extendedBits, font.d.data()); executed (the execution status of this line is deduced): set_extended_font_bits(extendedBits, font.d.data()); | - |
| 2243 | } executed: }Execution Count:88 | 88 |
| 2244 | 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 |
| 2245 | int value; executed (the execution status of this line is deduced): int value; | - |
| 2246 | s >> value; executed (the execution status of this line is deduced): s >> value; | - |
| 2247 | font.d->letterSpacing.setValue(value); executed (the execution status of this line is deduced): font.d->letterSpacing.setValue(value); | - |
| 2248 | s >> value; executed (the execution status of this line is deduced): s >> value; | - |
| 2249 | font.d->wordSpacing.setValue(value); executed (the execution status of this line is deduced): font.d->wordSpacing.setValue(value); | - |
| 2250 | } executed: }Execution Count:88 | 88 |
| 2251 | | - |
| 2252 | return s; executed: return s;Execution Count:88 | 88 |
| 2253 | } | - |
| 2254 | | - |
| 2255 | #endif // QT_NO_DATASTREAM | - |
| 2256 | | - |
| 2257 | | - |
| 2258 | /***************************************************************************** | - |
| 2259 | QFontInfo member functions | - |
| 2260 | *****************************************************************************/ | - |
| 2261 | | - |
| 2262 | /*! | - |
| 2263 | \class QFontInfo | - |
| 2264 | \reentrant | - |
| 2265 | | - |
| 2266 | \brief The QFontInfo class provides general information about fonts. | - |
| 2267 | \inmodule QtGui | - |
| 2268 | | - |
| 2269 | \ingroup appearance | - |
| 2270 | \ingroup shared | - |
| 2271 | | - |
| 2272 | The QFontInfo class provides the same access functions as QFont, | - |
| 2273 | e.g. family(), pointSize(), italic(), weight(), fixedPitch(), | - |
| 2274 | styleHint() etc. But whilst the QFont access functions return the | - |
| 2275 | values that were set, a QFontInfo object returns the values that | - |
| 2276 | apply to the font that will actually be used to draw the text. | - |
| 2277 | | - |
| 2278 | For example, when the program asks for a 25pt Courier font on a | - |
| 2279 | machine that has a non-scalable 24pt Courier font, QFont will | - |
| 2280 | (normally) use the 24pt Courier for rendering. In this case, | - |
| 2281 | QFont::pointSize() returns 25 and QFontInfo::pointSize() returns | - |
| 2282 | 24. | - |
| 2283 | | - |
| 2284 | There are three ways to create a QFontInfo object. | - |
| 2285 | \list 1 | - |
| 2286 | \li Calling the QFontInfo constructor with a QFont creates a font | - |
| 2287 | info object for a screen-compatible font, i.e. the font cannot be | - |
| 2288 | a printer font. If the font is changed later, the font | - |
| 2289 | info object is \e not updated. | - |
| 2290 | | - |
| 2291 | (Note: If you use a printer font the values returned may be | - |
| 2292 | inaccurate. Printer fonts are not always accessible so the nearest | - |
| 2293 | screen font is used if a printer font is supplied.) | - |
| 2294 | | - |
| 2295 | \li QWidget::fontInfo() returns the font info for a widget's font. | - |
| 2296 | This is equivalent to calling QFontInfo(widget->font()). If the | - |
| 2297 | widget's font is changed later, the font info object is \e not | - |
| 2298 | updated. | - |
| 2299 | | - |
| 2300 | \li QPainter::fontInfo() returns the font info for a painter's | - |
| 2301 | current font. If the painter's font is changed later, the font | - |
| 2302 | info object is \e not updated. | - |
| 2303 | \endlist | - |
| 2304 | | - |
| 2305 | \sa QFont, QFontMetrics, QFontDatabase | - |
| 2306 | */ | - |
| 2307 | | - |
| 2308 | /*! | - |
| 2309 | Constructs a font info object for \a font. | - |
| 2310 | | - |
| 2311 | The font must be screen-compatible, i.e. a font you use when | - |
| 2312 | drawing text in \l{QWidget}{widgets} or \l{QPixmap}{pixmaps}, not QPicture or QPrinter. | - |
| 2313 | | - |
| 2314 | The font info object holds the information for the font that is | - |
| 2315 | passed in the constructor at the time it is created, and is not | - |
| 2316 | updated if the font's attributes are changed later. | - |
| 2317 | | - |
| 2318 | Use QPainter::fontInfo() to get the font info when painting. | - |
| 2319 | This will give correct results also when painting on paint device | - |
| 2320 | that is not screen-compatible. | - |
| 2321 | */ | - |
| 2322 | QFontInfo::QFontInfo(const QFont &font) | - |
| 2323 | : d(font.d.data()) | - |
| 2324 | { | - |
| 2325 | } executed: }Execution Count:483 | 483 |
| 2326 | | - |
| 2327 | /*! | - |
| 2328 | Constructs a copy of \a fi. | - |
| 2329 | */ | - |
| 2330 | QFontInfo::QFontInfo(const QFontInfo &fi) | - |
| 2331 | : d(fi.d.data()) | - |
| 2332 | { | - |
| 2333 | } | 0 |
| 2334 | | - |
| 2335 | /*! | - |
| 2336 | Destroys the font info object. | - |
| 2337 | */ | - |
| 2338 | QFontInfo::~QFontInfo() | - |
| 2339 | { | - |
| 2340 | } | - |
| 2341 | | - |
| 2342 | /*! | - |
| 2343 | Assigns the font info in \a fi. | - |
| 2344 | */ | - |
| 2345 | QFontInfo &QFontInfo::operator=(const QFontInfo &fi) | - |
| 2346 | { | - |
| 2347 | d = fi.d.data(); never executed (the execution status of this line is deduced): d = fi.d.data(); | - |
| 2348 | return *this; never executed: return *this; | 0 |
| 2349 | } | - |
| 2350 | | - |
| 2351 | /*! | - |
| 2352 | \fn void QFontInfo::swap(QFontInfo &other) | - |
| 2353 | \since 5.0 | - |
| 2354 | | - |
| 2355 | Swaps this font info instance with \a other. This function is very | - |
| 2356 | fast and never fails. | - |
| 2357 | */ | - |
| 2358 | | - |
| 2359 | /*! | - |
| 2360 | Returns the family name of the matched window system font. | - |
| 2361 | | - |
| 2362 | \sa QFont::family() | - |
| 2363 | */ | - |
| 2364 | QString QFontInfo::family() const | - |
| 2365 | { | - |
| 2366 | QFontEngine *engine = d->engineForScript(QUnicodeTables::Common); executed (the execution status of this line is deduced): QFontEngine *engine = d->engineForScript(QUnicodeTables::Common); | - |
| 2367 | Q_ASSERT(engine != 0); executed (the execution status of this line is deduced): qt_noop(); | - |
| 2368 | return engine->fontDef.family; executed: return engine->fontDef.family;Execution Count:44367 | 44367 |
| 2369 | } | - |
| 2370 | | - |
| 2371 | /*! | - |
| 2372 | \since 4.8 | - |
| 2373 | | - |
| 2374 | Returns the style name of the matched window system font on | - |
| 2375 | system that supports it. | - |
| 2376 | | - |
| 2377 | \sa QFont::styleName() | - |
| 2378 | */ | - |
| 2379 | QString QFontInfo::styleName() const | - |
| 2380 | { | - |
| 2381 | QFontEngine *engine = d->engineForScript(QUnicodeTables::Common); never executed (the execution status of this line is deduced): QFontEngine *engine = d->engineForScript(QUnicodeTables::Common); | - |
| 2382 | Q_ASSERT(engine != 0); never executed (the execution status of this line is deduced): qt_noop(); | - |
| 2383 | return engine->fontDef.styleName; never executed: return engine->fontDef.styleName; | 0 |
| 2384 | } | - |
| 2385 | | - |
| 2386 | /*! | - |
| 2387 | Returns the point size of the matched window system font. | - |
| 2388 | | - |
| 2389 | \sa pointSizeF(), QFont::pointSize() | - |
| 2390 | */ | - |
| 2391 | int QFontInfo::pointSize() const | - |
| 2392 | { | - |
| 2393 | QFontEngine *engine = d->engineForScript(QUnicodeTables::Common); executed (the execution status of this line is deduced): QFontEngine *engine = d->engineForScript(QUnicodeTables::Common); | - |
| 2394 | Q_ASSERT(engine != 0); executed (the execution status of this line is deduced): qt_noop(); | - |
| 2395 | return qRound(engine->fontDef.pointSize); executed: return qRound(engine->fontDef.pointSize);Execution Count:3 | 3 |
| 2396 | } | - |
| 2397 | | - |
| 2398 | /*! | - |
| 2399 | Returns the point size of the matched window system font. | - |
| 2400 | | - |
| 2401 | \sa QFont::pointSizeF() | - |
| 2402 | */ | - |
| 2403 | qreal QFontInfo::pointSizeF() const | - |
| 2404 | { | - |
| 2405 | QFontEngine *engine = d->engineForScript(QUnicodeTables::Common); never executed (the execution status of this line is deduced): QFontEngine *engine = d->engineForScript(QUnicodeTables::Common); | - |
| 2406 | Q_ASSERT(engine != 0); never executed (the execution status of this line is deduced): qt_noop(); | - |
| 2407 | return engine->fontDef.pointSize; never executed: return engine->fontDef.pointSize; | 0 |
| 2408 | } | - |
| 2409 | | - |
| 2410 | /*! | - |
| 2411 | Returns the pixel size of the matched window system font. | - |
| 2412 | | - |
| 2413 | \sa QFont::pointSize() | - |
| 2414 | */ | - |
| 2415 | int QFontInfo::pixelSize() const | - |
| 2416 | { | - |
| 2417 | QFontEngine *engine = d->engineForScript(QUnicodeTables::Common); executed (the execution status of this line is deduced): QFontEngine *engine = d->engineForScript(QUnicodeTables::Common); | - |
| 2418 | Q_ASSERT(engine != 0); executed (the execution status of this line is deduced): qt_noop(); | - |
| 2419 | return engine->fontDef.pixelSize; executed: return engine->fontDef.pixelSize;Execution Count:1 | 1 |
| 2420 | } | - |
| 2421 | | - |
| 2422 | /*! | - |
| 2423 | Returns the italic value of the matched window system font. | - |
| 2424 | | - |
| 2425 | \sa QFont::italic() | - |
| 2426 | */ | - |
| 2427 | bool QFontInfo::italic() const | - |
| 2428 | { | - |
| 2429 | QFontEngine *engine = d->engineForScript(QUnicodeTables::Common); never executed (the execution status of this line is deduced): QFontEngine *engine = d->engineForScript(QUnicodeTables::Common); | - |
| 2430 | Q_ASSERT(engine != 0); never executed (the execution status of this line is deduced): qt_noop(); | - |
| 2431 | return engine->fontDef.style != QFont::StyleNormal; never executed: return engine->fontDef.style != QFont::StyleNormal; | 0 |
| 2432 | } | - |
| 2433 | | - |
| 2434 | /*! | - |
| 2435 | Returns the style value of the matched window system font. | - |
| 2436 | | - |
| 2437 | \sa QFont::style() | - |
| 2438 | */ | - |
| 2439 | QFont::Style QFontInfo::style() const | - |
| 2440 | { | - |
| 2441 | QFontEngine *engine = d->engineForScript(QUnicodeTables::Common); never executed (the execution status of this line is deduced): QFontEngine *engine = d->engineForScript(QUnicodeTables::Common); | - |
| 2442 | Q_ASSERT(engine != 0); never executed (the execution status of this line is deduced): qt_noop(); | - |
| 2443 | return (QFont::Style)engine->fontDef.style; never executed: return (QFont::Style)engine->fontDef.style; | 0 |
| 2444 | } | - |
| 2445 | | - |
| 2446 | /*! | - |
| 2447 | Returns the weight of the matched window system font. | - |
| 2448 | | - |
| 2449 | \sa QFont::weight(), bold() | - |
| 2450 | */ | - |
| 2451 | int QFontInfo::weight() const | - |
| 2452 | { | - |
| 2453 | QFontEngine *engine = d->engineForScript(QUnicodeTables::Common); never executed (the execution status of this line is deduced): QFontEngine *engine = d->engineForScript(QUnicodeTables::Common); | - |
| 2454 | Q_ASSERT(engine != 0); never executed (the execution status of this line is deduced): qt_noop(); | - |
| 2455 | return engine->fontDef.weight; never executed: return engine->fontDef.weight; | 0 |
| 2456 | | - |
| 2457 | } | - |
| 2458 | | - |
| 2459 | /*! | - |
| 2460 | \fn bool QFontInfo::bold() const | - |
| 2461 | | - |
| 2462 | Returns true if weight() would return a value greater than | - |
| 2463 | QFont::Normal; otherwise returns false. | - |
| 2464 | | - |
| 2465 | \sa weight(), QFont::bold() | - |
| 2466 | */ | - |
| 2467 | | - |
| 2468 | /*! | - |
| 2469 | Returns the underline value of the matched window system font. | - |
| 2470 | | - |
| 2471 | \sa QFont::underline() | - |
| 2472 | | - |
| 2473 | \internal | - |
| 2474 | | - |
| 2475 | Here we read the underline flag directly from the QFont. | - |
| 2476 | This is OK for X11 and for Windows because we always get what we want. | - |
| 2477 | */ | - |
| 2478 | bool QFontInfo::underline() const | - |
| 2479 | { | - |
| 2480 | return d->underline; never executed: return d->underline; | 0 |
| 2481 | } | - |
| 2482 | | - |
| 2483 | /*! | - |
| 2484 | Returns the overline value of the matched window system font. | - |
| 2485 | | - |
| 2486 | \sa QFont::overline() | - |
| 2487 | | - |
| 2488 | \internal | - |
| 2489 | | - |
| 2490 | Here we read the overline flag directly from the QFont. | - |
| 2491 | This is OK for X11 and for Windows because we always get what we want. | - |
| 2492 | */ | - |
| 2493 | bool QFontInfo::overline() const | - |
| 2494 | { | - |
| 2495 | return d->overline; never executed: return d->overline; | 0 |
| 2496 | } | - |
| 2497 | | - |
| 2498 | /*! | - |
| 2499 | Returns the strikeout value of the matched window system font. | - |
| 2500 | | - |
| 2501 | \sa QFont::strikeOut() | - |
| 2502 | | - |
| 2503 | \internal Here we read the strikeOut flag directly from the QFont. | - |
| 2504 | This is OK for X11 and for Windows because we always get what we want. | - |
| 2505 | */ | - |
| 2506 | bool QFontInfo::strikeOut() const | - |
| 2507 | { | - |
| 2508 | return d->strikeOut; never executed: return d->strikeOut; | 0 |
| 2509 | } | - |
| 2510 | | - |
| 2511 | /*! | - |
| 2512 | Returns the fixed pitch value of the matched window system font. | - |
| 2513 | | - |
| 2514 | \sa QFont::fixedPitch() | - |
| 2515 | */ | - |
| 2516 | bool QFontInfo::fixedPitch() const | - |
| 2517 | { | - |
| 2518 | QFontEngine *engine = d->engineForScript(QUnicodeTables::Common); executed (the execution status of this line is deduced): QFontEngine *engine = d->engineForScript(QUnicodeTables::Common); | - |
| 2519 | Q_ASSERT(engine != 0); executed (the execution status of this line is deduced): qt_noop(); | - |
| 2520 | #ifdef Q_OS_MAC | - |
| 2521 | if (!engine->fontDef.fixedPitchComputed) { | - |
| 2522 | QChar ch[2] = { QLatin1Char('i'), QLatin1Char('m') }; | - |
| 2523 | QGlyphLayoutArray<2> g; | - |
| 2524 | int l = 2; | - |
| 2525 | engine->stringToCMap(ch, 2, &g, &l, 0); | - |
| 2526 | engine->fontDef.fixedPitch = g.advances_x[0] == g.advances_x[1]; | - |
| 2527 | engine->fontDef.fixedPitchComputed = true; | - |
| 2528 | } | - |
| 2529 | #endif | - |
| 2530 | return engine->fontDef.fixedPitch; executed: return engine->fontDef.fixedPitch;Execution Count:2 | 2 |
| 2531 | } | - |
| 2532 | | - |
| 2533 | /*! | - |
| 2534 | Returns the style of the matched window system font. | - |
| 2535 | | - |
| 2536 | Currently only returns the style hint set in QFont. | - |
| 2537 | | - |
| 2538 | \sa QFont::styleHint(), QFont::StyleHint | - |
| 2539 | */ | - |
| 2540 | QFont::StyleHint QFontInfo::styleHint() const | - |
| 2541 | { | - |
| 2542 | QFontEngine *engine = d->engineForScript(QUnicodeTables::Common); never executed (the execution status of this line is deduced): QFontEngine *engine = d->engineForScript(QUnicodeTables::Common); | - |
| 2543 | Q_ASSERT(engine != 0); never executed (the execution status of this line is deduced): qt_noop(); | - |
| 2544 | return (QFont::StyleHint) engine->fontDef.styleHint; never executed: return (QFont::StyleHint) engine->fontDef.styleHint; | 0 |
| 2545 | } | - |
| 2546 | | - |
| 2547 | /*! | - |
| 2548 | Returns true if the font is a raw mode font; otherwise returns | - |
| 2549 | false. | - |
| 2550 | | - |
| 2551 | If it is a raw mode font, all other functions in QFontInfo will | - |
| 2552 | return the same values set in the QFont, regardless of the font | - |
| 2553 | actually used. | - |
| 2554 | | - |
| 2555 | \sa QFont::rawMode() | - |
| 2556 | */ | - |
| 2557 | bool QFontInfo::rawMode() const | - |
| 2558 | { | - |
| 2559 | return d->rawMode; never executed: return d->rawMode; | 0 |
| 2560 | } | - |
| 2561 | | - |
| 2562 | /*! | - |
| 2563 | Returns true if the matched window system font is exactly the same | - |
| 2564 | as the one specified by the font; otherwise returns false. | - |
| 2565 | | - |
| 2566 | \sa QFont::exactMatch() | - |
| 2567 | */ | - |
| 2568 | bool QFontInfo::exactMatch() const | - |
| 2569 | { | - |
| 2570 | QFontEngine *engine = d->engineForScript(QUnicodeTables::Common); executed (the execution status of this line is deduced): QFontEngine *engine = d->engineForScript(QUnicodeTables::Common); | - |
| 2571 | Q_ASSERT(engine != 0); executed (the execution status of this line is deduced): qt_noop(); | - |
| 2572 | return (d->rawMode executed: return (d->rawMode ? engine->type() != QFontEngine::Box : d->request.exactMatch(engine->fontDef));Execution Count:5 | 5 |
| 2573 | ? engine->type() != QFontEngine::Box executed: return (d->rawMode ? engine->type() != QFontEngine::Box : d->request.exactMatch(engine->fontDef));Execution Count:5 | 5 |
| 2574 | : d->request.exactMatch(engine->fontDef)); executed: return (d->rawMode ? engine->type() != QFontEngine::Box : d->request.exactMatch(engine->fontDef));Execution Count:5 | 5 |
| 2575 | } | - |
| 2576 | | - |
| 2577 | | - |
| 2578 | | - |
| 2579 | | - |
| 2580 | // ********************************************************************** | - |
| 2581 | // QFontCache | - |
| 2582 | // ********************************************************************** | - |
| 2583 | | - |
| 2584 | #ifdef QFONTCACHE_DEBUG | - |
| 2585 | // fast timeouts for debugging | - |
| 2586 | static const int fast_timeout = 1000; // 1s | - |
| 2587 | static const int slow_timeout = 5000; // 5s | - |
| 2588 | #else | - |
| 2589 | static const int fast_timeout = 10000; // 10s | - |
| 2590 | static const int slow_timeout = 300000; // 5m | - |
| 2591 | #endif // QFONTCACHE_DEBUG | - |
| 2592 | | - |
| 2593 | const uint QFontCache::min_cost = 4*1024; // 4mb | - |
| 2594 | | - |
| 2595 | #ifdef QT_NO_THREAD | - |
| 2596 | Q_GLOBAL_STATIC(QFontCache, theFontCache) | - |
| 2597 | | - |
| 2598 | QFontCache *QFontCache::instance() | - |
| 2599 | { | - |
| 2600 | return theFontCache(); | - |
| 2601 | } | - |
| 2602 | | - |
| 2603 | void QFontCache::cleanup() | - |
| 2604 | { | - |
| 2605 | } | - |
| 2606 | #else | - |
| 2607 | Q_GLOBAL_STATIC(QThreadStorage<QFontCache *>, theFontCache) 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 |
| 2608 | | - |
| 2609 | QFontCache *QFontCache::instance() | - |
| 2610 | { | - |
| 2611 | QFontCache *&fontCache = theFontCache()->localData(); executed (the execution status of this line is deduced): QFontCache *&fontCache = theFontCache()->localData(); | - |
| 2612 | if (!fontCache) evaluated: !fontCache| yes Evaluation Count:110 | yes Evaluation Count:386800 |
| 110-386800 |
| 2613 | fontCache = new QFontCache; executed: fontCache = new QFontCache;Execution Count:110 | 110 |
| 2614 | return fontCache; executed: return fontCache;Execution Count:386910 | 386910 |
| 2615 | } | - |
| 2616 | | - |
| 2617 | void QFontCache::cleanup() | - |
| 2618 | { | - |
| 2619 | QThreadStorage<QFontCache *> *cache = 0; executed (the execution status of this line is deduced): QThreadStorage<QFontCache *> *cache = 0; | - |
| 2620 | QT_TRY { partially evaluated: true| yes Evaluation Count:287 | no Evaluation Count:0 |
| 0-287 |
| 2621 | cache = theFontCache(); executed (the execution status of this line is deduced): cache = theFontCache(); | - |
| 2622 | } QT_CATCH (const std::bad_alloc &) { executed: }Execution Count:287 | 287 |
| 2623 | // no cache - just ignore | - |
| 2624 | } | 0 |
| 2625 | 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 |
| 2626 | cache->setLocalData(0); executed: cache->setLocalData(0);Execution Count:109 | 109 |
| 2627 | } executed: }Execution Count:287 | 287 |
| 2628 | #endif // QT_NO_THREAD | - |
| 2629 | | - |
| 2630 | QFontCache::QFontCache() | - |
| 2631 | : QObject(), total_cost(0), max_cost(min_cost), | - |
| 2632 | current_timestamp(0), fast(false), timer_id(-1) | - |
| 2633 | { | - |
| 2634 | } executed: }Execution Count:110 | 110 |
| 2635 | | - |
| 2636 | QFontCache::~QFontCache() | - |
| 2637 | { | - |
| 2638 | clear(); executed (the execution status of this line is deduced): clear(); | - |
| 2639 | { | - |
| 2640 | EngineDataCache::ConstIterator it = engineDataCache.constBegin(), executed (the execution status of this line is deduced): EngineDataCache::ConstIterator it = engineDataCache.constBegin(), | - |
| 2641 | end = engineDataCache.constEnd(); executed (the execution status of this line is deduced): end = engineDataCache.constEnd(); | - |
| 2642 | while (it != end) { evaluated: it != end| yes Evaluation Count:610 | yes Evaluation Count:110 |
| 110-610 |
| 2643 | if (it.value()->ref.load() == 0) evaluated: it.value()->ref.load() == 0| yes Evaluation Count:510 | yes Evaluation Count:100 |
| 100-510 |
| 2644 | delete it.value(); executed: delete it.value();Execution Count:510 | 510 |
| 2645 | else | - |
| 2646 | FC_DEBUG("QFontCache::~QFontCache: engineData %p still has refcount %d", never executed: QMessageLogger("text/qfont.cpp", 2646, __PRETTY_FUNCTION__).debug("QFontCache::~QFontCache: engineData %p still has refcount %d", it.value(), it.value()->ref.load()); partially evaluated: false| no Evaluation Count:0 | yes Evaluation Count:100 |
| 0-100 |
| 2647 | 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 |
| 2648 | ++it; executed (the execution status of this line is deduced): ++it; | - |
| 2649 | } executed: }Execution Count:610 | 610 |
| 2650 | } | - |
| 2651 | EngineCache::ConstIterator it = engineCache.constBegin(), executed (the execution status of this line is deduced): EngineCache::ConstIterator it = engineCache.constBegin(), | - |
| 2652 | end = engineCache.constEnd(); executed (the execution status of this line is deduced): end = engineCache.constEnd(); | - |
| 2653 | while (it != end) { partially evaluated: it != end| no Evaluation Count:0 | yes Evaluation Count:110 |
| 0-110 |
| 2654 | if (--it.value().data->cache_count == 0) { never evaluated: --it.value().data->cache_count == 0 | 0 |
| 2655 | if (it.value().data->ref.load() == 0) { never evaluated: it.value().data->ref.load() == 0 | 0 |
| 2656 | FC_DEBUG("QFontCache::~QFontCache: deleting engine %p key=(%d / %g %g %d %d %d)", 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); never evaluated: false | 0 |
| 2657 | it.value().data, it.key().script, it.key().def.pointSize, 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 |
| 2658 | it.key().def.pixelSize, it.key().def.weight, it.key().def.style, 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 |
| 2659 | 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 |
| 2660 | | - |
| 2661 | delete it.value().data; never executed (the execution status of this line is deduced): delete it.value().data; | - |
| 2662 | } else { | 0 |
| 2663 | FC_DEBUG("QFontCache::~QFontCache: engine = %p still has refcount %d", 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()); never evaluated: false | 0 |
| 2664 | 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 |
| 2665 | } | 0 |
| 2666 | } | - |
| 2667 | ++it; never executed (the execution status of this line is deduced): ++it; | - |
| 2668 | } | 0 |
| 2669 | } executed: }Execution Count:110 | 110 |
| 2670 | | - |
| 2671 | void QFontCache::clear() | - |
| 2672 | { | - |
| 2673 | { | - |
| 2674 | EngineDataCache::Iterator it = engineDataCache.begin(), executed (the execution status of this line is deduced): EngineDataCache::Iterator it = engineDataCache.begin(), | - |
| 2675 | end = engineDataCache.end(); executed (the execution status of this line is deduced): end = engineDataCache.end(); | - |
| 2676 | while (it != end) { evaluated: it != end| yes Evaluation Count:1278 | yes Evaluation Count:152 |
| 152-1278 |
| 2677 | QFontEngineData *data = it.value(); executed (the execution status of this line is deduced): QFontEngineData *data = it.value(); | - |
| 2678 | for (int i = 0; i < QUnicodeTables::ScriptCount; ++i) { evaluated: i < QUnicodeTables::ScriptCount| yes Evaluation Count:35784 | yes Evaluation Count:1278 |
| 1278-35784 |
| 2679 | if (data->engines[i]) { evaluated: data->engines[i]| yes Evaluation Count:1285 | yes Evaluation Count:34499 |
| 1285-34499 |
| 2680 | data->engines[i]->ref.deref(); executed (the execution status of this line is deduced): data->engines[i]->ref.deref(); | - |
| 2681 | data->engines[i] = 0; executed (the execution status of this line is deduced): data->engines[i] = 0; | - |
| 2682 | } executed: }Execution Count:1285 | 1285 |
| 2683 | } executed: }Execution Count:35784 | 35784 |
| 2684 | ++it; executed (the execution status of this line is deduced): ++it; | - |
| 2685 | } executed: }Execution Count:1278 | 1278 |
| 2686 | } | - |
| 2687 | | - |
| 2688 | for (EngineCache::Iterator it = engineCache.begin(), end = engineCache.end(); executed (the execution status of this line is deduced): for (EngineCache::Iterator it = engineCache.begin(), end = engineCache.end(); | - |
| 2689 | it != end; ++it) { evaluated: it != end| yes Evaluation Count:1226 | yes Evaluation Count:152 |
| 152-1226 |
| 2690 | if (it->data->ref.load() == 0) { evaluated: it->data->ref.load() == 0| yes Evaluation Count:614 | yes Evaluation Count:612 |
| 612-614 |
| 2691 | delete it->data; executed (the execution status of this line is deduced): delete it->data; | - |
| 2692 | it->data = 0; executed (the execution status of this line is deduced): it->data = 0; | - |
| 2693 | } executed: }Execution Count:614 | 614 |
| 2694 | } executed: }Execution Count:1226 | 1226 |
| 2695 | | - |
| 2696 | for (EngineCache::Iterator it = engineCache.begin(), end = engineCache.end(); executed (the execution status of this line is deduced): for (EngineCache::Iterator it = engineCache.begin(), end = engineCache.end(); | - |
| 2697 | it != end; ++it) { evaluated: it != end| yes Evaluation Count:1226 | yes Evaluation Count:152 |
| 152-1226 |
| 2698 | 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 |
| 2699 | delete it->data; executed (the execution status of this line is deduced): delete it->data; | - |
| 2700 | it->data = 0; executed (the execution status of this line is deduced): it->data = 0; | - |
| 2701 | } executed: }Execution Count:580 | 580 |
| 2702 | } executed: }Execution Count:1226 | 1226 |
| 2703 | | - |
| 2704 | engineCache.clear(); executed (the execution status of this line is deduced): engineCache.clear(); | - |
| 2705 | } executed: }Execution Count:152 | 152 |
| 2706 | | - |
| 2707 | | - |
| 2708 | QFontEngineData *QFontCache::findEngineData(const QFontDef &def) const | - |
| 2709 | { | - |
| 2710 | EngineDataCache::ConstIterator it = engineDataCache.constFind(def); executed (the execution status of this line is deduced): EngineDataCache::ConstIterator it = engineDataCache.constFind(def); | - |
| 2711 | if (it == engineDataCache.constEnd()) evaluated: it == engineDataCache.constEnd()| yes Evaluation Count:610 | yes Evaluation Count:29300 |
| 610-29300 |
| 2712 | return 0; executed: return 0;Execution Count:610 | 610 |
| 2713 | | - |
| 2714 | // found | - |
| 2715 | return it.value(); executed: return it.value();Execution Count:29300 | 29300 |
| 2716 | } | - |
| 2717 | | - |
| 2718 | void QFontCache::insertEngineData(const QFontDef &def, QFontEngineData *engineData) | - |
| 2719 | { | - |
| 2720 | FC_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 |
| 2721 | | - |
| 2722 | engineDataCache.insert(def, engineData); executed (the execution status of this line is deduced): engineDataCache.insert(def, engineData); | - |
| 2723 | increaseCost(sizeof(QFontEngineData)); executed (the execution status of this line is deduced): increaseCost(sizeof(QFontEngineData)); | - |
| 2724 | } executed: }Execution Count:610 | 610 |
| 2725 | | - |
| 2726 | QFontEngine *QFontCache::findEngine(const Key &key) | - |
| 2727 | { | - |
| 2728 | EngineCache::Iterator it = engineCache.find(key), executed (the execution status of this line is deduced): EngineCache::Iterator it = engineCache.find(key), | - |
| 2729 | end = engineCache.end(); executed (the execution status of this line is deduced): end = engineCache.end(); | - |
| 2730 | if (it == end) return 0; executed: return 0;Execution Count:2572 evaluated: it == end| yes Evaluation Count:2572 | yes Evaluation Count:18 |
| 18-2572 |
| 2731 | // found... update the hitcount and timestamp | - |
| 2732 | updateHitCountAndTimeStamp(it.value()); executed (the execution status of this line is deduced): updateHitCountAndTimeStamp(it.value()); | - |
| 2733 | | - |
| 2734 | return it.value().data; executed: return it.value().data;Execution Count:18 | 18 |
| 2735 | } | - |
| 2736 | | - |
| 2737 | void QFontCache::updateHitCountAndTimeStamp(Engine &value) | - |
| 2738 | { | - |
| 2739 | value.hits++; executed (the execution status of this line is deduced): value.hits++; | - |
| 2740 | value.timestamp = ++current_timestamp; executed (the execution status of this line is deduced): value.timestamp = ++current_timestamp; | - |
| 2741 | | - |
| 2742 | FC_DEBUG("QFontCache: found font engine\n" 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()); partially evaluated: false| no Evaluation Count:0 | yes Evaluation Count:18 |
| 0-18 |
| 2743 | " %p: timestamp %4u hits %3u ref %2d/%2d, type '%s'", 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 |
| 2744 | value.data, value.timestamp, value.hits, 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 |
| 2745 | value.data->ref.load(), value.data->cache_count, 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 |
| 2746 | 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 |
| 2747 | } executed: }Execution Count:18 | 18 |
| 2748 | | - |
| 2749 | void QFontCache::insertEngine(const Key &key, QFontEngine *engine, bool insertMulti) | - |
| 2750 | { | - |
| 2751 | FC_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 |
| 2752 | | - |
| 2753 | Engine data(engine); executed (the execution status of this line is deduced): Engine data(engine); | - |
| 2754 | data.timestamp = ++current_timestamp; executed (the execution status of this line is deduced): data.timestamp = ++current_timestamp; | - |
| 2755 | | - |
| 2756 | if (insertMulti) partially evaluated: insertMulti| no Evaluation Count:0 | yes Evaluation Count:1226 |
| 0-1226 |
| 2757 | engineCache.insertMulti(key, data); never executed: engineCache.insertMulti(key, data); | 0 |
| 2758 | else | - |
| 2759 | engineCache.insert(key, data); executed: engineCache.insert(key, data);Execution Count:1226 | 1226 |
| 2760 | | - |
| 2761 | // only increase the cost if this is the first time we insert the engine | - |
| 2762 | if (engine->cache_count == 0) partially evaluated: engine->cache_count == 0| yes Evaluation Count:1226 | no Evaluation Count:0 |
| 0-1226 |
| 2763 | increaseCost(engine->cache_cost); executed: increaseCost(engine->cache_cost);Execution Count:1226 | 1226 |
| 2764 | | - |
| 2765 | ++engine->cache_count; executed (the execution status of this line is deduced): ++engine->cache_count; | - |
| 2766 | } executed: }Execution Count:1226 | 1226 |
| 2767 | | - |
| 2768 | void QFontCache::increaseCost(uint cost) | - |
| 2769 | { | - |
| 2770 | cost = (cost + 512) / 1024; // store cost in kb executed (the execution status of this line is deduced): cost = (cost + 512) / 1024; | - |
| 2771 | cost = cost > 0 ? cost : 1; partially evaluated: cost > 0| no Evaluation Count:0 | yes Evaluation Count:1836 |
| 0-1836 |
| 2772 | total_cost += cost; executed (the execution status of this line is deduced): total_cost += cost; | - |
| 2773 | | - |
| 2774 | FC_DEBUG(" COST: increased %u kb, total_cost %u kb, max_cost %u kb", 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); partially evaluated: false| no Evaluation Count:0 | yes Evaluation Count:1836 |
| 0-1836 |
| 2775 | 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 |
| 2776 | | - |
| 2777 | if (total_cost > max_cost) { partially evaluated: total_cost > max_cost| no Evaluation Count:0 | yes Evaluation Count:1836 |
| 0-1836 |
| 2778 | max_cost = total_cost; never executed (the execution status of this line is deduced): max_cost = total_cost; | - |
| 2779 | | - |
| 2780 | if (timer_id == -1 || ! fast) { never evaluated: timer_id == -1 never evaluated: ! fast | 0 |
| 2781 | FC_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); never evaluated: false | 0 |
| 2782 | | - |
| 2783 | if (timer_id != -1) killTimer(timer_id); never executed: killTimer(timer_id); never evaluated: timer_id != -1 | 0 |
| 2784 | timer_id = startTimer(fast_timeout); never executed (the execution status of this line is deduced): timer_id = startTimer(fast_timeout); | - |
| 2785 | fast = true; never executed (the execution status of this line is deduced): fast = true; | - |
| 2786 | } | 0 |
| 2787 | } | 0 |
| 2788 | } executed: }Execution Count:1836 | 1836 |
| 2789 | | - |
| 2790 | void QFontCache::decreaseCost(uint cost) | - |
| 2791 | { | - |
| 2792 | cost = (cost + 512) / 1024; // cost is stored in kb never executed (the execution status of this line is deduced): cost = (cost + 512) / 1024; | - |
| 2793 | cost = cost > 0 ? cost : 1; never evaluated: cost > 0 | 0 |
| 2794 | Q_ASSERT(cost <= total_cost); never executed (the execution status of this line is deduced): qt_noop(); | - |
| 2795 | total_cost -= cost; never executed (the execution status of this line is deduced): total_cost -= cost; | - |
| 2796 | | - |
| 2797 | FC_DEBUG(" COST: decreased %u kb, total_cost %u kb, max_cost %u kb", 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); never evaluated: false | 0 |
| 2798 | 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 |
| 2799 | } | 0 |
| 2800 | | - |
| 2801 | void QFontCache::timerEvent(QTimerEvent *) | - |
| 2802 | { | - |
| 2803 | FC_DEBUG("QFontCache::timerEvent: performing cache maintenance (timestamp %u)", never executed: QMessageLogger("text/qfont.cpp", 2803, __PRETTY_FUNCTION__).debug("QFontCache::timerEvent: performing cache maintenance (timestamp %u)", current_timestamp); never evaluated: false | 0 |
| 2804 | current_timestamp); never executed: QMessageLogger("text/qfont.cpp", 2803, __PRETTY_FUNCTION__).debug("QFontCache::timerEvent: performing cache maintenance (timestamp %u)", current_timestamp); | 0 |
| 2805 | | - |
| 2806 | if (total_cost <= max_cost && max_cost <= min_cost) { never evaluated: total_cost <= max_cost never evaluated: max_cost <= min_cost | 0 |
| 2807 | FC_DEBUG(" cache redused sufficiently, stopping timer"); never executed: QMessageLogger("text/qfont.cpp", 2807, __PRETTY_FUNCTION__).debug(" cache redused sufficiently, stopping timer"); never evaluated: false | 0 |
| 2808 | | - |
| 2809 | killTimer(timer_id); never executed (the execution status of this line is deduced): killTimer(timer_id); | - |
| 2810 | timer_id = -1; never executed (the execution status of this line is deduced): timer_id = -1; | - |
| 2811 | fast = false; never executed (the execution status of this line is deduced): fast = false; | - |
| 2812 | | - |
| 2813 | return; | 0 |
| 2814 | } | - |
| 2815 | | - |
| 2816 | // go through the cache and count up everything in use | - |
| 2817 | uint in_use_cost = 0; never executed (the execution status of this line is deduced): uint in_use_cost = 0; | - |
| 2818 | | - |
| 2819 | { | - |
| 2820 | FC_DEBUG(" SWEEP engine data:"); never executed: QMessageLogger("text/qfont.cpp", 2820, __PRETTY_FUNCTION__).debug(" SWEEP engine data:"); never evaluated: false | 0 |
| 2821 | | - |
| 2822 | // make sure the cost of each engine data is at least 1kb | - |
| 2823 | const uint engine_data_cost = never executed (the execution status of this line is deduced): const uint engine_data_cost = | - |
| 2824 | sizeof(QFontEngineData) > 1024 ? sizeof(QFontEngineData) : 1024; never evaluated: sizeof(QFontEngineData) > 1024 | 0 |
| 2825 | | - |
| 2826 | EngineDataCache::ConstIterator it = engineDataCache.constBegin(), never executed (the execution status of this line is deduced): EngineDataCache::ConstIterator it = engineDataCache.constBegin(), | - |
| 2827 | end = engineDataCache.constEnd(); never executed (the execution status of this line is deduced): end = engineDataCache.constEnd(); | - |
| 2828 | for (; it != end; ++it) { never evaluated: it != end | 0 |
| 2829 | #ifdef QFONTCACHE_DEBUG | - |
| 2830 | FC_DEBUG(" %p: ref %2d", it.value(), int(it.value()->ref.load())); | - |
| 2831 | | - |
| 2832 | #endif // QFONTCACHE_DEBUG | - |
| 2833 | | - |
| 2834 | if (it.value()->ref.load() != 0) never evaluated: it.value()->ref.load() != 0 | 0 |
| 2835 | in_use_cost += engine_data_cost; never executed: in_use_cost += engine_data_cost; | 0 |
| 2836 | } | 0 |
| 2837 | } | - |
| 2838 | | - |
| 2839 | { | - |
| 2840 | FC_DEBUG(" SWEEP engine:"); never executed: QMessageLogger("text/qfont.cpp", 2840, __PRETTY_FUNCTION__).debug(" SWEEP engine:"); never evaluated: false | 0 |
| 2841 | | - |
| 2842 | EngineCache::ConstIterator it = engineCache.constBegin(), never executed (the execution status of this line is deduced): EngineCache::ConstIterator it = engineCache.constBegin(), | - |
| 2843 | end = engineCache.constEnd(); never executed (the execution status of this line is deduced): end = engineCache.constEnd(); | - |
| 2844 | for (; it != end; ++it) { never evaluated: it != end | 0 |
| 2845 | FC_DEBUG(" %p: timestamp %4u hits %2u ref %2d/%2d, cost %u bytes", 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); never evaluated: false | 0 |
| 2846 | it.value().data, it.value().timestamp, it.value().hits, 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 |
| 2847 | it.value().data->ref.load(), it.value().data->cache_count, 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 |
| 2848 | 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 |
| 2849 | | - |
| 2850 | if (it.value().data->ref.load() != 0) never evaluated: it.value().data->ref.load() != 0 | 0 |
| 2851 | 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 |
| 2852 | } | 0 |
| 2853 | | - |
| 2854 | // attempt to make up for rounding errors | - |
| 2855 | in_use_cost += engineCache.size(); never executed (the execution status of this line is deduced): in_use_cost += engineCache.size(); | - |
| 2856 | } | - |
| 2857 | | - |
| 2858 | in_use_cost = (in_use_cost + 512) / 1024; // cost is stored in kb never executed (the execution status of this line is deduced): in_use_cost = (in_use_cost + 512) / 1024; | - |
| 2859 | | - |
| 2860 | /* | - |
| 2861 | calculate the new maximum cost for the cache | - |
| 2862 | | - |
| 2863 | NOTE: in_use_cost is *not* correct due to rounding errors in the | - |
| 2864 | above algorithm. instead of worrying about getting the | - |
| 2865 | calculation correct, we are more interested in speed, and use | - |
| 2866 | in_use_cost as a floor for new_max_cost | - |
| 2867 | */ | - |
| 2868 | uint new_max_cost = qMax(qMax(max_cost / 2, in_use_cost), min_cost); never executed (the execution status of this line is deduced): uint new_max_cost = qMax(qMax(max_cost / 2, in_use_cost), min_cost); | - |
| 2869 | | - |
| 2870 | FC_DEBUG(" after sweep, in use %u kb, total %u kb, max %u kb, new max %u kb", 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); never evaluated: false | 0 |
| 2871 | 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 |
| 2872 | | - |
| 2873 | if (new_max_cost == max_cost) { never evaluated: new_max_cost == max_cost | 0 |
| 2874 | if (fast) { | 0 |
| 2875 | FC_DEBUG(" cannot shrink cache, slowing timer"); never executed: QMessageLogger("text/qfont.cpp", 2875, __PRETTY_FUNCTION__).debug(" cannot shrink cache, slowing timer"); never evaluated: false | 0 |
| 2876 | | - |
| 2877 | killTimer(timer_id); never executed (the execution status of this line is deduced): killTimer(timer_id); | - |
| 2878 | timer_id = startTimer(slow_timeout); never executed (the execution status of this line is deduced): timer_id = startTimer(slow_timeout); | - |
| 2879 | fast = false; never executed (the execution status of this line is deduced): fast = false; | - |
| 2880 | } | 0 |
| 2881 | | - |
| 2882 | return; | 0 |
| 2883 | } else if (! fast) { | 0 |
| 2884 | FC_DEBUG(" dropping into passing gear"); never executed: QMessageLogger("text/qfont.cpp", 2884, __PRETTY_FUNCTION__).debug(" dropping into passing gear"); never evaluated: false | 0 |
| 2885 | | - |
| 2886 | killTimer(timer_id); never executed (the execution status of this line is deduced): killTimer(timer_id); | - |
| 2887 | timer_id = startTimer(fast_timeout); never executed (the execution status of this line is deduced): timer_id = startTimer(fast_timeout); | - |
| 2888 | fast = true; never executed (the execution status of this line is deduced): fast = true; | - |
| 2889 | } | 0 |
| 2890 | | - |
| 2891 | max_cost = new_max_cost; never executed (the execution status of this line is deduced): max_cost = new_max_cost; | - |
| 2892 | | - |
| 2893 | { | - |
| 2894 | FC_DEBUG(" CLEAN engine data:"); never executed: QMessageLogger("text/qfont.cpp", 2894, __PRETTY_FUNCTION__).debug(" CLEAN engine data:"); never evaluated: false | 0 |
| 2895 | | - |
| 2896 | // clean out all unused engine data | - |
| 2897 | EngineDataCache::Iterator it = engineDataCache.begin(), never executed (the execution status of this line is deduced): EngineDataCache::Iterator it = engineDataCache.begin(), | - |
| 2898 | end = engineDataCache.end(); never executed (the execution status of this line is deduced): end = engineDataCache.end(); | - |
| 2899 | while (it != end) { never evaluated: it != end | 0 |
| 2900 | if (it.value()->ref.load() != 0) { never evaluated: it.value()->ref.load() != 0 | 0 |
| 2901 | ++it; never executed (the execution status of this line is deduced): ++it; | - |
| 2902 | continue; never executed: continue; | 0 |
| 2903 | } | - |
| 2904 | | - |
| 2905 | EngineDataCache::Iterator rem = it++; never executed (the execution status of this line is deduced): EngineDataCache::Iterator rem = it++; | - |
| 2906 | | - |
| 2907 | decreaseCost(sizeof(QFontEngineData)); never executed (the execution status of this line is deduced): decreaseCost(sizeof(QFontEngineData)); | - |
| 2908 | | - |
| 2909 | FC_DEBUG(" %p", rem.value()); never executed: QMessageLogger("text/qfont.cpp", 2909, __PRETTY_FUNCTION__).debug(" %p", rem.value()); never evaluated: false | 0 |
| 2910 | | - |
| 2911 | delete rem.value(); never executed (the execution status of this line is deduced): delete rem.value(); | - |
| 2912 | engineDataCache.erase(rem); never executed (the execution status of this line is deduced): engineDataCache.erase(rem); | - |
| 2913 | } | 0 |
| 2914 | } | - |
| 2915 | | - |
| 2916 | // clean out the engine cache just enough to get below our new max cost | - |
| 2917 | uint current_cost; never executed (the execution status of this line is deduced): uint current_cost; | - |
| 2918 | do { | - |
| 2919 | current_cost = total_cost; never executed (the execution status of this line is deduced): current_cost = total_cost; | - |
| 2920 | | - |
| 2921 | EngineCache::Iterator it = engineCache.begin(), never executed (the execution status of this line is deduced): EngineCache::Iterator it = engineCache.begin(), | - |
| 2922 | end = engineCache.end(); never executed (the execution status of this line is deduced): end = engineCache.end(); | - |
| 2923 | // determine the oldest and least popular of the unused engines | - |
| 2924 | uint oldest = ~0u; never executed (the execution status of this line is deduced): uint oldest = ~0u; | - |
| 2925 | uint least_popular = ~0u; never executed (the execution status of this line is deduced): uint least_popular = ~0u; | - |
| 2926 | | - |
| 2927 | for (; it != end; ++it) { never evaluated: it != end | 0 |
| 2928 | if (it.value().data->ref.load() != 0) never evaluated: it.value().data->ref.load() != 0 | 0 |
| 2929 | continue; never executed: continue; | 0 |
| 2930 | | - |
| 2931 | if (it.value().timestamp < oldest && never evaluated: it.value().timestamp < oldest | 0 |
| 2932 | it.value().hits <= least_popular) { never evaluated: it.value().hits <= least_popular | 0 |
| 2933 | oldest = it.value().timestamp; never executed (the execution status of this line is deduced): oldest = it.value().timestamp; | - |
| 2934 | least_popular = it.value().hits; never executed (the execution status of this line is deduced): least_popular = it.value().hits; | - |
| 2935 | } | 0 |
| 2936 | } | 0 |
| 2937 | | - |
| 2938 | FC_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); never evaluated: false | 0 |
| 2939 | | - |
| 2940 | for (it = engineCache.begin(); it != end; ++it) { never evaluated: it != end | 0 |
| 2941 | if (it.value().data->ref.load() == 0 && never evaluated: it.value().data->ref.load() == 0 | 0 |
| 2942 | it.value().timestamp == oldest && never evaluated: it.value().timestamp == oldest | 0 |
| 2943 | it.value().hits == least_popular) never evaluated: it.value().hits == least_popular | 0 |
| 2944 | break; | 0 |
| 2945 | } | 0 |
| 2946 | | - |
| 2947 | if (it != end) { never evaluated: it != end | 0 |
| 2948 | FC_DEBUG(" %p: timestamp %4u hits %2u ref %2d/%2d, type '%s'", 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()); never evaluated: false | 0 |
| 2949 | it.value().data, it.value().timestamp, it.value().hits, 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 |
| 2950 | it.value().data->ref.load(), it.value().data->cache_count, 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 |
| 2951 | 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 |
| 2952 | | - |
| 2953 | if (--it.value().data->cache_count == 0) { never evaluated: --it.value().data->cache_count == 0 | 0 |
| 2954 | FC_DEBUG(" DELETE: last occurrence in cache"); never executed: QMessageLogger("text/qfont.cpp", 2954, __PRETTY_FUNCTION__).debug(" DELETE: last occurrence in cache"); never evaluated: false | 0 |
| 2955 | | - |
| 2956 | decreaseCost(it.value().data->cache_cost); never executed (the execution status of this line is deduced): decreaseCost(it.value().data->cache_cost); | - |
| 2957 | delete it.value().data; never executed (the execution status of this line is deduced): delete it.value().data; | - |
| 2958 | } else { | 0 |
| 2959 | /* | - |
| 2960 | this particular font engine is in the cache multiple | - |
| 2961 | times... set current_cost to zero, so that we can | - |
| 2962 | keep looping to get rid of all occurrences | - |
| 2963 | */ | - |
| 2964 | current_cost = 0; never executed (the execution status of this line is deduced): current_cost = 0; | - |
| 2965 | } | 0 |
| 2966 | | - |
| 2967 | engineCache.erase(it); never executed (the execution status of this line is deduced): engineCache.erase(it); | - |
| 2968 | } | 0 |
| 2969 | } while (current_cost != total_cost && total_cost > max_cost); never executed: } never evaluated: current_cost != total_cost never evaluated: total_cost > max_cost | 0 |
| 2970 | } | 0 |
| 2971 | | - |
| 2972 | | - |
| 2973 | #ifndef QT_NO_DEBUG_STREAM | - |
| 2974 | QDebug operator<<(QDebug stream, const QFont &font) | - |
| 2975 | { | - |
| 2976 | return stream << "QFont(" << font.toString() << ')'; executed: return stream << "QFont(" << font.toString() << ')';Execution Count:1 | 1 |
| 2977 | } | - |
| 2978 | #endif | - |
| 2979 | | - |
| 2980 | QT_END_NAMESPACE | - |
| 2981 | | - |
| | |