| Line | Source Code | Coverage |
|---|
| 1 | | - |
| 2 | | - |
| 3 | | - |
| 4 | | - |
| 5 | | - |
| 6 | | - |
| 7 | | - |
| 8 | bool qt_enable_test_font = false; | - |
| 9 | | - |
| 10 | void qt_setQtEnableTestFont(bool value) | - |
| 11 | { | - |
| 12 | qt_enable_test_font = value; | - |
| 13 | } | 0 |
| 14 | | - |
| 15 | static int getFontWeight(const QString &weightString) | - |
| 16 | { | - |
| 17 | QString s = weightString.toLower(); | - |
| 18 | | - |
| 19 | | - |
| 20 | if (s == QLatin1String("medium") || evaluated: s == QLatin1String("medium")| yes Evaluation Count:36 | yes Evaluation Count:2124 |
| 36-2124 |
| 21 | s == QLatin1String("normal") evaluated: s == QLatin1String("normal")| yes Evaluation Count:106 | yes Evaluation Count:2018 |
| 106-2018 |
| 22 | || s.compare(QCoreApplication::translate("QFontDatabase", "Normal"), Qt::CaseInsensitive) == 0) partially evaluated: s.compare(QCoreApplication::translate("QFontDatabase", "Normal"), Qt::CaseInsensitive) == 0| no Evaluation Count:0 | yes Evaluation Count:2018 |
| 0-2018 |
| 23 | return QFont::Normal; executed: return QFont::Normal;Execution Count:142 | 142 |
| 24 | if (s == QLatin1String("bold") evaluated: s == QLatin1String("bold")| yes Evaluation Count:131 | yes Evaluation Count:1887 |
| 131-1887 |
| 25 | || s.compare(QCoreApplication::translate("QFontDatabase", "Bold"), Qt::CaseInsensitive) == 0) partially evaluated: s.compare(QCoreApplication::translate("QFontDatabase", "Bold"), Qt::CaseInsensitive) == 0| no Evaluation Count:0 | yes Evaluation Count:1887 |
| 0-1887 |
| 26 | return QFont::Bold; executed: return QFont::Bold;Execution Count:131 | 131 |
| 27 | if (s == QLatin1String("demibold") || s == QLatin1String("demi bold") partially evaluated: s == QLatin1String("demibold")| no Evaluation Count:0 | yes Evaluation Count:1887 |
evaluated: s == QLatin1String("demi bold")| yes Evaluation Count:11 | yes Evaluation Count:1876 |
| 0-1887 |
| 28 | || s.compare(QCoreApplication::translate("QFontDatabase", "Demi Bold"), Qt::CaseInsensitive) == 0) partially evaluated: s.compare(QCoreApplication::translate("QFontDatabase", "Demi Bold"), Qt::CaseInsensitive) == 0| no Evaluation Count:0 | yes Evaluation Count:1876 |
| 0-1876 |
| 29 | return QFont::DemiBold; executed: return QFont::DemiBold;Execution Count:11 | 11 |
| 30 | if (s == QLatin1String("black") partially evaluated: s == QLatin1String("black")| no Evaluation Count:0 | yes Evaluation Count:1876 |
| 0-1876 |
| 31 | || s.compare(QCoreApplication::translate("QFontDatabase", "Black"), Qt::CaseInsensitive) == 0) partially evaluated: s.compare(QCoreApplication::translate("QFontDatabase", "Black"), Qt::CaseInsensitive) == 0| no Evaluation Count:0 | yes Evaluation Count:1876 |
| 0-1876 |
| 32 | return QFont::Black; never executed: return QFont::Black; | 0 |
| 33 | if (s == QLatin1String("light")) evaluated: s == QLatin1String("light")| yes Evaluation Count:3 | yes Evaluation Count:1873 |
| 3-1873 |
| 34 | return QFont::Light; executed: return QFont::Light;Execution Count:3 | 3 |
| 35 | | - |
| 36 | if (s.contains(QLatin1String("bold")) evaluated: s.contains(QLatin1String("bold"))| yes Evaluation Count:248 | yes Evaluation Count:1625 |
| 248-1625 |
| 37 | || s.contains(QCoreApplication::translate("QFontDatabase", "Bold"), Qt::CaseInsensitive)) { partially evaluated: s.contains(QCoreApplication::translate("QFontDatabase", "Bold"), Qt::CaseInsensitive)| no Evaluation Count:0 | yes Evaluation Count:1625 |
| 0-1625 |
| 38 | if (s.contains(QLatin1String("demi")) evaluated: s.contains(QLatin1String("demi"))| yes Evaluation Count:4 | yes Evaluation Count:244 |
| 4-244 |
| 39 | || s.compare(QCoreApplication::translate("QFontDatabase", "Demi"), Qt::CaseInsensitive) == 0) partially evaluated: s.compare(QCoreApplication::translate("QFontDatabase", "Demi"), Qt::CaseInsensitive) == 0| no Evaluation Count:0 | yes Evaluation Count:244 |
| 0-244 |
| 40 | return (int) QFont::DemiBold; executed: return (int) QFont::DemiBold;Execution Count:4 | 4 |
| 41 | return (int) QFont::Bold; executed: return (int) QFont::Bold;Execution Count:244 | 244 |
| 42 | } | - |
| 43 | | - |
| 44 | if (s.contains(QLatin1String("light")) evaluated: s.contains(QLatin1String("light"))| yes Evaluation Count:7 | yes Evaluation Count:1618 |
| 7-1618 |
| 45 | || s.compare(QCoreApplication::translate("QFontDatabase", "Light"), Qt::CaseInsensitive) == 0) partially evaluated: s.compare(QCoreApplication::translate("QFontDatabase", "Light"), Qt::CaseInsensitive) == 0| no Evaluation Count:0 | yes Evaluation Count:1618 |
| 0-1618 |
| 46 | return (int) QFont::Light; executed: return (int) QFont::Light;Execution Count:7 | 7 |
| 47 | | - |
| 48 | if (s.contains(QLatin1String("black")) partially evaluated: s.contains(QLatin1String("black"))| no Evaluation Count:0 | yes Evaluation Count:1618 |
| 0-1618 |
| 49 | || s.compare(QCoreApplication::translate("QFontDatabase", "Black"), Qt::CaseInsensitive) == 0) partially evaluated: s.compare(QCoreApplication::translate("QFontDatabase", "Black"), Qt::CaseInsensitive) == 0| no Evaluation Count:0 | yes Evaluation Count:1618 |
| 0-1618 |
| 50 | return (int) QFont::Black; never executed: return (int) QFont::Black; | 0 |
| 51 | | - |
| 52 | return (int) QFont::Normal; executed: return (int) QFont::Normal;Execution Count:1618 | 1618 |
| 53 | } | - |
| 54 | | - |
| 55 | | - |
| 56 | QFont::Weight weightFromInteger(int weight) | - |
| 57 | { | - |
| 58 | if (weight < 400) never evaluated: weight < 400 | 0 |
| 59 | return QFont::Light; never executed: return QFont::Light; | 0 |
| 60 | else if (weight < 600) never evaluated: weight < 600 | 0 |
| 61 | return QFont::Normal; never executed: return QFont::Normal; | 0 |
| 62 | else if (weight < 700) never evaluated: weight < 700 | 0 |
| 63 | return QFont::DemiBold; never executed: return QFont::DemiBold; | 0 |
| 64 | else if (weight < 800) never evaluated: weight < 800 | 0 |
| 65 | return QFont::Bold; never executed: return QFont::Bold; | 0 |
| 66 | else | - |
| 67 | return QFont::Black; never executed: return QFont::Black; | 0 |
| 68 | } | - |
| 69 | | - |
| 70 | struct QtFontEncoding | - |
| 71 | { | - |
| 72 | signed int encoding : 16; | - |
| 73 | | - |
| 74 | uint xpoint : 16; | - |
| 75 | uint xres : 8; | - |
| 76 | uint yres : 8; | - |
| 77 | uint avgwidth : 16; | - |
| 78 | uchar pitch : 8; | - |
| 79 | }; | - |
| 80 | | - |
| 81 | struct QtFontSize | - |
| 82 | { | - |
| 83 | | - |
| 84 | void *handle; | - |
| 85 | | - |
| 86 | unsigned short pixelSize : 16; | - |
| 87 | }; | - |
| 88 | | - |
| 89 | | - |
| 90 | | - |
| 91 | struct QtFontStyle | - |
| 92 | { | - |
| 93 | struct Key { | - |
| 94 | Key(const QString &styleString); | - |
| 95 | Key() : style(QFont::StyleNormal), | - |
| 96 | weight(QFont::Normal), stretch(0) { } executed: }Execution Count:52580 | 52580 |
| 97 | Key(const Key &o) : style(o.style), weight(o.weight), stretch(o.stretch) { } executed: }Execution Count:40323 | 40323 |
| 98 | uint style : 2; | - |
| 99 | signed int weight : 8; | - |
| 100 | signed int stretch : 12; | - |
| 101 | | - |
| 102 | bool operator==(const Key & other) { | - |
| 103 | return (style == other.style && weight == other.weight && | 3202 |
| 104 | (stretch == 0 || other.stretch == 0 || stretch == other.stretch)); executed: return (style == other.style && weight == other.weight && (stretch == 0 || other.stretch == 0 || stretch == other.stretch));Execution Count:3202 | 3202 |
| 105 | } | - |
| 106 | bool operator!=(const Key &other) { | - |
| 107 | return !operator==(other); executed: return !operator==(other);Execution Count:891 | 891 |
| 108 | } | - |
| 109 | bool operator <(const Key &o) { | - |
| 110 | int x = (style << 12) + (weight << 14) + stretch; | - |
| 111 | int y = (o.style << 12) + (o.weight << 14) + o.stretch; | - |
| 112 | return (x < y); never executed: return (x < y); | 0 |
| 113 | } | - |
| 114 | }; | - |
| 115 | | - |
| 116 | QtFontStyle(const Key &k) | - |
| 117 | : key(k), bitmapScalable(false), smoothScalable(false), | - |
| 118 | count(0), pixelSizes(0) | - |
| 119 | { | - |
| 120 | } executed: }Execution Count:38680 | 38680 |
| 121 | | - |
| 122 | ~QtFontStyle() { | - |
| 123 | while (count) { evaluated: count| yes Evaluation Count:35371 | yes Evaluation Count:38680 |
| 35371-38680 |
| 124 | | - |
| 125 | count--; | - |
| 126 | QPlatformIntegration *integration = QGuiApplicationPrivate::platformIntegration(); | - |
| 127 | if (integration) { partially evaluated: integration| yes Evaluation Count:35371 | no Evaluation Count:0 |
| 0-35371 |
| 128 | integration->fontDatabase()->releaseHandle(pixelSizes[count].handle); | - |
| 129 | } executed: }Execution Count:35371 | 35371 |
| 130 | } executed: }Execution Count:35371 | 35371 |
| 131 | free(pixelSizes); | - |
| 132 | } executed: }Execution Count:38680 | 38680 |
| 133 | | - |
| 134 | Key key; | - |
| 135 | bool bitmapScalable : 1; | - |
| 136 | bool smoothScalable : 1; | - |
| 137 | signed int count : 30; | - |
| 138 | QtFontSize *pixelSizes; | - |
| 139 | QString styleName; | - |
| 140 | | - |
| 141 | bool antialiased; | - |
| 142 | | - |
| 143 | QtFontSize *pixelSize(unsigned short size, bool = false); | - |
| 144 | }; | - |
| 145 | | - |
| 146 | QtFontStyle::Key::Key(const QString &styleString) | - |
| 147 | : style(QFont::StyleNormal), weight(QFont::Normal), stretch(0) | - |
| 148 | { | - |
| 149 | weight = getFontWeight(styleString); | - |
| 150 | | - |
| 151 | if (styleString.contains(QLatin1String("Italic")) evaluated: styleString.contains(QLatin1String("Italic"))| yes Evaluation Count:346 | yes Evaluation Count:1814 |
| 346-1814 |
| 152 | || styleString.contains(QCoreApplication::translate("QFontDatabase", "Italic"))) partially evaluated: styleString.contains(QCoreApplication::translate("QFontDatabase", "Italic"))| no Evaluation Count:0 | yes Evaluation Count:1814 |
| 0-1814 |
| 153 | style = QFont::StyleItalic; executed: style = QFont::StyleItalic;Execution Count:346 | 346 |
| 154 | else if (styleString.contains(QLatin1String("Oblique")) evaluated: styleString.contains(QLatin1String("Oblique"))| yes Evaluation Count:190 | yes Evaluation Count:1624 |
| 190-1624 |
| 155 | || styleString.contains(QCoreApplication::translate("QFontDatabase", "Oblique"))) partially evaluated: styleString.contains(QCoreApplication::translate("QFontDatabase", "Oblique"))| no Evaluation Count:0 | yes Evaluation Count:1624 |
| 0-1624 |
| 156 | style = QFont::StyleOblique; executed: style = QFont::StyleOblique;Execution Count:190 | 190 |
| 157 | } | - |
| 158 | | - |
| 159 | QtFontSize *QtFontStyle::pixelSize(unsigned short size, bool add) | - |
| 160 | { | - |
| 161 | for (int i = 0; i < count; i++) { evaluated: i < count| yes Evaluation Count:17945 | yes Evaluation Count:36262 |
| 17945-36262 |
| 162 | if (pixelSizes[i].pixelSize == size) evaluated: pixelSizes[i].pixelSize == size| yes Evaluation Count:17054 | yes Evaluation Count:891 |
| 891-17054 |
| 163 | return pixelSizes + i; executed: return pixelSizes + i;Execution Count:17054 | 17054 |
| 164 | } executed: }Execution Count:891 | 891 |
| 165 | if (!add) evaluated: !add| yes Evaluation Count:891 | yes Evaluation Count:35371 |
| 891-35371 |
| 166 | return 0; executed: return 0;Execution Count:891 | 891 |
| 167 | | - |
| 168 | if (!pixelSizes) { partially evaluated: !pixelSizes| yes Evaluation Count:35371 | no Evaluation Count:0 |
| 0-35371 |
| 169 | | - |
| 170 | QtFontSize *newPixelSizes = (QtFontSize *)malloc(sizeof(QtFontSize)); | - |
| 171 | qt_noop(); | - |
| 172 | pixelSizes = newPixelSizes; | - |
| 173 | } else if (!(count % 8) || count == 1) { executed: }Execution Count:35371 never evaluated: !(count % 8) never evaluated: count == 1 | 0-35371 |
| 174 | QtFontSize *newPixelSizes = (QtFontSize *) | - |
| 175 | realloc(pixelSizes, | - |
| 176 | (((count+8) >> 3) << 3) * sizeof(QtFontSize)); | - |
| 177 | qt_noop(); | - |
| 178 | pixelSizes = newPixelSizes; | - |
| 179 | } | 0 |
| 180 | pixelSizes[count].pixelSize = size; | - |
| 181 | pixelSizes[count].handle = 0; | - |
| 182 | return pixelSizes + (count++); executed: return pixelSizes + (count++);Execution Count:35371 | 35371 |
| 183 | } | - |
| 184 | | - |
| 185 | struct QtFontFoundry | - |
| 186 | { | - |
| 187 | QtFontFoundry(const QString &n) : name(n), count(0), styles(0) {} executed: }Execution Count:14900 | 14900 |
| 188 | ~QtFontFoundry() { | - |
| 189 | while (count--) evaluated: count--| yes Evaluation Count:38680 | yes Evaluation Count:14900 |
| 14900-38680 |
| 190 | delete styles[count]; executed: delete styles[count];Execution Count:38680 | 38680 |
| 191 | free(styles); | - |
| 192 | } executed: }Execution Count:14900 | 14900 |
| 193 | | - |
| 194 | QString name; | - |
| 195 | | - |
| 196 | int count; | - |
| 197 | QtFontStyle **styles; | - |
| 198 | QtFontStyle *style(const QtFontStyle::Key &, const QString & = QString(), bool = false); | - |
| 199 | }; | - |
| 200 | | - |
| 201 | QtFontStyle *QtFontFoundry::style(const QtFontStyle::Key &key, const QString &styleName, bool create) | - |
| 202 | { | - |
| 203 | int pos = 0; | - |
| 204 | for (; pos < count; pos++) { evaluated: pos < count| yes Evaluation Count:90169 | yes Evaluation Count:38680 |
| 38680-90169 |
| 205 | bool hasStyleName = !styleName.isEmpty(); | - |
| 206 | if (hasStyleName && !styles[pos]->styleName.isEmpty()) { evaluated: hasStyleName| yes Evaluation Count:88534 | yes Evaluation Count:1635 |
evaluated: !styles[pos]->styleName.isEmpty()| yes Evaluation Count:88508 | yes Evaluation Count:26 |
| 26-88534 |
| 207 | if (styles[pos]->styleName == styleName) evaluated: styles[pos]->styleName == styleName| yes Evaluation Count:16346 | yes Evaluation Count:72162 |
| 16346-72162 |
| 208 | return styles[pos]; executed: return styles[pos];Execution Count:16346 | 16346 |
| 209 | } else { executed: }Execution Count:72162 | 72162 |
| 210 | if (styles[pos]->key == key) evaluated: styles[pos]->key == key| yes Evaluation Count:26 | yes Evaluation Count:1635 |
| 26-1635 |
| 211 | return styles[pos]; executed: return styles[pos];Execution Count:26 | 26 |
| 212 | } executed: }Execution Count:1635 | 1635 |
| 213 | } | - |
| 214 | if (!create) partially evaluated: !create| no Evaluation Count:0 | yes Evaluation Count:38680 |
| 0-38680 |
| 215 | return 0; never executed: return 0; | 0 |
| 216 | | - |
| 217 | | - |
| 218 | if (!(count % 8)) { evaluated: !(count % 8)| yes Evaluation Count:15072 | yes Evaluation Count:23608 |
| 15072-23608 |
| 219 | QtFontStyle **newStyles = (QtFontStyle **) | - |
| 220 | realloc(styles, (((count+8) >> 3) << 3) * sizeof(QtFontStyle *)); | - |
| 221 | qt_noop(); | - |
| 222 | styles = newStyles; | - |
| 223 | } executed: }Execution Count:15072 | 15072 |
| 224 | | - |
| 225 | QtFontStyle *style = new QtFontStyle(key); | - |
| 226 | style->styleName = styleName; | - |
| 227 | styles[pos] = style; | - |
| 228 | count++; | - |
| 229 | return styles[pos]; executed: return styles[pos];Execution Count:38680 | 38680 |
| 230 | } | - |
| 231 | | - |
| 232 | | - |
| 233 | struct QtFontFamily | - |
| 234 | { | - |
| 235 | enum WritingSystemStatus { | - |
| 236 | Unknown = 0, | - |
| 237 | Supported = 1, | - |
| 238 | UnsupportedFT = 2, | - |
| 239 | Unsupported = UnsupportedFT | - |
| 240 | }; | - |
| 241 | | - |
| 242 | QtFontFamily(const QString &n) | - |
| 243 | : | - |
| 244 | fixedPitch(false), | - |
| 245 | | - |
| 246 | | - |
| 247 | | - |
| 248 | name(n), count(0), foundries(0) | - |
| 249 | , bogusWritingSystems(false) | - |
| 250 | , askedForFallback(false) | - |
| 251 | { | - |
| 252 | memset(writingSystems, 0, sizeof(writingSystems)); | - |
| 253 | } executed: }Execution Count:13778 | 13778 |
| 254 | ~QtFontFamily() { | - |
| 255 | while (count--) evaluated: count--| yes Evaluation Count:13778 | yes Evaluation Count:13778 |
| 13778 |
| 256 | delete foundries[count]; executed: delete foundries[count];Execution Count:13778 | 13778 |
| 257 | free(foundries); | - |
| 258 | } executed: }Execution Count:13778 | 13778 |
| 259 | | - |
| 260 | bool fixedPitch : 1; | - |
| 261 | | - |
| 262 | | - |
| 263 | | - |
| 264 | | - |
| 265 | QString name; | - |
| 266 | QStringList aliases; | - |
| 267 | int count; | - |
| 268 | QtFontFoundry **foundries; | - |
| 269 | | - |
| 270 | bool bogusWritingSystems; | - |
| 271 | QStringList fallbackFamilies; | - |
| 272 | bool askedForFallback; | - |
| 273 | unsigned char writingSystems[QFontDatabase::WritingSystemsCount]; | - |
| 274 | | - |
| 275 | QtFontFoundry *foundry(const QString &f, bool = false); | - |
| 276 | }; | - |
| 277 | QtFontFoundry *QtFontFamily::foundry(const QString &f, bool create) | - |
| 278 | { | - |
| 279 | if (f.isNull() && count == 1) evaluated: f.isNull()| yes Evaluation Count:1359 | yes Evaluation Count:50175 |
evaluated: count == 1| yes Evaluation Count:906 | yes Evaluation Count:453 |
| 453-50175 |
| 280 | return foundries[0]; executed: return foundries[0];Execution Count:906 | 906 |
| 281 | | - |
| 282 | for (int i = 0; i < count; i++) { evaluated: i < count| yes Evaluation Count:36850 | yes Evaluation Count:13778 |
| 13778-36850 |
| 283 | if (foundries[i]->name.compare(f, Qt::CaseInsensitive) == 0) partially evaluated: foundries[i]->name.compare(f, Qt::CaseInsensitive) == 0| yes Evaluation Count:36850 | no Evaluation Count:0 |
| 0-36850 |
| 284 | return foundries[i]; executed: return foundries[i];Execution Count:36850 | 36850 |
| 285 | } | 0 |
| 286 | if (!create) partially evaluated: !create| no Evaluation Count:0 | yes Evaluation Count:13778 |
| 0-13778 |
| 287 | return 0; never executed: return 0; | 0 |
| 288 | | - |
| 289 | if (!(count % 8)) { partially evaluated: !(count % 8)| yes Evaluation Count:13778 | no Evaluation Count:0 |
| 0-13778 |
| 290 | QtFontFoundry **newFoundries = (QtFontFoundry **) | - |
| 291 | realloc(foundries, | - |
| 292 | (((count+8) >> 3) << 3) * sizeof(QtFontFoundry *)); | - |
| 293 | qt_noop(); | - |
| 294 | foundries = newFoundries; | - |
| 295 | } executed: }Execution Count:13778 | 13778 |
| 296 | | - |
| 297 | foundries[count] = new QtFontFoundry(f); | - |
| 298 | return foundries[count++]; executed: return foundries[count++];Execution Count:13778 | 13778 |
| 299 | } | - |
| 300 | | - |
| 301 | | - |
| 302 | | - |
| 303 | | - |
| 304 | static int requiredUnicodeBits[QFontDatabase::WritingSystemsCount][2] = { | - |
| 305 | | - |
| 306 | { 127, 127 }, | - |
| 307 | | - |
| 308 | { 0, 127 }, | - |
| 309 | | - |
| 310 | { 7, 127 }, | - |
| 311 | | - |
| 312 | { 9, 127 }, | - |
| 313 | | - |
| 314 | { 10, 127 }, | - |
| 315 | | - |
| 316 | { 11, 127 }, | - |
| 317 | | - |
| 318 | { 13, 127 }, | - |
| 319 | | - |
| 320 | { 71, 127 }, | - |
| 321 | | - |
| 322 | { 72, 127 }, | - |
| 323 | | - |
| 324 | { 15, 127 }, | - |
| 325 | | - |
| 326 | { 16, 127 }, | - |
| 327 | | - |
| 328 | { 17, 127 }, | - |
| 329 | | - |
| 330 | { 18, 127 }, | - |
| 331 | | - |
| 332 | { 19, 127 }, | - |
| 333 | | - |
| 334 | { 20, 127 }, | - |
| 335 | | - |
| 336 | { 21, 127 }, | - |
| 337 | | - |
| 338 | { 22, 127 }, | - |
| 339 | | - |
| 340 | { 23, 127 }, | - |
| 341 | | - |
| 342 | { 73, 127 }, | - |
| 343 | | - |
| 344 | { 24, 127 }, | - |
| 345 | | - |
| 346 | { 25, 127 }, | - |
| 347 | | - |
| 348 | { 70, 127 }, | - |
| 349 | | - |
| 350 | { 74, 127 }, | - |
| 351 | | - |
| 352 | { 26, 127 }, | - |
| 353 | | - |
| 354 | { 80, 127 }, | - |
| 355 | | - |
| 356 | { 126, 127 }, | - |
| 357 | | - |
| 358 | { 126, 127 }, | - |
| 359 | | - |
| 360 | { 126, 127 }, | - |
| 361 | | - |
| 362 | { 56, 127 }, | - |
| 363 | | - |
| 364 | { 0, 127 }, | - |
| 365 | | - |
| 366 | { 126, 127 }, | - |
| 367 | | - |
| 368 | { 78, 127 }, | - |
| 369 | | - |
| 370 | { 79, 127 }, | - |
| 371 | | - |
| 372 | { 14, 127 }, | - |
| 373 | }; | - |
| 374 | | - |
| 375 | | - |
| 376 | | - |
| 377 | | - |
| 378 | | - |
| 379 | | - |
| 380 | QList<QFontDatabase::WritingSystem> qt_determine_writing_systems_from_truetype_bits(quint32 unicodeRange[4], quint32 codePageRange[2]) | - |
| 381 | { | - |
| 382 | QList<QFontDatabase::WritingSystem> writingSystems; | - |
| 383 | bool hasScript = false; | - |
| 384 | | - |
| 385 | int i; | - |
| 386 | for(i = 0; i < QFontDatabase::WritingSystemsCount; i++) { evaluated: i < QFontDatabase::WritingSystemsCount| yes Evaluation Count:272 | yes Evaluation Count:8 |
| 8-272 |
| 387 | int bit = requiredUnicodeBits[i][0]; | - |
| 388 | int index = bit/32; | - |
| 389 | int flag = 1 << (bit&31); | - |
| 390 | if (bit != 126 && unicodeRange[index] & flag) { evaluated: bit != 126| yes Evaluation Count:240 | yes Evaluation Count:32 |
evaluated: unicodeRange[index] & flag| yes Evaluation Count:28 | yes Evaluation Count:212 |
| 28-240 |
| 391 | bit = requiredUnicodeBits[i][1]; | - |
| 392 | index = bit/32; | - |
| 393 | | - |
| 394 | flag = 1 << (bit&31); | - |
| 395 | if (bit == 127 || unicodeRange[index] & flag) { partially evaluated: bit == 127| yes Evaluation Count:28 | no Evaluation Count:0 |
never evaluated: unicodeRange[index] & flag | 0-28 |
| 396 | writingSystems.append(QFontDatabase::WritingSystem(i)); | - |
| 397 | hasScript = true; | - |
| 398 | | - |
| 399 | } executed: }Execution Count:28 | 28 |
| 400 | } executed: }Execution Count:28 | 28 |
| 401 | } executed: }Execution Count:272 | 272 |
| 402 | if(codePageRange[0] & (1 << 18)) { partially evaluated: codePageRange[0] & (1 << 18)| no Evaluation Count:0 | yes Evaluation Count:8 |
| 0-8 |
| 403 | writingSystems.append(QFontDatabase::SimplifiedChinese); | - |
| 404 | hasScript = true; | - |
| 405 | | - |
| 406 | } | 0 |
| 407 | if(codePageRange[0] & (1 << 20)) { partially evaluated: codePageRange[0] & (1 << 20)| no Evaluation Count:0 | yes Evaluation Count:8 |
| 0-8 |
| 408 | writingSystems.append(QFontDatabase::TraditionalChinese); | - |
| 409 | hasScript = true; | - |
| 410 | | - |
| 411 | } | 0 |
| 412 | if(codePageRange[0] & (1 << 17)) { partially evaluated: codePageRange[0] & (1 << 17)| no Evaluation Count:0 | yes Evaluation Count:8 |
| 0-8 |
| 413 | writingSystems.append(QFontDatabase::Japanese); | - |
| 414 | hasScript = true; | - |
| 415 | | - |
| 416 | } | 0 |
| 417 | if(codePageRange[0] & (1 << 21)) { partially evaluated: codePageRange[0] & (1 << 21)| no Evaluation Count:0 | yes Evaluation Count:8 |
| 0-8 |
| 418 | writingSystems.append(QFontDatabase::Korean); | - |
| 419 | hasScript = true; | - |
| 420 | | - |
| 421 | } | 0 |
| 422 | if (!hasScript) partially evaluated: !hasScript| no Evaluation Count:0 | yes Evaluation Count:8 |
| 0-8 |
| 423 | writingSystems.append(QFontDatabase::Symbol); never executed: writingSystems.append(QFontDatabase::Symbol); | 0 |
| 424 | | - |
| 425 | return writingSystems; executed: return writingSystems;Execution Count:8 | 8 |
| 426 | } | - |
| 427 | | - |
| 428 | | - |
| 429 | class QFontDatabasePrivate | - |
| 430 | { | - |
| 431 | public: | - |
| 432 | QFontDatabasePrivate() | - |
| 433 | : count(0), families(0), reregisterAppFonts(false) | - |
| 434 | { } executed: }Execution Count:185 | 185 |
| 435 | | - |
| 436 | ~QFontDatabasePrivate() { | - |
| 437 | free(); | - |
| 438 | } executed: }Execution Count:185 | 185 |
| 439 | QtFontFamily *family(const QString &f, bool = false); | - |
| 440 | void free() { | - |
| 441 | while (count--) evaluated: count--| yes Evaluation Count:13778 | yes Evaluation Count:514 |
| 514-13778 |
| 442 | delete families[count]; executed: delete families[count];Execution Count:13778 | 13778 |
| 443 | ::free(families); | - |
| 444 | families = 0; | - |
| 445 | count = 0; | - |
| 446 | | - |
| 447 | } executed: }Execution Count:514 | 514 |
| 448 | | - |
| 449 | int count; | - |
| 450 | QtFontFamily **families; | - |
| 451 | | - |
| 452 | | - |
| 453 | | - |
| 454 | struct ApplicationFont { | - |
| 455 | QString fileName; | - |
| 456 | QByteArray data; | - |
| 457 | QStringList families; | - |
| 458 | }; | - |
| 459 | QVector<ApplicationFont> applicationFonts; | - |
| 460 | int addAppFont(const QByteArray &fontData, const QString &fileName); | - |
| 461 | bool reregisterAppFonts; | - |
| 462 | bool isApplicationFont(const QString &fileName); | - |
| 463 | | - |
| 464 | void invalidate(); | - |
| 465 | | - |
| 466 | QStringList fallbackFamilies; | - |
| 467 | }; | - |
| 468 | | - |
| 469 | void QFontDatabasePrivate::invalidate() | - |
| 470 | { | - |
| 471 | QFontCache::instance()->clear(); | - |
| 472 | free(); | - |
| 473 | static_cast<QGuiApplication *>(QCoreApplication::instance())->fontDatabaseChanged(); | - |
| 474 | } executed: }Execution Count:42 | 42 |
| 475 | | - |
| 476 | QtFontFamily *QFontDatabasePrivate::family(const QString &f, bool create) | - |
| 477 | { | - |
| 478 | int low = 0; | - |
| 479 | int high = count; | - |
| 480 | int pos = count / 2; | - |
| 481 | int res = 1; | - |
| 482 | if (count) { evaluated: count| yes Evaluation Count:54198 | yes Evaluation Count:151 |
| 151-54198 |
| 483 | while ((res = families[pos]->name.compare(f, Qt::CaseInsensitive)) && pos != low) { evaluated: (res = families[pos]->name.compare(f, Qt::CaseInsensitive))| yes Evaluation Count:265441 | yes Evaluation Count:40570 |
evaluated: pos != low| yes Evaluation Count:251813 | yes Evaluation Count:13628 |
| 13628-265441 |
| 484 | if (res > 0) evaluated: res > 0| yes Evaluation Count:111040 | yes Evaluation Count:140773 |
| 111040-140773 |
| 485 | high = pos; executed: high = pos;Execution Count:111040 | 111040 |
| 486 | else | - |
| 487 | low = pos; executed: low = pos;Execution Count:140773 | 140773 |
| 488 | pos = (high + low) / 2; | - |
| 489 | } executed: }Execution Count:251813 | 251813 |
| 490 | if (!res) evaluated: !res| yes Evaluation Count:40570 | yes Evaluation Count:13628 |
| 13628-40570 |
| 491 | return families[pos]; executed: return families[pos];Execution Count:40570 | 40570 |
| 492 | } executed: }Execution Count:13628 | 13628 |
| 493 | if (!create) evaluated: !create| yes Evaluation Count:1 | yes Evaluation Count:13778 |
| 1-13778 |
| 494 | return 0; executed: return 0;Execution Count:1 | 1 |
| 495 | | - |
| 496 | if (res < 0) evaluated: res < 0| yes Evaluation Count:13174 | yes Evaluation Count:604 |
| 604-13174 |
| 497 | pos++; executed: pos++;Execution Count:13174 | 13174 |
| 498 | | - |
| 499 | | - |
| 500 | if (!(count % 8)) { evaluated: !(count % 8)| yes Evaluation Count:1812 | yes Evaluation Count:11966 |
| 1812-11966 |
| 501 | QtFontFamily **newFamilies = (QtFontFamily **) | - |
| 502 | realloc(families, | - |
| 503 | (((count+8) >> 3) << 3) * sizeof(QtFontFamily *)); | - |
| 504 | qt_noop(); | - |
| 505 | families = newFamilies; | - |
| 506 | } executed: }Execution Count:1812 | 1812 |
| 507 | | - |
| 508 | QtFontFamily *family = new QtFontFamily(f); | - |
| 509 | memmove(families + pos + 1, families + pos, (count-pos)*sizeof(QtFontFamily *)); | - |
| 510 | families[pos] = family; | - |
| 511 | count++; | - |
| 512 | return families[pos]; executed: return families[pos];Execution Count:13778 | 13778 |
| 513 | } | - |
| 514 | | - |
| 515 | | - |
| 516 | | - |
| 517 | static const int scriptForWritingSystem[] = { | - |
| 518 | QUnicodeTables::Common, | - |
| 519 | QUnicodeTables::Latin, | - |
| 520 | QUnicodeTables::Greek, | - |
| 521 | QUnicodeTables::Cyrillic, | - |
| 522 | QUnicodeTables::Armenian, | - |
| 523 | QUnicodeTables::Hebrew, | - |
| 524 | QUnicodeTables::Arabic, | - |
| 525 | QUnicodeTables::Syriac, | - |
| 526 | QUnicodeTables::Thaana, | - |
| 527 | QUnicodeTables::Devanagari, | - |
| 528 | QUnicodeTables::Bengali, | - |
| 529 | QUnicodeTables::Gurmukhi, | - |
| 530 | QUnicodeTables::Gujarati, | - |
| 531 | QUnicodeTables::Oriya, | - |
| 532 | QUnicodeTables::Tamil, | - |
| 533 | QUnicodeTables::Telugu, | - |
| 534 | QUnicodeTables::Kannada, | - |
| 535 | QUnicodeTables::Malayalam, | - |
| 536 | QUnicodeTables::Sinhala, | - |
| 537 | QUnicodeTables::Thai, | - |
| 538 | QUnicodeTables::Lao, | - |
| 539 | QUnicodeTables::Tibetan, | - |
| 540 | QUnicodeTables::Myanmar, | - |
| 541 | QUnicodeTables::Georgian, | - |
| 542 | QUnicodeTables::Khmer, | - |
| 543 | QUnicodeTables::Common, | - |
| 544 | QUnicodeTables::Common, | - |
| 545 | QUnicodeTables::Common, | - |
| 546 | QUnicodeTables::Hangul, | - |
| 547 | QUnicodeTables::Common, | - |
| 548 | QUnicodeTables::Common, | - |
| 549 | QUnicodeTables::Common, | - |
| 550 | QUnicodeTables::Common, | - |
| 551 | QUnicodeTables::Common, | - |
| 552 | QUnicodeTables::Common, | - |
| 553 | QUnicodeTables::Common, | - |
| 554 | QUnicodeTables::Common, | - |
| 555 | QUnicodeTables::Common, | - |
| 556 | QUnicodeTables::Common, | - |
| 557 | QUnicodeTables::Ogham, | - |
| 558 | QUnicodeTables::Runic, | - |
| 559 | QUnicodeTables::Nko | - |
| 560 | }; | - |
| 561 | | - |
| 562 | int qt_script_for_writing_system(QFontDatabase::WritingSystem writingSystem) | - |
| 563 | { | - |
| 564 | return scriptForWritingSystem[writingSystem]; executed: return scriptForWritingSystem[writingSystem];Execution Count:32 | 32 |
| 565 | } | - |
| 566 | static void parseFontName(const QString &name, QString &foundry, QString &family) | - |
| 567 | { | - |
| 568 | int i = name.indexOf(QLatin1Char('[')); | - |
| 569 | int li = name.lastIndexOf(QLatin1Char(']')); | - |
| 570 | if (i >= 0 && li >= 0 && i < li) { partially evaluated: i >= 0| no Evaluation Count:0 | yes Evaluation Count:3908 |
| 0-3908 |
| 571 | foundry = name.mid(i + 1, li - i - 1); | - |
| 572 | if (i > 0 && name[i - 1] == QLatin1Char(' ')) never evaluated: name[i - 1] == QLatin1Char(' ') | 0 |
| 573 | i--; | 0 |
| 574 | family = name.left(i); | - |
| 575 | } else { | 0 |
| 576 | foundry.clear(); | - |
| 577 | family = name; | - |
| 578 | } executed: }Execution Count:3908 | 3908 |
| 579 | | - |
| 580 | | - |
| 581 | bool space = true; | - |
| 582 | QChar *s = family.data(); | - |
| 583 | int len = family.length(); | - |
| 584 | while(len--) { evaluated: len--| yes Evaluation Count:46622 | yes Evaluation Count:3908 |
| 3908-46622 |
| 585 | if (space) *s = s->toUpper(); evaluated: space| yes Evaluation Count:5882 | yes Evaluation Count:40740 |
executed: *s = s->toUpper();Execution Count:5882 | 5882-40740 |
| 586 | space = s->isSpace(); | - |
| 587 | ++s; | - |
| 588 | } executed: }Execution Count:46622 | 46622 |
| 589 | | - |
| 590 | space = true; | - |
| 591 | s = foundry.data(); | - |
| 592 | len = foundry.length(); | - |
| 593 | while(len--) { partially evaluated: len--| no Evaluation Count:0 | yes Evaluation Count:3908 |
| 0-3908 |
| 594 | if (space) *s = s->toUpper(); never executed: *s = s->toUpper(); | 0 |
| 595 | space = s->isSpace(); | - |
| 596 | ++s; | - |
| 597 | } | 0 |
| 598 | } executed: }Execution Count:3908 | 3908 |
| 599 | | - |
| 600 | | - |
| 601 | struct QtFontDesc | - |
| 602 | { | - |
| 603 | inline QtFontDesc() : family(0), foundry(0), style(0), size(0), encoding(0), familyIndex(-1) {} executed: }Execution Count:59016 | 59016 |
| 604 | QtFontFamily *family; | - |
| 605 | QtFontFoundry *foundry; | - |
| 606 | QtFontStyle *style; | - |
| 607 | QtFontSize *size; | - |
| 608 | QtFontEncoding *encoding; | - |
| 609 | int familyIndex; | - |
| 610 | }; | - |
| 611 | | - |
| 612 | static void match(int script, const QFontDef &request, | - |
| 613 | const QString &family_name, const QString &foundry_name, int force_encoding_id, | - |
| 614 | QtFontDesc *desc, const QList<int> &blacklistedFamilies = QList<int>()); | - |
| 615 | | - |
| 616 | static void initFontDef(const QtFontDesc &desc, const QFontDef &request, QFontDef *fontDef, bool multi) | - |
| 617 | { | - |
| 618 | fontDef->family = desc.family->name; | - |
| 619 | if (! desc.foundry->name.isEmpty() && desc.family->count > 1) { partially evaluated: ! desc.foundry->name.isEmpty()| yes Evaluation Count:626 | no Evaluation Count:0 |
partially evaluated: desc.family->count > 1| no Evaluation Count:0 | yes Evaluation Count:626 |
| 0-626 |
| 620 | fontDef->family += QString::fromLatin1(" ["); | - |
| 621 | fontDef->family += desc.foundry->name; | - |
| 622 | fontDef->family += QLatin1Char(']'); | - |
| 623 | } | 0 |
| 624 | | - |
| 625 | if (desc.style->smoothScalable partially evaluated: desc.style->smoothScalable| yes Evaluation Count:626 | no Evaluation Count:0 |
| 0-626 |
| 626 | || QGuiApplicationPrivate::platformIntegration()->fontDatabase()->fontsAlwaysScalable() never evaluated: QGuiApplicationPrivate::platformIntegration()->fontDatabase()->fontsAlwaysScalable() | 0 |
| 627 | || (desc.style->bitmapScalable && (request.styleStrategy & QFont::PreferMatch))) { never evaluated: desc.style->bitmapScalable never evaluated: (request.styleStrategy & QFont::PreferMatch) | 0 |
| 628 | fontDef->pixelSize = request.pixelSize; | - |
| 629 | } else { executed: }Execution Count:626 | 626 |
| 630 | fontDef->pixelSize = desc.size->pixelSize; | - |
| 631 | } | 0 |
| 632 | | - |
| 633 | fontDef->styleHint = request.styleHint; | - |
| 634 | fontDef->styleStrategy = request.styleStrategy; | - |
| 635 | | - |
| 636 | if (!multi) evaluated: !multi| yes Evaluation Count:26 | yes Evaluation Count:600 |
| 26-600 |
| 637 | fontDef->weight = desc.style->key.weight; executed: fontDef->weight = desc.style->key.weight;Execution Count:26 | 26 |
| 638 | if (!multi) evaluated: !multi| yes Evaluation Count:26 | yes Evaluation Count:600 |
| 26-600 |
| 639 | fontDef->style = desc.style->key.style; executed: fontDef->style = desc.style->key.style;Execution Count:26 | 26 |
| 640 | fontDef->fixedPitch = desc.family->fixedPitch; | - |
| 641 | fontDef->stretch = desc.style->key.stretch; | - |
| 642 | fontDef->ignorePitch = false; | - |
| 643 | } executed: }Execution Count:626 | 626 |
| 644 | | - |
| 645 | static void getEngineData(const QFontPrivate *d, const QFontDef &def) | - |
| 646 | { | - |
| 647 | | - |
| 648 | d->engineData = QFontCache::instance()->findEngineData(def); | - |
| 649 | if (!d->engineData) { evaluated: !d->engineData| yes Evaluation Count:610 | yes Evaluation Count:29300 |
| 610-29300 |
| 650 | | - |
| 651 | d->engineData = new QFontEngineData; | - |
| 652 | QFontCache::instance()->insertEngineData(def, d->engineData); | - |
| 653 | } else { executed: }Execution Count:610 | 610 |
| 654 | d->engineData->ref.ref(); | - |
| 655 | } executed: }Execution Count:29300 | 29300 |
| 656 | } | - |
| 657 | | - |
| 658 | static QStringList familyList(const QFontDef &req) | - |
| 659 | { | - |
| 660 | | - |
| 661 | QStringList family_list; | - |
| 662 | if (req.family.isEmpty()) partially evaluated: req.family.isEmpty()| no Evaluation Count:0 | yes Evaluation Count:637 |
| 0-637 |
| 663 | return family_list; never executed: return family_list; | 0 |
| 664 | | - |
| 665 | QStringList list = req.family.split(QLatin1Char(',')); | - |
| 666 | for (int i = 0; i < list.size(); ++i) { evaluated: i < list.size()| yes Evaluation Count:637 | yes Evaluation Count:637 |
| 637 |
| 667 | QString str = list.at(i).trimmed(); | - |
| 668 | if ((str.startsWith(QLatin1Char('"')) && str.endsWith(QLatin1Char('"'))) partially evaluated: str.startsWith(QLatin1Char('"'))| no Evaluation Count:0 | yes Evaluation Count:637 |
never evaluated: str.endsWith(QLatin1Char('"')) | 0-637 |
| 669 | || (str.startsWith(QLatin1Char('\'')) && str.endsWith(QLatin1Char('\'')))) partially evaluated: str.startsWith(QLatin1Char('\''))| no Evaluation Count:0 | yes Evaluation Count:637 |
never evaluated: str.endsWith(QLatin1Char('\'')) | 0-637 |
| 670 | str = str.mid(1, str.length() - 2); never executed: str = str.mid(1, str.length() - 2); | 0 |
| 671 | family_list << str; | - |
| 672 | } executed: }Execution Count:637 | 637 |
| 673 | | - |
| 674 | | - |
| 675 | QStringList subs_list; | - |
| 676 | QStringList::ConstIterator it = family_list.constBegin(), end = family_list.constEnd(); | - |
| 677 | for (; it != end; ++it) evaluated: it != end| yes Evaluation Count:637 | yes Evaluation Count:637 |
| 637 |
| 678 | subs_list += QFont::substitutes(*it); executed: subs_list += QFont::substitutes(*it);Execution Count:637 | 637 |
| 679 | | - |
| 680 | | - |
| 681 | family_list += subs_list; | - |
| 682 | | - |
| 683 | return family_list; executed: return family_list;Execution Count:637 | 637 |
| 684 | } | - |
| 685 | | - |
| 686 | static QFontDatabasePrivate *privateDb() { static QGlobalStatic<QFontDatabasePrivate > thisGlobalStatic = { { (0) }, false }; if (!thisGlobalStatic.pointer.load() && !thisGlobalStatic.destroyed) { QFontDatabasePrivate *x = new QFontDatabasePrivate; if (!thisGlobalStatic.pointer.testAndSetOrdered(0, x)) delete x; else static QGlobalStaticDeleter<QFontDatabasePrivate > cleanup(thisGlobalStatic); } return thisGlobalStatic.pointer.load(); } 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:59797 |
partially evaluated: !thisGlobalStatic.destroyed| yes Evaluation Count:185 | no Evaluation Count:0 |
never executed: delete x; executed: return thisGlobalStatic.pointer.load();Execution Count:59982 | 0-59982 |
| 687 | static QMutex *fontDatabaseMutex() { static QGlobalStatic<QMutex > thisGlobalStatic = { { (0) }, false }; if (!thisGlobalStatic.pointer.load() && !thisGlobalStatic.destroyed) { QMutex *x = new QMutex (QMutex::Recursive); if (!thisGlobalStatic.pointer.testAndSetOrdered(0, x)) delete x; else static QGlobalStaticDeleter<QMutex > cleanup(thisGlobalStatic); } return thisGlobalStatic.pointer.load(); } never executed: delete x; executed: return thisGlobalStatic.pointer.load();Execution Count:384845 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:384745 |
partially evaluated: !thisGlobalStatic.destroyed| yes Evaluation Count:100 | no Evaluation Count:0 |
| 0-384845 |
| 688 | | - |
| 689 | | - |
| 690 | void qt_cleanupFontDatabase() | - |
| 691 | { | - |
| 692 | QFontDatabasePrivate *db = privateDb(); | - |
| 693 | if (db) partially evaluated: db| yes Evaluation Count:287 | no Evaluation Count:0 |
| 0-287 |
| 694 | db->free(); executed: db->free();Execution Count:287 | 287 |
| 695 | } executed: }Execution Count:287 | 287 |
| 696 | | - |
| 697 | | - |
| 698 | QMutex *qt_fontdatabase_mutex() | - |
| 699 | { | - |
| 700 | return fontDatabaseMutex(); executed: return fontDatabaseMutex();Execution Count:380606 | 380606 |
| 701 | } | - |
| 702 | | - |
| 703 | | - |
| 704 | | - |
| 705 | | - |
| 706 | static QtFontStyle *bestStyle(QtFontFoundry *foundry, const QtFontStyle::Key &styleKey, | - |
| 707 | const QString &styleName = QString()) | - |
| 708 | { | - |
| 709 | int best = 0; | - |
| 710 | int dist = 0xffff; | - |
| 711 | | - |
| 712 | for ( int i = 0; i < foundry->count; i++ ) { evaluated: i < foundry->count| yes Evaluation Count:5633 | yes Evaluation Count:1052 |
| 1052-5633 |
| 713 | QtFontStyle *style = foundry->styles[i]; | - |
| 714 | | - |
| 715 | if (!styleName.isEmpty() && styleName == style->styleName) { evaluated: !styleName.isEmpty()| yes Evaluation Count:1858 | yes Evaluation Count:3775 |
evaluated: styleName == style->styleName| yes Evaluation Count:673 | yes Evaluation Count:1185 |
| 673-3775 |
| 716 | dist = 0; | - |
| 717 | best = i; | - |
| 718 | break; executed: break;Execution Count:673 | 673 |
| 719 | } | - |
| 720 | | - |
| 721 | int d = qAbs( styleKey.weight - style->key.weight ); | - |
| 722 | | - |
| 723 | if ( styleKey.stretch != 0 && style->key.stretch != 0 ) { evaluated: styleKey.stretch != 0| yes Evaluation Count:3775 | yes Evaluation Count:1185 |
partially evaluated: style->key.stretch != 0| yes Evaluation Count:3775 | no Evaluation Count:0 |
| 0-3775 |
| 724 | d += qAbs( styleKey.stretch - style->key.stretch ); | - |
| 725 | } executed: }Execution Count:3775 | 3775 |
| 726 | | - |
| 727 | if (styleKey.style != style->key.style) { evaluated: styleKey.style != style->key.style| yes Evaluation Count:2732 | yes Evaluation Count:2228 |
| 2228-2732 |
| 728 | if (styleKey.style != QFont::StyleNormal && style->key.style != QFont::StyleNormal) evaluated: styleKey.style != QFont::StyleNormal| yes Evaluation Count:844 | yes Evaluation Count:1888 |
evaluated: style->key.style != QFont::StyleNormal| yes Evaluation Count:210 | yes Evaluation Count:634 |
| 210-1888 |
| 729 | | - |
| 730 | d += 0x0001; executed: d += 0x0001;Execution Count:210 | 210 |
| 731 | else | - |
| 732 | d += 0x1000; executed: d += 0x1000;Execution Count:2522 | 2522 |
| 733 | } | - |
| 734 | | - |
| 735 | if ( d < dist ) { evaluated: d < dist| yes Evaluation Count:2048 | yes Evaluation Count:2912 |
| 2048-2912 |
| 736 | best = i; | - |
| 737 | dist = d; | - |
| 738 | } executed: }Execution Count:2048 | 2048 |
| 739 | } executed: }Execution Count:4960 | 4960 |
| 740 | | - |
| 741 | if (false) QMessageLogger("text/qfontdatabase.cpp", 841, __PRETTY_FUNCTION__).debug( " best style has distance 0x%x", dist ); never executed: QMessageLogger("text/qfontdatabase.cpp", 841, __PRETTY_FUNCTION__).debug( " best style has distance 0x%x", dist ); partially evaluated: false| no Evaluation Count:0 | yes Evaluation Count:1725 |
| 0-1725 |
| 742 | return foundry->styles[best]; executed: return foundry->styles[best];Execution Count:1725 | 1725 |
| 743 | } | - |
| 744 | | - |
| 745 | | - |
| 746 | static | - |
| 747 | unsigned int bestFoundry(int script, unsigned int score, int styleStrategy, | - |
| 748 | const QtFontFamily *family, const QString &foundry_name, | - |
| 749 | QtFontStyle::Key styleKey, int pixelSize, char pitch, | - |
| 750 | QtFontDesc *desc, int force_encoding_id) | - |
| 751 | { | - |
| 752 | (void)force_encoding_id;; | - |
| 753 | (void)script;; | - |
| 754 | (void)pitch;; | - |
| 755 | | - |
| 756 | desc->foundry = 0; | - |
| 757 | desc->style = 0; | - |
| 758 | desc->size = 0; | - |
| 759 | desc->encoding = 0; | - |
| 760 | | - |
| 761 | | - |
| 762 | if (false) QMessageLogger("text/qfontdatabase.cpp", 862, __PRETTY_FUNCTION__).debug(" REMARK: looking for best foundry for family '%s' [%d]", family->name.toLatin1().constData(), family->count); never executed: QMessageLogger("text/qfontdatabase.cpp", 862, __PRETTY_FUNCTION__).debug(" REMARK: looking for best foundry for family '%s' [%d]", family->name.toLatin1().constData(), family->count); partially evaluated: false| no Evaluation Count:0 | yes Evaluation Count:891 |
| 0-891 |
| 763 | | - |
| 764 | for (int x = 0; x < family->count; ++x) { evaluated: x < family->count| yes Evaluation Count:891 | yes Evaluation Count:891 |
| 891 |
| 765 | QtFontFoundry *foundry = family->foundries[x]; | - |
| 766 | if (!foundry_name.isEmpty() && foundry->name.compare(foundry_name, Qt::CaseInsensitive) != 0) partially evaluated: !foundry_name.isEmpty()| no Evaluation Count:0 | yes Evaluation Count:891 |
never evaluated: foundry->name.compare(foundry_name, Qt::CaseInsensitive) != 0 | 0-891 |
| 767 | continue; never executed: continue; | 0 |
| 768 | | - |
| 769 | if (false) QMessageLogger("text/qfontdatabase.cpp", 869, __PRETTY_FUNCTION__).debug(" looking for matching style in foundry '%s' %d", partially evaluated: false| no Evaluation Count:0 | yes Evaluation Count:891 |
| 0-891 |
| 770 | foundry->name.isEmpty() ? "-- none --" : foundry->name.toLatin1().constData(), foundry->count); never executed: QMessageLogger("text/qfontdatabase.cpp", 869, __PRETTY_FUNCTION__).debug(" looking for matching style in foundry '%s' %d", foundry->name.isEmpty() ? "-- none --" : foundry->name.toLatin1().constData(), foundry->count); | 0 |
| 771 | | - |
| 772 | QtFontStyle *style = bestStyle(foundry, styleKey); | - |
| 773 | | - |
| 774 | if (!style->smoothScalable && (styleStrategy & QFont::ForceOutline)) { partially evaluated: !style->smoothScalable| no Evaluation Count:0 | yes Evaluation Count:891 |
never evaluated: (styleStrategy & QFont::ForceOutline) | 0-891 |
| 775 | if (false) QMessageLogger("text/qfontdatabase.cpp", 875, __PRETTY_FUNCTION__).debug(" ForceOutline set, but not smoothly scalable"); never executed: QMessageLogger("text/qfontdatabase.cpp", 875, __PRETTY_FUNCTION__).debug(" ForceOutline set, but not smoothly scalable"); | 0 |
| 776 | continue; never executed: continue; | 0 |
| 777 | } | - |
| 778 | | - |
| 779 | int px = -1; | - |
| 780 | QtFontSize *size = 0; | - |
| 781 | | - |
| 782 | | - |
| 783 | if (!(styleStrategy & QFont::ForceOutline)) { partially evaluated: !(styleStrategy & QFont::ForceOutline)| yes Evaluation Count:891 | no Evaluation Count:0 |
| 0-891 |
| 784 | size = style->pixelSize(pixelSize); | - |
| 785 | if (size) { partially evaluated: size| no Evaluation Count:0 | yes Evaluation Count:891 |
| 0-891 |
| 786 | if (false) QMessageLogger("text/qfontdatabase.cpp", 886, __PRETTY_FUNCTION__).debug(" found exact size match (%d pixels)", size->pixelSize); never executed: QMessageLogger("text/qfontdatabase.cpp", 886, __PRETTY_FUNCTION__).debug(" found exact size match (%d pixels)", size->pixelSize); | 0 |
| 787 | px = size->pixelSize; | - |
| 788 | } | 0 |
| 789 | } executed: }Execution Count:891 | 891 |
| 790 | | - |
| 791 | | - |
| 792 | if (!size && style->smoothScalable && ! (styleStrategy & QFont::PreferBitmap)) { partially evaluated: !size| yes Evaluation Count:891 | no Evaluation Count:0 |
partially evaluated: style->smoothScalable| yes Evaluation Count:891 | no Evaluation Count:0 |
partially evaluated: ! (styleStrategy & QFont::PreferBitmap)| yes Evaluation Count:891 | no Evaluation Count:0 |
| 0-891 |
| 793 | size = style->pixelSize(0xffff); | - |
| 794 | if (size) { partially evaluated: size| yes Evaluation Count:891 | no Evaluation Count:0 |
| 0-891 |
| 795 | if (false) QMessageLogger("text/qfontdatabase.cpp", 895, __PRETTY_FUNCTION__).debug(" found smoothly scalable font (%d pixels)", pixelSize); never executed: QMessageLogger("text/qfontdatabase.cpp", 895, __PRETTY_FUNCTION__).debug(" found smoothly scalable font (%d pixels)", pixelSize); partially evaluated: false| no Evaluation Count:0 | yes Evaluation Count:891 |
| 0-891 |
| 796 | px = pixelSize; | - |
| 797 | } executed: }Execution Count:891 | 891 |
| 798 | } executed: }Execution Count:891 | 891 |
| 799 | | - |
| 800 | | - |
| 801 | if (!size && style->bitmapScalable && (styleStrategy & QFont::PreferMatch)) { partially evaluated: !size| no Evaluation Count:0 | yes Evaluation Count:891 |
never evaluated: style->bitmapScalable never evaluated: (styleStrategy & QFont::PreferMatch) | 0-891 |
| 802 | size = style->pixelSize(0); | - |
| 803 | if (size) { | 0 |
| 804 | if (false) QMessageLogger("text/qfontdatabase.cpp", 904, __PRETTY_FUNCTION__).debug(" found bitmap scalable font (%d pixels)", pixelSize); never executed: QMessageLogger("text/qfontdatabase.cpp", 904, __PRETTY_FUNCTION__).debug(" found bitmap scalable font (%d pixels)", pixelSize); | 0 |
| 805 | px = pixelSize; | - |
| 806 | } | 0 |
| 807 | } | 0 |
| 808 | | - |
| 809 | | - |
| 810 | | - |
| 811 | if (! size) { partially evaluated: ! size| no Evaluation Count:0 | yes Evaluation Count:891 |
| 0-891 |
| 812 | unsigned int distance = ~0u; | - |
| 813 | for (int x = 0; x < style->count; ++x) { never evaluated: x < style->count | 0 |
| 814 | | - |
| 815 | unsigned int d; | - |
| 816 | if (style->pixelSizes[x].pixelSize < pixelSize) { never evaluated: style->pixelSizes[x].pixelSize < pixelSize | 0 |
| 817 | | - |
| 818 | | - |
| 819 | | - |
| 820 | d = pixelSize - style->pixelSizes[x].pixelSize + 1; | - |
| 821 | } else { | 0 |
| 822 | d = style->pixelSizes[x].pixelSize - pixelSize; | - |
| 823 | } | 0 |
| 824 | | - |
| 825 | if (d < distance) { never evaluated: d < distance | 0 |
| 826 | distance = d; | - |
| 827 | size = style->pixelSizes + x; | - |
| 828 | if (false) QMessageLogger("text/qfontdatabase.cpp", 928, __PRETTY_FUNCTION__).debug(" best size so far: %3d (%d)", size->pixelSize, pixelSize); never executed: QMessageLogger("text/qfontdatabase.cpp", 928, __PRETTY_FUNCTION__).debug(" best size so far: %3d (%d)", size->pixelSize, pixelSize); | 0 |
| 829 | } | 0 |
| 830 | } | 0 |
| 831 | | - |
| 832 | if (!size) { | 0 |
| 833 | if (false) QMessageLogger("text/qfontdatabase.cpp", 933, __PRETTY_FUNCTION__).debug(" no size supports the script we want"); never executed: QMessageLogger("text/qfontdatabase.cpp", 933, __PRETTY_FUNCTION__).debug(" no size supports the script we want"); | 0 |
| 834 | continue; never executed: continue; | 0 |
| 835 | } | - |
| 836 | | - |
| 837 | if (style->bitmapScalable && ! (styleStrategy & QFont::PreferQuality) && never evaluated: style->bitmapScalable never evaluated: ! (styleStrategy & QFont::PreferQuality) | 0 |
| 838 | (distance * 10 / pixelSize) >= 2) { never evaluated: (distance * 10 / pixelSize) >= 2 | 0 |
| 839 | | - |
| 840 | | - |
| 841 | size = style->pixelSize(0); | - |
| 842 | px = pixelSize; | - |
| 843 | } else { | 0 |
| 844 | px = size->pixelSize; | - |
| 845 | } | 0 |
| 846 | } | - |
| 847 | | - |
| 848 | | - |
| 849 | unsigned int this_score = 0x0000; | - |
| 850 | enum { | - |
| 851 | PitchMismatch = 0x4000, | - |
| 852 | StyleMismatch = 0x2000, | - |
| 853 | BitmapScaledPenalty = 0x1000, | - |
| 854 | EncodingMismatch = 0x0002 | - |
| 855 | }; | - |
| 856 | if (pitch != '*') { evaluated: pitch != '*'| yes Evaluation Count:2 | yes Evaluation Count:889 |
| 2-889 |
| 857 | | - |
| 858 | | - |
| 859 | | - |
| 860 | if ((pitch == 'm' && !family->fixedPitch) evaluated: pitch == 'm'| yes Evaluation Count:1 | yes Evaluation Count:1 |
partially evaluated: !family->fixedPitch| yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
| 861 | || (pitch == 'p' && family->fixedPitch)) partially evaluated: pitch == 'p'| yes Evaluation Count:1 | no Evaluation Count:0 |
partially evaluated: family->fixedPitch| no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
| 862 | this_score += PitchMismatch; executed: this_score += PitchMismatch;Execution Count:1 | 1 |
| 863 | } executed: }Execution Count:2 | 2 |
| 864 | if (styleKey != style->key) evaluated: styleKey != style->key| yes Evaluation Count:118 | yes Evaluation Count:773 |
| 118-773 |
| 865 | this_score += StyleMismatch; executed: this_score += StyleMismatch;Execution Count:118 | 118 |
| 866 | if (!style->smoothScalable && px != size->pixelSize) partially evaluated: !style->smoothScalable| no Evaluation Count:0 | yes Evaluation Count:891 |
never evaluated: px != size->pixelSize | 0-891 |
| 867 | this_score += BitmapScaledPenalty; never executed: this_score += BitmapScaledPenalty; | 0 |
| 868 | if (px != pixelSize) partially evaluated: px != pixelSize| no Evaluation Count:0 | yes Evaluation Count:891 |
| 0-891 |
| 869 | this_score += qAbs(px - pixelSize); never executed: this_score += qAbs(px - pixelSize); | 0 |
| 870 | | - |
| 871 | if (this_score < score) { partially evaluated: this_score < score| yes Evaluation Count:891 | no Evaluation Count:0 |
| 0-891 |
| 872 | if (false) QMessageLogger("text/qfontdatabase.cpp", 972, __PRETTY_FUNCTION__).debug(" found a match: score %x best score so far %x", partially evaluated: false| no Evaluation Count:0 | yes Evaluation Count:891 |
| 0-891 |
| 873 | this_score, score); never executed: QMessageLogger("text/qfontdatabase.cpp", 972, __PRETTY_FUNCTION__).debug(" found a match: score %x best score so far %x", this_score, score); | 0 |
| 874 | | - |
| 875 | score = this_score; | - |
| 876 | desc->foundry = foundry; | - |
| 877 | desc->style = style; | - |
| 878 | desc->size = size; | - |
| 879 | } else { executed: }Execution Count:891 | 891 |
| 880 | if (false) QMessageLogger("text/qfontdatabase.cpp", 980, __PRETTY_FUNCTION__).debug(" score %x no better than best %x", this_score, score); never executed: QMessageLogger("text/qfontdatabase.cpp", 980, __PRETTY_FUNCTION__).debug(" score %x no better than best %x", this_score, score); | 0 |
| 881 | } | 0 |
| 882 | } | - |
| 883 | | - |
| 884 | return score; executed: return score;Execution Count:891 | 891 |
| 885 | } | - |
| 886 | | - |
| 887 | static bool matchFamilyName(const QString &familyName, QtFontFamily *f) | - |
| 888 | { | - |
| 889 | if (familyName.isEmpty()) evaluated: familyName.isEmpty()| yes Evaluation Count:92 | yes Evaluation Count:57878 |
| 92-57878 |
| 890 | return true; executed: return true;Execution Count:92 | 92 |
| 891 | | - |
| 892 | if (f->name.compare(familyName, Qt::CaseInsensitive) == 0) evaluated: f->name.compare(familyName, Qt::CaseInsensitive) == 0| yes Evaluation Count:1028 | yes Evaluation Count:56850 |
| 1028-56850 |
| 893 | return true; executed: return true;Execution Count:1028 | 1028 |
| 894 | | - |
| 895 | QStringList::const_iterator it = f->aliases.constBegin(); | - |
| 896 | while (it != f->aliases.constEnd()) { partially evaluated: it != f->aliases.constEnd()| no Evaluation Count:0 | yes Evaluation Count:56850 |
| 0-56850 |
| 897 | if ((*it).compare(familyName, Qt::CaseInsensitive) == 0) never evaluated: (*it).compare(familyName, Qt::CaseInsensitive) == 0 | 0 |
| 898 | return true; never executed: return true; | 0 |
| 899 | | - |
| 900 | ++it; | - |
| 901 | } | 0 |
| 902 | | - |
| 903 | return false; executed: return false;Execution Count:56850 | 56850 |
| 904 | } | - |
| 905 | | - |
| 906 | | - |
| 907 | | - |
| 908 | | - |
| 909 | | - |
| 910 | | - |
| 911 | static void match(int script, const QFontDef &request, | - |
| 912 | const QString &family_name, const QString &foundry_name, int force_encoding_id, | - |
| 913 | QtFontDesc *desc, const QList<int> &blacklistedFamilies) | - |
| 914 | { | - |
| 915 | (void)force_encoding_id;; | - |
| 916 | | - |
| 917 | QtFontStyle::Key styleKey; | - |
| 918 | styleKey.style = request.style; | - |
| 919 | styleKey.weight = request.weight; | - |
| 920 | styleKey.stretch = request.stretch; | - |
| 921 | char pitch = request.ignorePitch ? '*' : request.fixedPitch ? 'm' : 'p'; evaluated: request.ignorePitch| yes Evaluation Count:1044 | yes Evaluation Count:2 |
| 2-1044 |
| 922 | | - |
| 923 | | - |
| 924 | if (false) QMessageLogger("text/qfontdatabase.cpp", 1024, __PRETTY_FUNCTION__).debug("QFontDatabase::match\n" partially evaluated: false| no Evaluation Count:0 | yes Evaluation Count:1046 |
| 0-1046 |
| 925 | " request:\n" | 0 |
| 926 | " family: %s [%s], script: %d\n" | 0 |
| 927 | " weight: %d, style: %d\n" | 0 |
| 928 | " stretch: %d\n" | 0 |
| 929 | " pixelSize: %g\n" | 0 |
| 930 | " pitch: %c", | 0 |
| 931 | family_name.isEmpty() ? "-- first in script --" : family_name.toLatin1().constData(), | 0 |
| 932 | foundry_name.isEmpty() ? "-- any --" : foundry_name.toLatin1().constData(), | 0 |
| 933 | script, request.weight, request.style, request.stretch, request.pixelSize, pitch); never executed: QMessageLogger("text/qfontdatabase.cpp", 1024, __PRETTY_FUNCTION__).debug("QFontDatabase::match\n" " request:\n" " family: %s [%s], script: %d\n" " weight: %d, style: %d\n" " stretch: %d\n" " pixelSize: %g\n" " pitch: %c", family_name.isEmpty() ? "-- first in script --" : family_name.toLatin1().constData(), foundry_name.isEmpty() ? "-- any --" : foundry_name.toLatin1().constData(), script, request.weight, request.style, request.stretch, request.pixelSize, pitch); | 0 |
| 934 | | - |
| 935 | desc->family = 0; | - |
| 936 | desc->foundry = 0; | - |
| 937 | desc->style = 0; | - |
| 938 | desc->size = 0; | - |
| 939 | desc->encoding = 0; | - |
| 940 | desc->familyIndex = -1; | - |
| 941 | | - |
| 942 | unsigned int score = ~0u; | - |
| 943 | | - |
| 944 | load(family_name, script); | - |
| 945 | | - |
| 946 | QFontDatabasePrivate *db = privateDb(); | - |
| 947 | for (int x = 0; x < db->count; ++x) { evaluated: x < db->count| yes Evaluation Count:57970 | yes Evaluation Count:274 |
| 274-57970 |
| 948 | if (blacklistedFamilies.contains(x)) partially evaluated: blacklistedFamilies.contains(x)| no Evaluation Count:0 | yes Evaluation Count:57970 |
| 0-57970 |
| 949 | continue; never executed: continue; | 0 |
| 950 | QtFontDesc test; | - |
| 951 | test.family = db->families[x]; | - |
| 952 | test.familyIndex = x; | - |
| 953 | | - |
| 954 | if (!matchFamilyName(family_name, test.family)) evaluated: !matchFamilyName(family_name, test.family)| yes Evaluation Count:56850 | yes Evaluation Count:1120 |
| 1120-56850 |
| 955 | continue; executed: continue;Execution Count:56850 | 56850 |
| 956 | | - |
| 957 | if (family_name.isEmpty()) evaluated: family_name.isEmpty()| yes Evaluation Count:92 | yes Evaluation Count:1028 |
| 92-1028 |
| 958 | load(test.family->name, script); executed: load(test.family->name, script);Execution Count:92 | 92 |
| 959 | | - |
| 960 | uint score_adjust = 0; | - |
| 961 | | - |
| 962 | bool supported = (script == QUnicodeTables::Common); | - |
| 963 | for (int ws = 1; !supported && ws < QFontDatabase::WritingSystemsCount; ++ws) { evaluated: !supported| yes Evaluation Count:7923 | yes Evaluation Count:891 |
evaluated: ws < QFontDatabase::WritingSystemsCount| yes Evaluation Count:7694 | yes Evaluation Count:229 |
| 229-7923 |
| 964 | if (scriptForWritingSystem[ws] != script) evaluated: scriptForWritingSystem[ws] != script| yes Evaluation Count:7443 | yes Evaluation Count:251 |
| 251-7443 |
| 965 | continue; executed: continue;Execution Count:7443 | 7443 |
| 966 | if (test.family->writingSystems[ws] & QtFontFamily::Supported) evaluated: test.family->writingSystems[ws] & QtFontFamily::Supported| yes Evaluation Count:22 | yes Evaluation Count:229 |
| 22-229 |
| 967 | supported = true; executed: supported = true;Execution Count:22 | 22 |
| 968 | } executed: }Execution Count:251 | 251 |
| 969 | if (!supported) { evaluated: !supported| yes Evaluation Count:229 | yes Evaluation Count:891 |
| 229-891 |
| 970 | | - |
| 971 | continue; executed: continue;Execution Count:229 | 229 |
| 972 | } | - |
| 973 | | - |
| 974 | | - |
| 975 | | - |
| 976 | unsigned int newscore = | - |
| 977 | bestFoundry(script, score, request.styleStrategy, | - |
| 978 | test.family, foundry_name, styleKey, request.pixelSize, pitch, | - |
| 979 | &test, force_encoding_id); | - |
| 980 | if (test.foundry == 0) { partially evaluated: test.foundry == 0| no Evaluation Count:0 | yes Evaluation Count:891 |
| 0-891 |
| 981 | | - |
| 982 | | - |
| 983 | newscore = bestFoundry(script, score, request.styleStrategy, test.family, | - |
| 984 | QString(), styleKey, request.pixelSize, | - |
| 985 | pitch, &test, force_encoding_id); | - |
| 986 | } | 0 |
| 987 | newscore += score_adjust; | - |
| 988 | | - |
| 989 | if (newscore < score) { partially evaluated: newscore < score| yes Evaluation Count:891 | no Evaluation Count:0 |
| 0-891 |
| 990 | score = newscore; | - |
| 991 | *desc = test; | - |
| 992 | } executed: }Execution Count:891 | 891 |
| 993 | if (newscore < 10) evaluated: newscore < 10| yes Evaluation Count:772 | yes Evaluation Count:119 |
| 119-772 |
| 994 | break; executed: break;Execution Count:772 | 772 |
| 995 | } executed: }Execution Count:119 | 119 |
| 996 | } executed: }Execution Count:1046 | 1046 |
| 997 | | - |
| 998 | static QString styleStringHelper(int weight, QFont::Style style) | - |
| 999 | { | - |
| 1000 | QString result; | - |
| 1001 | if (weight >= QFont::Black) partially evaluated: weight >= QFont::Black| no Evaluation Count:0 | yes Evaluation Count:59 |
| 0-59 |
| 1002 | result = QCoreApplication::translate("QFontDatabase", "Black"); never executed: result = QCoreApplication::translate("QFontDatabase", "Black"); | 0 |
| 1003 | else if (weight >= QFont::Bold) partially evaluated: weight >= QFont::Bold| no Evaluation Count:0 | yes Evaluation Count:59 |
| 0-59 |
| 1004 | result = QCoreApplication::translate("QFontDatabase", "Bold"); never executed: result = QCoreApplication::translate("QFontDatabase", "Bold"); | 0 |
| 1005 | else if (weight >= QFont::DemiBold) partially evaluated: weight >= QFont::DemiBold| no Evaluation Count:0 | yes Evaluation Count:59 |
| 0-59 |
| 1006 | result = QCoreApplication::translate("QFontDatabase", "Demi Bold"); never executed: result = QCoreApplication::translate("QFontDatabase", "Demi Bold"); | 0 |
| 1007 | else if (weight < QFont::Normal) partially evaluated: weight < QFont::Normal| no Evaluation Count:0 | yes Evaluation Count:59 |
| 0-59 |
| 1008 | result = QCoreApplication::translate("QFontDatabase", "Light"); never executed: result = QCoreApplication::translate("QFontDatabase", "Light"); | 0 |
| 1009 | | - |
| 1010 | if (style == QFont::StyleItalic) evaluated: style == QFont::StyleItalic| yes Evaluation Count:19 | yes Evaluation Count:40 |
| 19-40 |
| 1011 | result += QLatin1Char(' ') + QCoreApplication::translate("QFontDatabase", "Italic"); executed: result += QLatin1Char(' ') + QCoreApplication::translate("QFontDatabase", "Italic");Execution Count:19 | 19 |
| 1012 | else if (style == QFont::StyleOblique) evaluated: style == QFont::StyleOblique| yes Evaluation Count:19 | yes Evaluation Count:21 |
| 19-21 |
| 1013 | result += QLatin1Char(' ') + QCoreApplication::translate("QFontDatabase", "Oblique"); executed: result += QLatin1Char(' ') + QCoreApplication::translate("QFontDatabase", "Oblique");Execution Count:19 | 19 |
| 1014 | | - |
| 1015 | if (result.isEmpty()) evaluated: result.isEmpty()| yes Evaluation Count:21 | yes Evaluation Count:38 |
| 21-38 |
| 1016 | result = QCoreApplication::translate("QFontDatabase", "Normal"); executed: result = QCoreApplication::translate("QFontDatabase", "Normal");Execution Count:21 | 21 |
| 1017 | | - |
| 1018 | return result.simplified(); executed: return result.simplified();Execution Count:59 | 59 |
| 1019 | } | - |
| 1020 | | - |
| 1021 | | - |
| 1022 | | - |
| 1023 | | - |
| 1024 | | - |
| 1025 | | - |
| 1026 | QString QFontDatabase::styleString(const QFont &font) | - |
| 1027 | { | - |
| 1028 | return font.styleName().isEmpty() ? styleStringHelper(font.weight(), font.style()) | 2 |
| 1029 | : font.styleName(); executed: return font.styleName().isEmpty() ? styleStringHelper(font.weight(), font.style()) : font.styleName();Execution Count:2 | 2 |
| 1030 | } | - |
| 1031 | | - |
| 1032 | | - |
| 1033 | | - |
| 1034 | | - |
| 1035 | | - |
| 1036 | | - |
| 1037 | QString QFontDatabase::styleString(const QFontInfo &fontInfo) | - |
| 1038 | { | - |
| 1039 | return fontInfo.styleName().isEmpty() ? styleStringHelper(fontInfo.weight(), fontInfo.style()) | 0 |
| 1040 | : fontInfo.styleName(); never executed: return fontInfo.styleName().isEmpty() ? styleStringHelper(fontInfo.weight(), fontInfo.style()) : fontInfo.styleName(); | 0 |
| 1041 | } | - |
| 1042 | QFontDatabase::QFontDatabase() | - |
| 1043 | { | - |
| 1044 | QMutexLocker locker(fontDatabaseMutex()); | - |
| 1045 | createDatabase(); | - |
| 1046 | d = privateDb(); | - |
| 1047 | } executed: }Execution Count:374 | 374 |
| 1048 | QList<QFontDatabase::WritingSystem> QFontDatabase::writingSystems() const | - |
| 1049 | { | - |
| 1050 | QMutexLocker locker(fontDatabaseMutex()); | - |
| 1051 | | - |
| 1052 | ::load(); | - |
| 1053 | | - |
| 1054 | QList<WritingSystem> list; | - |
| 1055 | for (int i = 0; i < d->count; ++i) { never evaluated: i < d->count | 0 |
| 1056 | QtFontFamily *family = d->families[i]; | - |
| 1057 | if (family->count == 0) never evaluated: family->count == 0 | 0 |
| 1058 | continue; never executed: continue; | 0 |
| 1059 | for (int x = Latin; x < WritingSystemsCount; ++x) { never evaluated: x < WritingSystemsCount | 0 |
| 1060 | const WritingSystem writingSystem = WritingSystem(x); | - |
| 1061 | if (!(family->writingSystems[writingSystem] & QtFontFamily::Supported)) never evaluated: !(family->writingSystems[writingSystem] & QtFontFamily::Supported) | 0 |
| 1062 | continue; never executed: continue; | 0 |
| 1063 | if (!list.contains(writingSystem)) never evaluated: !list.contains(writingSystem) | 0 |
| 1064 | list.append(writingSystem); never executed: list.append(writingSystem); | 0 |
| 1065 | } | 0 |
| 1066 | } | 0 |
| 1067 | qSort(list); | - |
| 1068 | return list; never executed: return list; | 0 |
| 1069 | } | - |
| 1070 | QList<QFontDatabase::WritingSystem> QFontDatabase::writingSystems(const QString &family) const | - |
| 1071 | { | - |
| 1072 | QString familyName, foundryName; | - |
| 1073 | parseFontName(family, foundryName, familyName); | - |
| 1074 | | - |
| 1075 | QMutexLocker locker(fontDatabaseMutex()); | - |
| 1076 | | - |
| 1077 | ::load(); | - |
| 1078 | | - |
| 1079 | QList<WritingSystem> list; | - |
| 1080 | QtFontFamily *f = d->family(familyName); | - |
| 1081 | if (!f || f->count == 0) never evaluated: f->count == 0 | 0 |
| 1082 | return list; never executed: return list; | 0 |
| 1083 | | - |
| 1084 | for (int x = Latin; x < WritingSystemsCount; ++x) { never evaluated: x < WritingSystemsCount | 0 |
| 1085 | const WritingSystem writingSystem = WritingSystem(x); | - |
| 1086 | if (f->writingSystems[writingSystem] & QtFontFamily::Supported) never evaluated: f->writingSystems[writingSystem] & QtFontFamily::Supported | 0 |
| 1087 | list.append(writingSystem); never executed: list.append(writingSystem); | 0 |
| 1088 | } | 0 |
| 1089 | return list; never executed: return list; | 0 |
| 1090 | } | - |
| 1091 | QStringList QFontDatabase::families(WritingSystem writingSystem) const | - |
| 1092 | { | - |
| 1093 | QMutexLocker locker(fontDatabaseMutex()); | - |
| 1094 | | - |
| 1095 | ::load(); | - |
| 1096 | | - |
| 1097 | QStringList flist; | - |
| 1098 | for (int i = 0; i < d->count; i++) { evaluated: i < d->count| yes Evaluation Count:32760 | yes Evaluation Count:360 |
| 360-32760 |
| 1099 | QtFontFamily *f = d->families[i]; | - |
| 1100 | if (f->count == 0) partially evaluated: f->count == 0| no Evaluation Count:0 | yes Evaluation Count:32760 |
| 0-32760 |
| 1101 | continue; never executed: continue; | 0 |
| 1102 | if (writingSystem != Any && (f->writingSystems[writingSystem] != QtFontFamily::Supported)) evaluated: writingSystem != Any| yes Evaluation Count:6370 | yes Evaluation Count:26390 |
evaluated: (f->writingSystems[writingSystem] != QtFontFamily::Supported)| yes Evaluation Count:5986 | yes Evaluation Count:384 |
| 384-26390 |
| 1103 | continue; executed: continue;Execution Count:5986 | 5986 |
| 1104 | if (f->count == 1) { partially evaluated: f->count == 1| yes Evaluation Count:26774 | no Evaluation Count:0 |
| 0-26774 |
| 1105 | flist.append(f->name); | - |
| 1106 | } else { executed: }Execution Count:26774 | 26774 |
| 1107 | for (int j = 0; j < f->count; j++) { never evaluated: j < f->count | 0 |
| 1108 | QString str = f->name; | - |
| 1109 | QString foundry = f->foundries[j]->name; | - |
| 1110 | if (!foundry.isEmpty()) { never evaluated: !foundry.isEmpty() | 0 |
| 1111 | str += QLatin1String(" ["); | - |
| 1112 | str += foundry; | - |
| 1113 | str += QLatin1Char(']'); | - |
| 1114 | } | 0 |
| 1115 | flist.append(str); | - |
| 1116 | } | 0 |
| 1117 | } | 0 |
| 1118 | } | - |
| 1119 | return flist; executed: return flist;Execution Count:360 | 360 |
| 1120 | } | - |
| 1121 | QStringList QFontDatabase::styles(const QString &family) const | - |
| 1122 | { | - |
| 1123 | QString familyName, foundryName; | - |
| 1124 | parseFontName(family, foundryName, familyName); | - |
| 1125 | | - |
| 1126 | QMutexLocker locker(fontDatabaseMutex()); | - |
| 1127 | | - |
| 1128 | ::load(familyName); | - |
| 1129 | | - |
| 1130 | QStringList l; | - |
| 1131 | QtFontFamily *f = d->family(familyName); | - |
| 1132 | if (!f) evaluated: !f| yes Evaluation Count:1 | yes Evaluation Count:288 |
| 1-288 |
| 1133 | return l; executed: return l;Execution Count:1 | 1 |
| 1134 | | - |
| 1135 | QtFontFoundry allStyles(foundryName); | - |
| 1136 | for (int j = 0; j < f->count; j++) { evaluated: j < f->count| yes Evaluation Count:288 | yes Evaluation Count:288 |
| 288 |
| 1137 | QtFontFoundry *foundry = f->foundries[j]; | - |
| 1138 | if (foundryName.isEmpty() || foundry->name.compare(foundryName, Qt::CaseInsensitive) == 0) { partially evaluated: foundryName.isEmpty()| yes Evaluation Count:288 | no Evaluation Count:0 |
never evaluated: foundry->name.compare(foundryName, Qt::CaseInsensitive) == 0 | 0-288 |
| 1139 | for (int k = 0; k < foundry->count; k++) { evaluated: k < foundry->count| yes Evaluation Count:752 | yes Evaluation Count:288 |
| 288-752 |
| 1140 | QtFontStyle::Key ke(foundry->styles[k]->key); | - |
| 1141 | ke.stretch = 0; | - |
| 1142 | allStyles.style(ke, foundry->styles[k]->styleName, true); | - |
| 1143 | } executed: }Execution Count:752 | 752 |
| 1144 | } executed: }Execution Count:288 | 288 |
| 1145 | } executed: }Execution Count:288 | 288 |
| 1146 | | - |
| 1147 | for (int i = 0; i < allStyles.count; i++) { evaluated: i < allStyles.count| yes Evaluation Count:752 | yes Evaluation Count:288 |
| 288-752 |
| 1148 | l.append(allStyles.styles[i]->styleName.isEmpty() ? | - |
| 1149 | styleStringHelper(allStyles.styles[i]->key.weight, | - |
| 1150 | (QFont::Style)allStyles.styles[i]->key.style) : | - |
| 1151 | allStyles.styles[i]->styleName); | - |
| 1152 | } executed: }Execution Count:752 | 752 |
| 1153 | return l; executed: return l;Execution Count:288 | 288 |
| 1154 | } | - |
| 1155 | | - |
| 1156 | | - |
| 1157 | | - |
| 1158 | | - |
| 1159 | | - |
| 1160 | | - |
| 1161 | bool QFontDatabase::isFixedPitch(const QString &family, | - |
| 1162 | const QString &style) const | - |
| 1163 | { | - |
| 1164 | (void)style;; | - |
| 1165 | | - |
| 1166 | QString familyName, foundryName; | - |
| 1167 | parseFontName(family, foundryName, familyName); | - |
| 1168 | | - |
| 1169 | QMutexLocker locker(fontDatabaseMutex()); | - |
| 1170 | | - |
| 1171 | ::load(familyName); | - |
| 1172 | | - |
| 1173 | QtFontFamily *f = d->family(familyName); | - |
| 1174 | | - |
| 1175 | | - |
| 1176 | | - |
| 1177 | return (f && f->fixedPitch); executed: return (f && f->fixedPitch);Execution Count:366 | 366 |
| 1178 | } | - |
| 1179 | bool QFontDatabase::isBitmapScalable(const QString &family, | - |
| 1180 | const QString &style) const | - |
| 1181 | { | - |
| 1182 | bool bitmapScalable = false; | - |
| 1183 | QString familyName, foundryName; | - |
| 1184 | parseFontName(family, foundryName, familyName); | - |
| 1185 | | - |
| 1186 | QMutexLocker locker(fontDatabaseMutex()); | - |
| 1187 | | - |
| 1188 | ::load(familyName); | - |
| 1189 | | - |
| 1190 | QtFontStyle::Key styleKey(style); | - |
| 1191 | | - |
| 1192 | QtFontFamily *f = d->family(familyName); | - |
| 1193 | if (!f) return bitmapScalable; never executed: return bitmapScalable; | 0 |
| 1194 | | - |
| 1195 | for (int j = 0; j < f->count; j++) { never evaluated: j < f->count | 0 |
| 1196 | QtFontFoundry *foundry = f->foundries[j]; | - |
| 1197 | if (foundryName.isEmpty() || foundry->name.compare(foundryName, Qt::CaseInsensitive) == 0) { never evaluated: foundryName.isEmpty() never evaluated: foundry->name.compare(foundryName, Qt::CaseInsensitive) == 0 | 0 |
| 1198 | for (int k = 0; k < foundry->count; k++) never evaluated: k < foundry->count | 0 |
| 1199 | if ((style.isEmpty() || never evaluated: style.isEmpty() | 0 |
| 1200 | foundry->styles[k]->styleName == style || never evaluated: foundry->styles[k]->styleName == style | 0 |
| 1201 | foundry->styles[k]->key == styleKey) never evaluated: foundry->styles[k]->key == styleKey | 0 |
| 1202 | && foundry->styles[k]->bitmapScalable && !foundry->styles[k]->smoothScalable) { never evaluated: foundry->styles[k]->bitmapScalable never evaluated: !foundry->styles[k]->smoothScalable | 0 |
| 1203 | bitmapScalable = true; | - |
| 1204 | goto end; never executed: goto end; | 0 |
| 1205 | } | - |
| 1206 | } | 0 |
| 1207 | } | 0 |
| 1208 | end: | - |
| 1209 | return bitmapScalable; never executed: return bitmapScalable; | 0 |
| 1210 | } | - |
| 1211 | bool QFontDatabase::isSmoothlyScalable(const QString &family, const QString &style) const | - |
| 1212 | { | - |
| 1213 | bool smoothScalable = false; | - |
| 1214 | QString familyName, foundryName; | - |
| 1215 | parseFontName(family, foundryName, familyName); | - |
| 1216 | | - |
| 1217 | QMutexLocker locker(fontDatabaseMutex()); | - |
| 1218 | | - |
| 1219 | ::load(familyName); | - |
| 1220 | | - |
| 1221 | QtFontStyle::Key styleKey(style); | - |
| 1222 | | - |
| 1223 | QtFontFamily *f = d->family(familyName); | - |
| 1224 | if (!f) return smoothScalable; never executed: return smoothScalable; partially evaluated: !f| no Evaluation Count:0 | yes Evaluation Count:1117 |
| 0-1117 |
| 1225 | | - |
| 1226 | for (int j = 0; j < f->count; j++) { partially evaluated: j < f->count| yes Evaluation Count:1117 | no Evaluation Count:0 |
| 0-1117 |
| 1227 | QtFontFoundry *foundry = f->foundries[j]; | - |
| 1228 | if (foundryName.isEmpty() || foundry->name.compare(foundryName, Qt::CaseInsensitive) == 0) { partially evaluated: foundryName.isEmpty()| yes Evaluation Count:1117 | no Evaluation Count:0 |
never evaluated: foundry->name.compare(foundryName, Qt::CaseInsensitive) == 0 | 0-1117 |
| 1229 | for (int k = 0; k < foundry->count; k++) partially evaluated: k < foundry->count| yes Evaluation Count:1706 | no Evaluation Count:0 |
| 0-1706 |
| 1230 | if ((style.isEmpty() || evaluated: style.isEmpty()| yes Evaluation Count:546 | yes Evaluation Count:1160 |
| 546-1160 |
| 1231 | foundry->styles[k]->styleName == style || evaluated: foundry->styles[k]->styleName == style| yes Evaluation Count:510 | yes Evaluation Count:650 |
| 510-650 |
| 1232 | foundry->styles[k]->key == styleKey) && foundry->styles[k]->smoothScalable) { evaluated: foundry->styles[k]->key == styleKey| yes Evaluation Count:61 | yes Evaluation Count:589 |
partially evaluated: foundry->styles[k]->smoothScalable| yes Evaluation Count:1117 | no Evaluation Count:0 |
| 0-1117 |
| 1233 | smoothScalable = true; | - |
| 1234 | goto end; executed: goto end;Execution Count:1117 | 1117 |
| 1235 | } | - |
| 1236 | } | 0 |
| 1237 | } | 0 |
| 1238 | end: | - |
| 1239 | return smoothScalable; executed: return smoothScalable;Execution Count:1117 | 1117 |
| 1240 | } | - |
| 1241 | | - |
| 1242 | | - |
| 1243 | | - |
| 1244 | | - |
| 1245 | | - |
| 1246 | | - |
| 1247 | | - |
| 1248 | bool QFontDatabase::isScalable(const QString &family, | - |
| 1249 | const QString &style) const | - |
| 1250 | { | - |
| 1251 | QMutexLocker locker(fontDatabaseMutex()); | - |
| 1252 | if (isSmoothlyScalable(family, style)) never evaluated: isSmoothlyScalable(family, style) | 0 |
| 1253 | return true; never executed: return true; | 0 |
| 1254 | return isBitmapScalable(family, style); never executed: return isBitmapScalable(family, style); | 0 |
| 1255 | } | - |
| 1256 | QList<int> QFontDatabase::pointSizes(const QString &family, | - |
| 1257 | const QString &styleName) | - |
| 1258 | { | - |
| 1259 | if (QGuiApplicationPrivate::platformIntegration()->fontDatabase()->fontsAlwaysScalable()) partially evaluated: QGuiApplicationPrivate::platformIntegration()->fontDatabase()->fontsAlwaysScalable()| no Evaluation Count:0 | yes Evaluation Count:209 |
| 0-209 |
| 1260 | return standardSizes(); never executed: return standardSizes(); | 0 |
| 1261 | | - |
| 1262 | bool smoothScalable = false; | - |
| 1263 | QString familyName, foundryName; | - |
| 1264 | parseFontName(family, foundryName, familyName); | - |
| 1265 | | - |
| 1266 | QMutexLocker locker(fontDatabaseMutex()); | - |
| 1267 | | - |
| 1268 | ::load(familyName); | - |
| 1269 | | - |
| 1270 | QtFontStyle::Key styleKey(styleName); | - |
| 1271 | | - |
| 1272 | QList<int> sizes; | - |
| 1273 | | - |
| 1274 | QtFontFamily *fam = d->family(familyName); | - |
| 1275 | if (!fam) return sizes; never executed: return sizes; partially evaluated: !fam| no Evaluation Count:0 | yes Evaluation Count:209 |
| 0-209 |
| 1276 | | - |
| 1277 | | - |
| 1278 | const int dpi = qt_defaultDpiY(); | - |
| 1279 | | - |
| 1280 | for (int j = 0; j < fam->count; j++) { partially evaluated: j < fam->count| yes Evaluation Count:209 | no Evaluation Count:0 |
| 0-209 |
| 1281 | QtFontFoundry *foundry = fam->foundries[j]; | - |
| 1282 | if (foundryName.isEmpty() || foundry->name.compare(foundryName, Qt::CaseInsensitive) == 0) { partially evaluated: foundryName.isEmpty()| yes Evaluation Count:209 | no Evaluation Count:0 |
never evaluated: foundry->name.compare(foundryName, Qt::CaseInsensitive) == 0 | 0-209 |
| 1283 | QtFontStyle *style = foundry->style(styleKey, styleName); | - |
| 1284 | if (!style) continue; never executed: continue; partially evaluated: !style| no Evaluation Count:0 | yes Evaluation Count:209 |
| 0-209 |
| 1285 | | - |
| 1286 | if (style->smoothScalable) { partially evaluated: style->smoothScalable| yes Evaluation Count:209 | no Evaluation Count:0 |
| 0-209 |
| 1287 | smoothScalable = true; | - |
| 1288 | goto end; executed: goto end;Execution Count:209 | 209 |
| 1289 | } | - |
| 1290 | for (int l = 0; l < style->count; l++) { never evaluated: l < style->count | 0 |
| 1291 | const QtFontSize *size = style->pixelSizes + l; | - |
| 1292 | | - |
| 1293 | if (size->pixelSize != 0 && size->pixelSize != (32767 * 2 + 1)) { never evaluated: size->pixelSize != 0 never evaluated: size->pixelSize != (32767 * 2 + 1) | 0 |
| 1294 | const uint pointSize = qRound(size->pixelSize * 72.0 / dpi); | - |
| 1295 | if (! sizes.contains(pointSize)) never evaluated: ! sizes.contains(pointSize) | 0 |
| 1296 | sizes.append(pointSize); never executed: sizes.append(pointSize); | 0 |
| 1297 | } | 0 |
| 1298 | } | 0 |
| 1299 | } | 0 |
| 1300 | } | 0 |
| 1301 | end: code before this statement never executed: end: | 0 |
| 1302 | if (smoothScalable) partially evaluated: smoothScalable| yes Evaluation Count:209 | no Evaluation Count:0 |
| 0-209 |
| 1303 | return standardSizes(); executed: return standardSizes();Execution Count:209 | 209 |
| 1304 | | - |
| 1305 | qSort(sizes); | - |
| 1306 | return sizes; never executed: return sizes; | 0 |
| 1307 | } | - |
| 1308 | | - |
| 1309 | | - |
| 1310 | | - |
| 1311 | | - |
| 1312 | | - |
| 1313 | | - |
| 1314 | | - |
| 1315 | QFont QFontDatabase::font(const QString &family, const QString &style, | - |
| 1316 | int pointSize) const | - |
| 1317 | { | - |
| 1318 | QString familyName, foundryName; | - |
| 1319 | parseFontName(family, foundryName, familyName); | - |
| 1320 | | - |
| 1321 | QMutexLocker locker(fontDatabaseMutex()); | - |
| 1322 | | - |
| 1323 | ::load(familyName); | - |
| 1324 | | - |
| 1325 | QtFontFoundry allStyles(foundryName); | - |
| 1326 | QtFontFamily *f = d->family(familyName); | - |
| 1327 | if (!f) return QGuiApplication::font(); never executed: return QGuiApplication::font(); partially evaluated: !f| no Evaluation Count:0 | yes Evaluation Count:834 |
| 0-834 |
| 1328 | | - |
| 1329 | for (int j = 0; j < f->count; j++) { evaluated: j < f->count| yes Evaluation Count:834 | yes Evaluation Count:834 |
| 834 |
| 1330 | QtFontFoundry *foundry = f->foundries[j]; | - |
| 1331 | if (foundryName.isEmpty() || foundry->name.compare(foundryName, Qt::CaseInsensitive) == 0) { partially evaluated: foundryName.isEmpty()| yes Evaluation Count:834 | no Evaluation Count:0 |
never evaluated: foundry->name.compare(foundryName, Qt::CaseInsensitive) == 0 | 0-834 |
| 1332 | for (int k = 0; k < foundry->count; k++) evaluated: k < foundry->count| yes Evaluation Count:2557 | yes Evaluation Count:834 |
| 834-2557 |
| 1333 | allStyles.style(foundry->styles[k]->key, foundry->styles[k]->styleName, true); executed: allStyles.style(foundry->styles[k]->key, foundry->styles[k]->styleName, true);Execution Count:2557 | 2557 |
| 1334 | } executed: }Execution Count:834 | 834 |
| 1335 | } executed: }Execution Count:834 | 834 |
| 1336 | | - |
| 1337 | QtFontStyle::Key styleKey(style); | - |
| 1338 | QtFontStyle *s = bestStyle(&allStyles, styleKey, style); | - |
| 1339 | | - |
| 1340 | if (!s) partially evaluated: !s| no Evaluation Count:0 | yes Evaluation Count:834 |
| 0-834 |
| 1341 | return QGuiApplication::font(); never executed: return QGuiApplication::font(); | 0 |
| 1342 | | - |
| 1343 | QFont fnt(family, pointSize, s->key.weight); | - |
| 1344 | fnt.setStyle((QFont::Style)s->key.style); | - |
| 1345 | if (!s->styleName.isEmpty()) evaluated: !s->styleName.isEmpty()| yes Evaluation Count:761 | yes Evaluation Count:73 |
| 73-761 |
| 1346 | fnt.setStyleName(s->styleName); executed: fnt.setStyleName(s->styleName);Execution Count:761 | 761 |
| 1347 | return fnt; executed: return fnt;Execution Count:834 | 834 |
| 1348 | } | - |
| 1349 | QList<int> QFontDatabase::smoothSizes(const QString &family, | - |
| 1350 | const QString &styleName) | - |
| 1351 | { | - |
| 1352 | if (QGuiApplicationPrivate::platformIntegration()->fontDatabase()->fontsAlwaysScalable()) never evaluated: QGuiApplicationPrivate::platformIntegration()->fontDatabase()->fontsAlwaysScalable() | 0 |
| 1353 | return standardSizes(); never executed: return standardSizes(); | 0 |
| 1354 | | - |
| 1355 | bool smoothScalable = false; | - |
| 1356 | QString familyName, foundryName; | - |
| 1357 | parseFontName(family, foundryName, familyName); | - |
| 1358 | | - |
| 1359 | QMutexLocker locker(fontDatabaseMutex()); | - |
| 1360 | | - |
| 1361 | ::load(familyName); | - |
| 1362 | | - |
| 1363 | QtFontStyle::Key styleKey(styleName); | - |
| 1364 | | - |
| 1365 | QList<int> sizes; | - |
| 1366 | | - |
| 1367 | QtFontFamily *fam = d->family(familyName); | - |
| 1368 | if (!fam) | 0 |
| 1369 | return sizes; never executed: return sizes; | 0 |
| 1370 | | - |
| 1371 | const int dpi = qt_defaultDpiY(); | - |
| 1372 | | - |
| 1373 | for (int j = 0; j < fam->count; j++) { never evaluated: j < fam->count | 0 |
| 1374 | QtFontFoundry *foundry = fam->foundries[j]; | - |
| 1375 | if (foundryName.isEmpty() || foundry->name.compare(foundryName, Qt::CaseInsensitive) == 0) { never evaluated: foundryName.isEmpty() never evaluated: foundry->name.compare(foundryName, Qt::CaseInsensitive) == 0 | 0 |
| 1376 | QtFontStyle *style = foundry->style(styleKey, styleName); | - |
| 1377 | if (!style) continue; never executed: continue; | 0 |
| 1378 | | - |
| 1379 | if (style->smoothScalable) { never evaluated: style->smoothScalable | 0 |
| 1380 | smoothScalable = true; | - |
| 1381 | goto end; never executed: goto end; | 0 |
| 1382 | } | - |
| 1383 | for (int l = 0; l < style->count; l++) { never evaluated: l < style->count | 0 |
| 1384 | const QtFontSize *size = style->pixelSizes + l; | - |
| 1385 | | - |
| 1386 | if (size->pixelSize != 0 && size->pixelSize != (32767 * 2 + 1)) { never evaluated: size->pixelSize != 0 never evaluated: size->pixelSize != (32767 * 2 + 1) | 0 |
| 1387 | const uint pointSize = qRound(size->pixelSize * 72.0 / dpi); | - |
| 1388 | if (! sizes.contains(pointSize)) never evaluated: ! sizes.contains(pointSize) | 0 |
| 1389 | sizes.append(pointSize); never executed: sizes.append(pointSize); | 0 |
| 1390 | } | 0 |
| 1391 | } | 0 |
| 1392 | } | 0 |
| 1393 | } | 0 |
| 1394 | end: code before this statement never executed: end: | 0 |
| 1395 | if (smoothScalable) never evaluated: smoothScalable | 0 |
| 1396 | return QFontDatabase::standardSizes(); never executed: return QFontDatabase::standardSizes(); | 0 |
| 1397 | | - |
| 1398 | qSort(sizes); | - |
| 1399 | return sizes; never executed: return sizes; | 0 |
| 1400 | } | - |
| 1401 | | - |
| 1402 | | - |
| 1403 | | - |
| 1404 | | - |
| 1405 | | - |
| 1406 | | - |
| 1407 | | - |
| 1408 | QList<int> QFontDatabase::standardSizes() | - |
| 1409 | { | - |
| 1410 | return QGuiApplicationPrivate::platformIntegration()->fontDatabase()->standardSizes(); executed: return QGuiApplicationPrivate::platformIntegration()->fontDatabase()->standardSizes();Execution Count:209 | 209 |
| 1411 | } | - |
| 1412 | bool QFontDatabase::italic(const QString &family, const QString &style) const | - |
| 1413 | { | - |
| 1414 | QString familyName, foundryName; | - |
| 1415 | parseFontName(family, foundryName, familyName); | - |
| 1416 | | - |
| 1417 | QMutexLocker locker(fontDatabaseMutex()); | - |
| 1418 | | - |
| 1419 | ::load(familyName); | - |
| 1420 | | - |
| 1421 | QtFontFoundry allStyles(foundryName); | - |
| 1422 | QtFontFamily *f = d->family(familyName); | - |
| 1423 | if (!f) return false; never executed: return false; | 0 |
| 1424 | | - |
| 1425 | for (int j = 0; j < f->count; j++) { never evaluated: j < f->count | 0 |
| 1426 | QtFontFoundry *foundry = f->foundries[j]; | - |
| 1427 | if (foundryName.isEmpty() || foundry->name.compare(foundryName, Qt::CaseInsensitive) == 0) { never evaluated: foundryName.isEmpty() never evaluated: foundry->name.compare(foundryName, Qt::CaseInsensitive) == 0 | 0 |
| 1428 | for (int k = 0; k < foundry->count; k++) never evaluated: k < foundry->count | 0 |
| 1429 | allStyles.style(foundry->styles[k]->key, foundry->styles[k]->styleName, true); never executed: allStyles.style(foundry->styles[k]->key, foundry->styles[k]->styleName, true); | 0 |
| 1430 | } | 0 |
| 1431 | } | 0 |
| 1432 | | - |
| 1433 | QtFontStyle::Key styleKey(style); | - |
| 1434 | QtFontStyle *s = allStyles.style(styleKey, style); | - |
| 1435 | return s && s->key.style == QFont::StyleItalic; never executed: return s && s->key.style == QFont::StyleItalic; | 0 |
| 1436 | } | - |
| 1437 | bool QFontDatabase::bold(const QString &family, | - |
| 1438 | const QString &style) const | - |
| 1439 | { | - |
| 1440 | QString familyName, foundryName; | - |
| 1441 | parseFontName(family, foundryName, familyName); | - |
| 1442 | | - |
| 1443 | QMutexLocker locker(fontDatabaseMutex()); | - |
| 1444 | | - |
| 1445 | ::load(familyName); | - |
| 1446 | | - |
| 1447 | QtFontFoundry allStyles(foundryName); | - |
| 1448 | QtFontFamily *f = d->family(familyName); | - |
| 1449 | if (!f) return false; never executed: return false; | 0 |
| 1450 | | - |
| 1451 | for (int j = 0; j < f->count; j++) { never evaluated: j < f->count | 0 |
| 1452 | QtFontFoundry *foundry = f->foundries[j]; | - |
| 1453 | if (foundryName.isEmpty() || never evaluated: foundryName.isEmpty() | 0 |
| 1454 | foundry->name.compare(foundryName, Qt::CaseInsensitive) == 0) { never evaluated: foundry->name.compare(foundryName, Qt::CaseInsensitive) == 0 | 0 |
| 1455 | for (int k = 0; k < foundry->count; k++) never evaluated: k < foundry->count | 0 |
| 1456 | allStyles.style(foundry->styles[k]->key, foundry->styles[k]->styleName, true); never executed: allStyles.style(foundry->styles[k]->key, foundry->styles[k]->styleName, true); | 0 |
| 1457 | } | 0 |
| 1458 | } | 0 |
| 1459 | | - |
| 1460 | QtFontStyle::Key styleKey(style); | - |
| 1461 | QtFontStyle *s = allStyles.style(styleKey, style); | - |
| 1462 | return s && s->key.weight >= QFont::Bold; never executed: return s && s->key.weight >= QFont::Bold; | 0 |
| 1463 | } | - |
| 1464 | int QFontDatabase::weight(const QString &family, | - |
| 1465 | const QString &style) const | - |
| 1466 | { | - |
| 1467 | QString familyName, foundryName; | - |
| 1468 | parseFontName(family, foundryName, familyName); | - |
| 1469 | | - |
| 1470 | QMutexLocker locker(fontDatabaseMutex()); | - |
| 1471 | | - |
| 1472 | ::load(familyName); | - |
| 1473 | | - |
| 1474 | QtFontFoundry allStyles(foundryName); | - |
| 1475 | QtFontFamily *f = d->family(familyName); | - |
| 1476 | if (!f) return -1; never executed: return -1; | 0 |
| 1477 | | - |
| 1478 | for (int j = 0; j < f->count; j++) { never evaluated: j < f->count | 0 |
| 1479 | QtFontFoundry *foundry = f->foundries[j]; | - |
| 1480 | if (foundryName.isEmpty() || never evaluated: foundryName.isEmpty() | 0 |
| 1481 | foundry->name.compare(foundryName, Qt::CaseInsensitive) == 0) { never evaluated: foundry->name.compare(foundryName, Qt::CaseInsensitive) == 0 | 0 |
| 1482 | for (int k = 0; k < foundry->count; k++) never evaluated: k < foundry->count | 0 |
| 1483 | allStyles.style(foundry->styles[k]->key, foundry->styles[k]->styleName, true); never executed: allStyles.style(foundry->styles[k]->key, foundry->styles[k]->styleName, true); | 0 |
| 1484 | } | 0 |
| 1485 | } | 0 |
| 1486 | | - |
| 1487 | QtFontStyle::Key styleKey(style); | - |
| 1488 | QtFontStyle *s = allStyles.style(styleKey, style); | - |
| 1489 | return s ? s->key.weight : -1; never executed: return s ? s->key.weight : -1; | 0 |
| 1490 | } | - |
| 1491 | | - |
| 1492 | | - |
| 1493 | | - |
| 1494 | bool QFontDatabase::hasFamily(const QString &family) const | - |
| 1495 | { | - |
| 1496 | QString parsedFamily, foundry; | - |
| 1497 | parseFontName(family, foundry, parsedFamily); | - |
| 1498 | const QString familyAlias = resolveFontFamilyAlias(parsedFamily); | - |
| 1499 | return families().contains(familyAlias, Qt::CaseInsensitive); executed: return families().contains(familyAlias, Qt::CaseInsensitive);Execution Count:5 | 5 |
| 1500 | } | - |
| 1501 | | - |
| 1502 | | - |
| 1503 | | - |
| 1504 | | - |
| 1505 | | - |
| 1506 | | - |
| 1507 | QString QFontDatabase::writingSystemName(WritingSystem writingSystem) | - |
| 1508 | { | - |
| 1509 | const char *name = 0; | - |
| 1510 | switch (writingSystem) { | - |
| 1511 | case Any: | - |
| 1512 | name = "Any"; | - |
| 1513 | break; executed: break;Execution Count:3 | 3 |
| 1514 | case Latin: | - |
| 1515 | name = "Latin"; | - |
| 1516 | break; executed: break;Execution Count:3 | 3 |
| 1517 | case Greek: | - |
| 1518 | name = "Greek"; | - |
| 1519 | break; executed: break;Execution Count:3 | 3 |
| 1520 | case Cyrillic: | - |
| 1521 | name = "Cyrillic"; | - |
| 1522 | break; executed: break;Execution Count:3 | 3 |
| 1523 | case Armenian: | - |
| 1524 | name = "Armenian"; | - |
| 1525 | break; executed: break;Execution Count:3 | 3 |
| 1526 | case Hebrew: | - |
| 1527 | name = "Hebrew"; | - |
| 1528 | break; executed: break;Execution Count:3 | 3 |
| 1529 | case Arabic: | - |
| 1530 | name = "Arabic"; | - |
| 1531 | break; executed: break;Execution Count:3 | 3 |
| 1532 | case Syriac: | - |
| 1533 | name = "Syriac"; | - |
| 1534 | break; executed: break;Execution Count:3 | 3 |
| 1535 | case Thaana: | - |
| 1536 | name = "Thaana"; | - |
| 1537 | break; executed: break;Execution Count:3 | 3 |
| 1538 | case Devanagari: | - |
| 1539 | name = "Devanagari"; | - |
| 1540 | break; executed: break;Execution Count:3 | 3 |
| 1541 | case Bengali: | - |
| 1542 | name = "Bengali"; | - |
| 1543 | break; executed: break;Execution Count:3 | 3 |
| 1544 | case Gurmukhi: | - |
| 1545 | name = "Gurmukhi"; | - |
| 1546 | break; executed: break;Execution Count:3 | 3 |
| 1547 | case Gujarati: | - |
| 1548 | name = "Gujarati"; | - |
| 1549 | break; executed: break;Execution Count:3 | 3 |
| 1550 | case Oriya: | - |
| 1551 | name = "Oriya"; | - |
| 1552 | break; executed: break;Execution Count:3 | 3 |
| 1553 | case Tamil: | - |
| 1554 | name = "Tamil"; | - |
| 1555 | break; executed: break;Execution Count:3 | 3 |
| 1556 | case Telugu: | - |
| 1557 | name = "Telugu"; | - |
| 1558 | break; executed: break;Execution Count:3 | 3 |
| 1559 | case Kannada: | - |
| 1560 | name = "Kannada"; | - |
| 1561 | break; executed: break;Execution Count:3 | 3 |
| 1562 | case Malayalam: | - |
| 1563 | name = "Malayalam"; | - |
| 1564 | break; executed: break;Execution Count:3 | 3 |
| 1565 | case Sinhala: | - |
| 1566 | name = "Sinhala"; | - |
| 1567 | break; executed: break;Execution Count:3 | 3 |
| 1568 | case Thai: | - |
| 1569 | name = "Thai"; | - |
| 1570 | break; executed: break;Execution Count:3 | 3 |
| 1571 | case Lao: | - |
| 1572 | name = "Lao"; | - |
| 1573 | break; executed: break;Execution Count:3 | 3 |
| 1574 | case Tibetan: | - |
| 1575 | name = "Tibetan"; | - |
| 1576 | break; executed: break;Execution Count:3 | 3 |
| 1577 | case Myanmar: | - |
| 1578 | name = "Myanmar"; | - |
| 1579 | break; executed: break;Execution Count:3 | 3 |
| 1580 | case Georgian: | - |
| 1581 | name = "Georgian"; | - |
| 1582 | break; executed: break;Execution Count:3 | 3 |
| 1583 | case Khmer: | - |
| 1584 | name = "Khmer"; | - |
| 1585 | break; executed: break;Execution Count:3 | 3 |
| 1586 | case SimplifiedChinese: | - |
| 1587 | name = "Simplified Chinese"; | - |
| 1588 | break; executed: break;Execution Count:3 | 3 |
| 1589 | case TraditionalChinese: | - |
| 1590 | name = "Traditional Chinese"; | - |
| 1591 | break; executed: break;Execution Count:3 | 3 |
| 1592 | case Japanese: | - |
| 1593 | name = "Japanese"; | - |
| 1594 | break; executed: break;Execution Count:3 | 3 |
| 1595 | case Korean: | - |
| 1596 | name = "Korean"; | - |
| 1597 | break; executed: break;Execution Count:3 | 3 |
| 1598 | case Vietnamese: | - |
| 1599 | name = "Vietnamese"; | - |
| 1600 | break; executed: break;Execution Count:3 | 3 |
| 1601 | case Symbol: | - |
| 1602 | name = "Symbol"; | - |
| 1603 | break; executed: break;Execution Count:3 | 3 |
| 1604 | case Ogham: | - |
| 1605 | name = "Ogham"; | - |
| 1606 | break; executed: break;Execution Count:3 | 3 |
| 1607 | case Runic: | - |
| 1608 | name = "Runic"; | - |
| 1609 | break; executed: break;Execution Count:3 | 3 |
| 1610 | case Nko: | - |
| 1611 | name = "N'Ko"; | - |
| 1612 | break; executed: break;Execution Count:3 | 3 |
| 1613 | default: | - |
| 1614 | qt_noop(); | - |
| 1615 | break; | 0 |
| 1616 | } | - |
| 1617 | return QCoreApplication::translate("QFontDatabase", name); executed: return QCoreApplication::translate("QFontDatabase", name);Execution Count:102 | 102 |
| 1618 | } | - |
| 1619 | | - |
| 1620 | | - |
| 1621 | | - |
| 1622 | | - |
| 1623 | | - |
| 1624 | QString QFontDatabase::writingSystemSample(WritingSystem writingSystem) | - |
| 1625 | { | - |
| 1626 | QString sample; | - |
| 1627 | switch (writingSystem) { | - |
| 1628 | case Any: | - |
| 1629 | case Symbol: | - |
| 1630 | | - |
| 1631 | sample += QLatin1String("AaBbzZ"); | - |
| 1632 | break; | 0 |
| 1633 | case Latin: | - |
| 1634 | | - |
| 1635 | | - |
| 1636 | sample = QLatin1String("Aa"); | - |
| 1637 | sample += QChar(0x00C3); | - |
| 1638 | sample += QChar(0x00E1); | - |
| 1639 | sample += QLatin1String("Zz"); | - |
| 1640 | break; | 0 |
| 1641 | case Greek: | - |
| 1642 | sample += QChar(0x0393); | - |
| 1643 | sample += QChar(0x03B1); | - |
| 1644 | sample += QChar(0x03A9); | - |
| 1645 | sample += QChar(0x03C9); | - |
| 1646 | break; | 0 |
| 1647 | case Cyrillic: | - |
| 1648 | sample += QChar(0x0414); | - |
| 1649 | sample += QChar(0x0434); | - |
| 1650 | sample += QChar(0x0436); | - |
| 1651 | sample += QChar(0x044f); | - |
| 1652 | break; | 0 |
| 1653 | case Armenian: | - |
| 1654 | sample += QChar(0x053f); | - |
| 1655 | sample += QChar(0x054f); | - |
| 1656 | sample += QChar(0x056f); | - |
| 1657 | sample += QChar(0x057f); | - |
| 1658 | break; | 0 |
| 1659 | case Hebrew: | - |
| 1660 | sample += QChar(0x05D0); | - |
| 1661 | sample += QChar(0x05D1); | - |
| 1662 | sample += QChar(0x05D2); | - |
| 1663 | sample += QChar(0x05D3); | - |
| 1664 | break; | 0 |
| 1665 | case Arabic: | - |
| 1666 | sample += QChar(0x0628); | - |
| 1667 | sample += QChar(0x0629); | - |
| 1668 | sample += QChar(0x062A); | - |
| 1669 | sample += QChar(0x063A); | - |
| 1670 | break; executed: break;Execution Count:4 | 4 |
| 1671 | case Syriac: | - |
| 1672 | sample += QChar(0x0715); | - |
| 1673 | sample += QChar(0x0725); | - |
| 1674 | sample += QChar(0x0716); | - |
| 1675 | sample += QChar(0x0726); | - |
| 1676 | break; | 0 |
| 1677 | case Thaana: | - |
| 1678 | sample += QChar(0x0784); | - |
| 1679 | sample += QChar(0x0794); | - |
| 1680 | sample += QChar(0x078c); | - |
| 1681 | sample += QChar(0x078d); | - |
| 1682 | break; | 0 |
| 1683 | case Devanagari: | - |
| 1684 | sample += QChar(0x0905); | - |
| 1685 | sample += QChar(0x0915); | - |
| 1686 | sample += QChar(0x0925); | - |
| 1687 | sample += QChar(0x0935); | - |
| 1688 | break; | 0 |
| 1689 | case Bengali: | - |
| 1690 | sample += QChar(0x0986); | - |
| 1691 | sample += QChar(0x0996); | - |
| 1692 | sample += QChar(0x09a6); | - |
| 1693 | sample += QChar(0x09b6); | - |
| 1694 | break; | 0 |
| 1695 | case Gurmukhi: | - |
| 1696 | sample += QChar(0x0a05); | - |
| 1697 | sample += QChar(0x0a15); | - |
| 1698 | sample += QChar(0x0a25); | - |
| 1699 | sample += QChar(0x0a35); | - |
| 1700 | break; | 0 |
| 1701 | case Gujarati: | - |
| 1702 | sample += QChar(0x0a85); | - |
| 1703 | sample += QChar(0x0a95); | - |
| 1704 | sample += QChar(0x0aa5); | - |
| 1705 | sample += QChar(0x0ab5); | - |
| 1706 | break; | 0 |
| 1707 | case Oriya: | - |
| 1708 | sample += QChar(0x0b06); | - |
| 1709 | sample += QChar(0x0b16); | - |
| 1710 | sample += QChar(0x0b2b); | - |
| 1711 | sample += QChar(0x0b36); | - |
| 1712 | break; | 0 |
| 1713 | case Tamil: | - |
| 1714 | sample += QChar(0x0b89); | - |
| 1715 | sample += QChar(0x0b99); | - |
| 1716 | sample += QChar(0x0ba9); | - |
| 1717 | sample += QChar(0x0bb9); | - |
| 1718 | break; | 0 |
| 1719 | case Telugu: | - |
| 1720 | sample += QChar(0x0c05); | - |
| 1721 | sample += QChar(0x0c15); | - |
| 1722 | sample += QChar(0x0c25); | - |
| 1723 | sample += QChar(0x0c35); | - |
| 1724 | break; | 0 |
| 1725 | case Kannada: | - |
| 1726 | sample += QChar(0x0c85); | - |
| 1727 | sample += QChar(0x0c95); | - |
| 1728 | sample += QChar(0x0ca5); | - |
| 1729 | sample += QChar(0x0cb5); | - |
| 1730 | break; | 0 |
| 1731 | case Malayalam: | - |
| 1732 | sample += QChar(0x0d05); | - |
| 1733 | sample += QChar(0x0d15); | - |
| 1734 | sample += QChar(0x0d25); | - |
| 1735 | sample += QChar(0x0d35); | - |
| 1736 | break; | 0 |
| 1737 | case Sinhala: | - |
| 1738 | sample += QChar(0x0d90); | - |
| 1739 | sample += QChar(0x0da0); | - |
| 1740 | sample += QChar(0x0db0); | - |
| 1741 | sample += QChar(0x0dc0); | - |
| 1742 | break; | 0 |
| 1743 | case Thai: | - |
| 1744 | sample += QChar(0x0e02); | - |
| 1745 | sample += QChar(0x0e12); | - |
| 1746 | sample += QChar(0x0e22); | - |
| 1747 | sample += QChar(0x0e32); | - |
| 1748 | break; | 0 |
| 1749 | case Lao: | - |
| 1750 | sample += QChar(0x0e8d); | - |
| 1751 | sample += QChar(0x0e9d); | - |
| 1752 | sample += QChar(0x0ead); | - |
| 1753 | sample += QChar(0x0ebd); | - |
| 1754 | break; | 0 |
| 1755 | case Tibetan: | - |
| 1756 | sample += QChar(0x0f00); | - |
| 1757 | sample += QChar(0x0f01); | - |
| 1758 | sample += QChar(0x0f02); | - |
| 1759 | sample += QChar(0x0f03); | - |
| 1760 | break; | 0 |
| 1761 | case Myanmar: | - |
| 1762 | sample += QChar(0x1000); | - |
| 1763 | sample += QChar(0x1001); | - |
| 1764 | sample += QChar(0x1002); | - |
| 1765 | sample += QChar(0x1003); | - |
| 1766 | break; | 0 |
| 1767 | case Georgian: | - |
| 1768 | sample += QChar(0x10a0); | - |
| 1769 | sample += QChar(0x10b0); | - |
| 1770 | sample += QChar(0x10c0); | - |
| 1771 | sample += QChar(0x10d0); | - |
| 1772 | break; | 0 |
| 1773 | case Khmer: | - |
| 1774 | sample += QChar(0x1780); | - |
| 1775 | sample += QChar(0x1790); | - |
| 1776 | sample += QChar(0x17b0); | - |
| 1777 | sample += QChar(0x17c0); | - |
| 1778 | break; | 0 |
| 1779 | case SimplifiedChinese: | - |
| 1780 | sample += QChar(0x4e2d); | - |
| 1781 | sample += QChar(0x6587); | - |
| 1782 | sample += QChar(0x8303); | - |
| 1783 | sample += QChar(0x4f8b); | - |
| 1784 | break; | 0 |
| 1785 | case TraditionalChinese: | - |
| 1786 | sample += QChar(0x4e2d); | - |
| 1787 | sample += QChar(0x6587); | - |
| 1788 | sample += QChar(0x7bc4); | - |
| 1789 | sample += QChar(0x4f8b); | - |
| 1790 | break; | 0 |
| 1791 | case Japanese: | - |
| 1792 | sample += QChar(0x30b5); | - |
| 1793 | sample += QChar(0x30f3); | - |
| 1794 | sample += QChar(0x30d7); | - |
| 1795 | sample += QChar(0x30eb); | - |
| 1796 | sample += QChar(0x3067); | - |
| 1797 | sample += QChar(0x3059); | - |
| 1798 | break; | 0 |
| 1799 | case Korean: | - |
| 1800 | sample += QChar(0xac00); | - |
| 1801 | sample += QChar(0xac11); | - |
| 1802 | sample += QChar(0xac1a); | - |
| 1803 | sample += QChar(0xac2f); | - |
| 1804 | break; | 0 |
| 1805 | case Vietnamese: | - |
| 1806 | { | - |
| 1807 | static const char vietnameseUtf8[] = { | - |
| 1808 | char(0xef), char(0xbb), char(0xbf), char(0xe1), char(0xbb), char(0x97), | - |
| 1809 | char(0xe1), char(0xbb), char(0x99), | - |
| 1810 | char(0xe1), char(0xbb), char(0x91), | - |
| 1811 | char(0xe1), char(0xbb), char(0x93), | - |
| 1812 | }; | - |
| 1813 | sample += QString::fromUtf8(vietnameseUtf8, sizeof(vietnameseUtf8)); | - |
| 1814 | break; | 0 |
| 1815 | } | - |
| 1816 | case Ogham: | - |
| 1817 | sample += QChar(0x1681); | - |
| 1818 | sample += QChar(0x1682); | - |
| 1819 | sample += QChar(0x1683); | - |
| 1820 | sample += QChar(0x1684); | - |
| 1821 | break; | 0 |
| 1822 | case Runic: | - |
| 1823 | sample += QChar(0x16a0); | - |
| 1824 | sample += QChar(0x16a1); | - |
| 1825 | sample += QChar(0x16a2); | - |
| 1826 | sample += QChar(0x16a3); | - |
| 1827 | break; | 0 |
| 1828 | case Nko: | - |
| 1829 | sample += QChar(0x7ca); | - |
| 1830 | sample += QChar(0x7cb); | - |
| 1831 | sample += QChar(0x7cc); | - |
| 1832 | sample += QChar(0x7cd); | - |
| 1833 | break; | 0 |
| 1834 | default: | - |
| 1835 | break; | 0 |
| 1836 | } | - |
| 1837 | return sample; executed: return sample;Execution Count:4 | 4 |
| 1838 | } | - |
| 1839 | | - |
| 1840 | | - |
| 1841 | void QFontDatabase::parseFontName(const QString &name, QString &foundry, QString &family) | - |
| 1842 | { | - |
| 1843 | ::parseFontName(name, foundry, family); | - |
| 1844 | } executed: }Execution Count:3908 | 3908 |
| 1845 | | - |
| 1846 | void QFontDatabase::createDatabase() | - |
| 1847 | { initializeDb(); } executed: }Execution Count:374 | 374 |
| 1848 | | - |
| 1849 | | - |
| 1850 | __attribute__((visibility("default"))) QByteArray qt_fontdata_from_index(int index) | - |
| 1851 | { | - |
| 1852 | QMutexLocker locker(fontDatabaseMutex()); | - |
| 1853 | return privateDb()->applicationFonts.value(index).data; never executed: return privateDb()->applicationFonts.value(index).data; | 0 |
| 1854 | } | - |
| 1855 | | - |
| 1856 | int QFontDatabasePrivate::addAppFont(const QByteArray &fontData, const QString &fileName) | - |
| 1857 | { | - |
| 1858 | QFontDatabasePrivate::ApplicationFont font; | - |
| 1859 | font.data = fontData; | - |
| 1860 | font.fileName = fileName; | - |
| 1861 | | - |
| 1862 | int i; | - |
| 1863 | for (i = 0; i < applicationFonts.count(); ++i) evaluated: i < applicationFonts.count()| yes Evaluation Count:17 | yes Evaluation Count:4 |
| 4-17 |
| 1864 | if (applicationFonts.at(i).families.isEmpty()) partially evaluated: applicationFonts.at(i).families.isEmpty()| yes Evaluation Count:17 | no Evaluation Count:0 |
| 0-17 |
| 1865 | break; executed: break;Execution Count:17 | 17 |
| 1866 | if (i >= applicationFonts.count()) { evaluated: i >= applicationFonts.count()| yes Evaluation Count:4 | yes Evaluation Count:17 |
| 4-17 |
| 1867 | applicationFonts.append(ApplicationFont()); | - |
| 1868 | i = applicationFonts.count() - 1; | - |
| 1869 | } executed: }Execution Count:4 | 4 |
| 1870 | | - |
| 1871 | if (font.fileName.isEmpty() && !fontData.isEmpty()) evaluated: font.fileName.isEmpty()| yes Evaluation Count:1 | yes Evaluation Count:20 |
partially evaluated: !fontData.isEmpty()| yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-20 |
| 1872 | font.fileName = QString::fromLatin1(":qmemoryfonts/") + QString::number(i); executed: font.fileName = QString::fromLatin1(":qmemoryfonts/") + QString::number(i);Execution Count:1 | 1 |
| 1873 | | - |
| 1874 | registerFont(&font); | - |
| 1875 | if (font.families.isEmpty()) partially evaluated: font.families.isEmpty()| no Evaluation Count:0 | yes Evaluation Count:21 |
| 0-21 |
| 1876 | return -1; never executed: return -1; | 0 |
| 1877 | | - |
| 1878 | applicationFonts[i] = font; | - |
| 1879 | | - |
| 1880 | invalidate(); | - |
| 1881 | return i; executed: return i;Execution Count:21 | 21 |
| 1882 | } | - |
| 1883 | | - |
| 1884 | bool QFontDatabasePrivate::isApplicationFont(const QString &fileName) | - |
| 1885 | { | - |
| 1886 | for (int i = 0; i < applicationFonts.count(); ++i) never evaluated: i < applicationFonts.count() | 0 |
| 1887 | if (applicationFonts.at(i).fileName == fileName) never evaluated: applicationFonts.at(i).fileName == fileName | 0 |
| 1888 | return true; never executed: return true; | 0 |
| 1889 | return false; never executed: return false; | 0 |
| 1890 | } | - |
| 1891 | int QFontDatabase::addApplicationFont(const QString &fileName) | - |
| 1892 | { | - |
| 1893 | QByteArray data; | - |
| 1894 | if (!QFileInfo(fileName).isNativePath()) { evaluated: !QFileInfo(fileName).isNativePath()| yes Evaluation Count:1 | yes Evaluation Count:19 |
| 1-19 |
| 1895 | QFile f(fileName); | - |
| 1896 | if (!f.open(QIODevice::ReadOnly)) partially evaluated: !f.open(QIODevice::ReadOnly)| no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
| 1897 | return -1; never executed: return -1; | 0 |
| 1898 | data = f.readAll(); | - |
| 1899 | } executed: }Execution Count:1 | 1 |
| 1900 | QMutexLocker locker(fontDatabaseMutex()); | - |
| 1901 | return privateDb()->addAppFont(data, fileName); executed: return privateDb()->addAppFont(data, fileName);Execution Count:20 | 20 |
| 1902 | } | - |
| 1903 | int QFontDatabase::addApplicationFontFromData(const QByteArray &fontData) | - |
| 1904 | { | - |
| 1905 | QMutexLocker locker(fontDatabaseMutex()); | - |
| 1906 | return privateDb()->addAppFont(fontData, QString() ); executed: return privateDb()->addAppFont(fontData, QString() );Execution Count:1 | 1 |
| 1907 | } | - |
| 1908 | QStringList QFontDatabase::applicationFontFamilies(int id) | - |
| 1909 | { | - |
| 1910 | QMutexLocker locker(fontDatabaseMutex()); | - |
| 1911 | return privateDb()->applicationFonts.value(id).families; executed: return privateDb()->applicationFonts.value(id).families;Execution Count:2 | 2 |
| 1912 | } | - |
| 1913 | | - |
| 1914 | | - |
| | |