| Line | Source | Count |
| 1 | | - |
| 2 | | - |
| 3 | | - |
| 4 | | - |
| 5 | | - |
| 6 | | - |
| 7 | | - |
| 8 | | - |
| 9 | | - |
| 10 | | - |
| 11 | | - |
| 12 | | - |
| 13 | | - |
| 14 | | - |
| 15 | | - |
| 16 | | - |
| 17 | | - |
| 18 | | - |
| 19 | | - |
| 20 | | - |
| 21 | | - |
| 22 | | - |
| 23 | | - |
| 24 | | - |
| 25 | | - |
| 26 | | - |
| 27 | | - |
| 28 | | - |
| 29 | | - |
| 30 | | - |
| 31 | | - |
| 32 | | - |
| 33 | | - |
| 34 | | - |
| 35 | | - |
| 36 | | - |
| 37 | | - |
| 38 | | - |
| 39 | | - |
| 40 | #include "qplatformfontdatabase.h" | - |
| 41 | #include <QtGui/private/qfontengine_p.h> | - |
| 42 | #include <QtGui/private/qfontengine_qpf2_p.h> | - |
| 43 | #include <QtGui/QGuiApplication> | - |
| 44 | #include <QtGui/QScreen> | - |
| 45 | #include <qpa/qplatformscreen.h> | - |
| 46 | #include <QtCore/QLibraryInfo> | - |
| 47 | #include <QtCore/QDir> | - |
| 48 | | - |
| 49 | #include <algorithm> | - |
| 50 | #include <iterator> | - |
| 51 | | - |
| 52 | QT_BEGIN_NAMESPACE | - |
| 53 | | - |
| 54 | void qt_registerFont(const QString &familyname, const QString &stylename, | - |
| 55 | const QString &foundryname, int weight, | - |
| 56 | QFont::Style style, int stretch, bool antialiased, | - |
| 57 | bool scalable, int pixelSize, bool fixedPitch, | - |
| 58 | const QSupportedWritingSystems &writingSystems, void *hanlde); | - |
| 59 | | - |
| 60 | void qt_registerFontFamily(const QString &familyName); | - |
| 61 | void qt_registerAliasToFontFamily(const QString &familyName, const QString &alias); | - |
| 62 | | - |
| 63 | | - |
| 64 | | - |
| 65 | | - |
| 66 | | - |
| 67 | | - |
| 68 | | - |
| 69 | | - |
| 70 | void QPlatformFontDatabase::registerQPF2Font(const QByteArray &dataArray, void *handle) | - |
| 71 | { | - |
| 72 | if (dataArray.size() == 0)| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 73 | return; never executed: return; | 0 |
| 74 | | - |
| 75 | const uchar *data = reinterpret_cast<const uchar *>(dataArray.constData()); | - |
| 76 | if (QFontEngineQPF2::verifyHeader(data, dataArray.size())) {| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 77 | QString fontName = QFontEngineQPF2::extractHeaderField(data, QFontEngineQPF2::Tag_FontName).toString(); | - |
| 78 | int pixelSize = QFontEngineQPF2::extractHeaderField(data, QFontEngineQPF2::Tag_PixelSize).toInt(); | - |
| 79 | QVariant weight = QFontEngineQPF2::extractHeaderField(data, QFontEngineQPF2::Tag_Weight); | - |
| 80 | QVariant style = QFontEngineQPF2::extractHeaderField(data, QFontEngineQPF2::Tag_Style); | - |
| 81 | QByteArray writingSystemBits = QFontEngineQPF2::extractHeaderField(data, QFontEngineQPF2::Tag_WritingSystems).toByteArray(); | - |
| 82 | | - |
| 83 | if (!fontName.isEmpty() && pixelSize) {| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 84 | QFont::Weight fontWeight = QFont::Normal; | - |
| 85 | if (weight.type() == QVariant::Int || weight.type() == QVariant::UInt)| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 86 | fontWeight = QFont::Weight(weight.toInt()); never executed: fontWeight = QFont::Weight(weight.toInt()); | 0 |
| 87 | | - |
| 88 | QFont::Style fontStyle = static_cast<QFont::Style>(style.toInt()); | - |
| 89 | | - |
| 90 | QSupportedWritingSystems writingSystems; | - |
| 91 | for (int i = 0; i < writingSystemBits.count(); ++i) {| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 92 | uchar currentByte = writingSystemBits.at(i); | - |
| 93 | for (int j = 0; j < 8; ++j) {| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 94 | if (currentByte & 1)| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 95 | writingSystems.setSupported(QFontDatabase::WritingSystem(i * 8 + j)); never executed: writingSystems.setSupported(QFontDatabase::WritingSystem(i * 8 + j)); | 0 |
| 96 | currentByte >>= 1; | - |
| 97 | } never executed: end of block | 0 |
| 98 | } never executed: end of block | 0 |
| 99 | QFont::Stretch stretch = QFont::Unstretched; | - |
| 100 | registerFont(fontName,QString(),QString(),fontWeight,fontStyle,stretch,true,false,pixelSize,false,writingSystems,handle); | - |
| 101 | } never executed: end of block | 0 |
| 102 | } else { never executed: end of block | 0 |
| 103 | qDebug() << ("header verification of QPF2 font failed. maybe it is corrupt?";); | - |
| 104 | } never executed: end of block | 0 |
| 105 | } | - |
| 106 | | - |
| 107 | | - |
| 108 | | - |
| 109 | | - |
| 110 | | - |
| 111 | | - |
| 112 | | - |
| 113 | | - |
| 114 | | - |
| 115 | | - |
| 116 | | - |
| 117 | | - |
| 118 | | - |
| 119 | | - |
| 120 | | - |
| 121 | | - |
| 122 | | - |
| 123 | | - |
| 124 | | - |
| 125 | | - |
| 126 | | - |
| 127 | | - |
| 128 | void QPlatformFontDatabase::registerFont(const QString &familyname, const QString &stylename, | - |
| 129 | const QString &foundryname, QFont::Weight weight, | - |
| 130 | QFont::Style style, QFont::Stretch stretch, bool antialiased, | - |
| 131 | bool scalable, int pixelSize, bool fixedPitch, | - |
| 132 | const QSupportedWritingSystems &writingSystems, void *usrPtr) | - |
| 133 | { | - |
| 134 | if (scalable) | - |
| 135 | pixelSize = 0; | - |
| 136 | | - |
| 137 | qt_registerFont(familyname, stylename, foundryname, weight, style, | - |
| 138 | stretch, antialiased, scalable, pixelSize, | - |
| 139 | fixedPitch, writingSystems, usrPtr); | - |
| 140 | } | - |
| 141 | | - |
| 142 | | - |
| 143 | | - |
| 144 | | - |
| 145 | | - |
| 146 | | - |
| 147 | | - |
| 148 | | - |
| 149 | void QPlatformFontDatabase::registerFontFamily(const QString &familyName) | - |
| 150 | { | - |
| 151 | qt_registerFontFamily(familyName); | - |
| 152 | } | - |
| 153 | | - |
| 154 | class QWritingSystemsPrivate | - |
| 155 | { | - |
| 156 | public: | - |
| 157 | QWritingSystemsPrivate() | - |
| 158 | : ref(1) | - |
| 159 | , vector(QFontDatabase::WritingSystemsCount,false) | - |
| 160 | { | - |
| 161 | } | - |
| 162 | | - |
| 163 | QWritingSystemsPrivate(const QWritingSystemsPrivate *other) | - |
| 164 | : ref(1) | - |
| 165 | , vector(other->vector) | - |
| 166 | { | - |
| 167 | } | - |
| 168 | | - |
| 169 | QAtomicInt ref; | - |
| 170 | QVector<bool> vector; | - |
| 171 | }; | - |
| 172 | | - |
| 173 | | - |
| 174 | | - |
| 175 | | - |
| 176 | QSupportedWritingSystems::QSupportedWritingSystems() | - |
| 177 | { | - |
| 178 | d = new QWritingSystemsPrivate; | - |
| 179 | } | - |
| 180 | | - |
| 181 | | - |
| 182 | | - |
| 183 | | - |
| 184 | QSupportedWritingSystems::QSupportedWritingSystems(const QSupportedWritingSystems &other) | - |
| 185 | { | - |
| 186 | d = other.d; | - |
| 187 | d->ref.ref(); | - |
| 188 | } | - |
| 189 | | - |
| 190 | | - |
| 191 | | - |
| 192 | | - |
| 193 | QSupportedWritingSystems &QSupportedWritingSystems::operator=(const QSupportedWritingSystems &other) | - |
| 194 | { | - |
| 195 | if (d != other.d) { | - |
| 196 | other.d->ref.ref(); | - |
| 197 | if (!d->ref.deref()) | - |
| 198 | delete d; | - |
| 199 | d = other.d; | - |
| 200 | } | - |
| 201 | return *this; | - |
| 202 | } | - |
| 203 | | - |
| 204 | | - |
| 205 | | - |
| 206 | | - |
| 207 | QSupportedWritingSystems::~QSupportedWritingSystems() | - |
| 208 | { | - |
| 209 | if (!d->ref.deref()) | - |
| 210 | delete d; | - |
| 211 | } | - |
| 212 | | - |
| 213 | | - |
| 214 | | - |
| 215 | | - |
| 216 | void QSupportedWritingSystems::detach() | - |
| 217 | { | - |
| 218 | if (d->ref.load() != 1) { | - |
| 219 | QWritingSystemsPrivate *newd = new QWritingSystemsPrivate(d); | - |
| 220 | if (!d->ref.deref()) | - |
| 221 | delete d; | - |
| 222 | d = newd; | - |
| 223 | } | - |
| 224 | } | - |
| 225 | | - |
| 226 | | - |
| 227 | | - |
| 228 | | - |
| 229 | | - |
| 230 | void QSupportedWritingSystems::setSupported(QFontDatabase::WritingSystem writingSystem, bool support) | - |
| 231 | { | - |
| 232 | detach(); | - |
| 233 | d->vector[writingSystem] = support; | - |
| 234 | } | - |
| 235 | | - |
| 236 | | - |
| 237 | | - |
| 238 | | - |
| 239 | | - |
| 240 | bool QSupportedWritingSystems::supported(QFontDatabase::WritingSystem writingSystem) const | - |
| 241 | { | - |
| 242 | return d->vector.at(writingSystem); | - |
| 243 | } | - |
| 244 | | - |
| 245 | | - |
| 246 | | - |
| 247 | | - |
| 248 | | - |
| 249 | | - |
| 250 | | - |
| 251 | | - |
| 252 | | - |
| 253 | | - |
| 254 | | - |
| 255 | | - |
| 256 | | - |
| 257 | | - |
| 258 | | - |
| 259 | | - |
| 260 | QPlatformFontDatabase::~QPlatformFontDatabase() | - |
| 261 | { | - |
| 262 | } | - |
| 263 | | - |
| 264 | | - |
| 265 | | - |
| 266 | | - |
| 267 | | - |
| 268 | | - |
| 269 | | - |
| 270 | | - |
| 271 | | - |
| 272 | | - |
| 273 | | - |
| 274 | | - |
| 275 | | - |
| 276 | | - |
| 277 | void QPlatformFontDatabase::populateFontDatabase() | - |
| 278 | { | - |
| 279 | QString fontpath = fontDir(); | - |
| 280 | if(!QFile::exists(fontpath)) { | - |
| 281 | qWarning("QFontDatabase: Cannot find font directory '%s' - is Qt installed correctly?", | - |
| 282 | qPrintable(QDir::toNativeSeparators(fontpath))); | - |
| 283 | return; | - |
| 284 | } | - |
| 285 | | - |
| 286 | QDir dir(fontpath); | - |
| 287 | dir.setNameFilters(QStringList() << QLatin1String("*.qpf2")); | - |
| 288 | dir.refresh(); | - |
| 289 | for (int i = 0; i < int(dir.count()); ++i) { | - |
| 290 | const QByteArray fileName = QFile::encodeName(dir.absoluteFilePath(dir[i])); | - |
| 291 | QFile file(QString::fromLocal8Bit(fileName)); | - |
| 292 | if (file.open(QFile::ReadOnly)) { | - |
| 293 | const QByteArray fileData = file.readAll(); | - |
| 294 | QByteArray *fileDataPtr = new QByteArray(fileData); | - |
| 295 | registerQPF2Font(fileData, fileDataPtr); | - |
| 296 | } | - |
| 297 | } | - |
| 298 | } | - |
| 299 | | - |
| 300 | | - |
| 301 | | - |
| 302 | | - |
| 303 | | - |
| 304 | | - |
| 305 | | - |
| 306 | | - |
| 307 | void QPlatformFontDatabase::populateFamily(const QString &familyName) | - |
| 308 | { | - |
| 309 | Q_UNUSED(familyName); | - |
| 310 | } | - |
| 311 | | - |
| 312 | | - |
| 313 | | - |
| 314 | | - |
| 315 | | - |
| 316 | | - |
| 317 | | - |
| 318 | void QPlatformFontDatabase::invalidate() | - |
| 319 | { | - |
| 320 | } | - |
| 321 | | - |
| 322 | | - |
| 323 | | - |
| 324 | | - |
| 325 | | - |
| 326 | | - |
| 327 | QFontEngineMulti *QPlatformFontDatabase::fontEngineMulti(QFontEngine *fontEngine, QChar::Script script) | - |
| 328 | { | - |
| 329 | return new QFontEngineMulti(fontEngine, script); | - |
| 330 | } | - |
| 331 | | - |
| 332 | | - |
| 333 | | - |
| 334 | | - |
| 335 | | - |
| 336 | QFontEngine *QPlatformFontDatabase::fontEngine(const QFontDef &fontDef, void *handle) | - |
| 337 | { | - |
| 338 | QByteArray *fileDataPtr = static_cast<QByteArray *>(handle); | - |
| 339 | QFontEngineQPF2 *engine = new QFontEngineQPF2(fontDef,*fileDataPtr); | - |
| 340 | | - |
| 341 | return engine; | - |
| 342 | } | - |
| 343 | | - |
| 344 | QFontEngine *QPlatformFontDatabase::fontEngine(const QByteArray &fontData, qreal pixelSize, | - |
| 345 | QFont::HintingPreference hintingPreference) | - |
| 346 | { | - |
| 347 | Q_UNUSED(fontData); | - |
| 348 | Q_UNUSED(pixelSize); | - |
| 349 | Q_UNUSED(hintingPreference); | - |
| 350 | qWarning("This plugin does not support font engines created directly from font data"); | - |
| 351 | return 0; | - |
| 352 | } | - |
| 353 | | - |
| 354 | | - |
| 355 | | - |
| 356 | | - |
| 357 | | - |
| 358 | | - |
| 359 | | - |
| 360 | | - |
| 361 | | - |
| 362 | | - |
| 363 | | - |
| 364 | | - |
| 365 | | - |
| 366 | | - |
| 367 | | - |
| 368 | | - |
| 369 | | - |
| 370 | | - |
| 371 | | - |
| 372 | | - |
| 373 | | - |
| 374 | QStringList QPlatformFontDatabase::addApplicationFont(const QByteArray &fontData, const QString &fileName) | - |
| 375 | { | - |
| 376 | Q_UNUSED(fontData); | - |
| 377 | Q_UNUSED(fileName); | - |
| 378 | | - |
| 379 | qWarning("This plugin does not support application fonts"); | - |
| 380 | return QStringList(); | - |
| 381 | } | - |
| 382 | | - |
| 383 | | - |
| 384 | | - |
| 385 | | - |
| 386 | void QPlatformFontDatabase::releaseHandle(void *handle) | - |
| 387 | { | - |
| 388 | QByteArray *fileDataPtr = static_cast<QByteArray *>(handle); | - |
| 389 | delete fileDataPtr; | - |
| 390 | } | - |
| 391 | | - |
| 392 | | - |
| 393 | | - |
| 394 | | - |
| 395 | QString QPlatformFontDatabase::fontDir() const | - |
| 396 | { | - |
| 397 | QString fontpath = QString::fromLocal8Bit(qgetenv("QT_QPA_FONTDIR")); | - |
| 398 | if (fontpath.isEmpty()) { | - |
| 399 | fontpath = QLibraryInfo::location(QLibraryInfo::LibrariesPath); | - |
| 400 | fontpath += QLatin1String("/fonts"); | - |
| 401 | } | - |
| 402 | | - |
| 403 | return fontpath; | - |
| 404 | } | - |
| 405 | | - |
| 406 | | - |
| 407 | | - |
| 408 | | - |
| 409 | | - |
| 410 | bool QPlatformFontDatabase::isPrivateFontFamily(const QString &family) const | - |
| 411 | { | - |
| 412 | Q_UNUSED(family); | - |
| 413 | return false; | - |
| 414 | } | - |
| 415 | | - |
| 416 | | - |
| 417 | | - |
| 418 | | - |
| 419 | | - |
| 420 | | - |
| 421 | | - |
| 422 | | - |
| 423 | QFont QPlatformFontDatabase::defaultFont() const | - |
| 424 | { | - |
| 425 | return QFont(QLatin1String("Helvetica")); | - |
| 426 | } | - |
| 427 | | - |
| 428 | | - |
| 429 | | - |
| 430 | | - |
| 431 | | - |
| 432 | | - |
| 433 | | - |
| 434 | QString qt_resolveFontFamilyAlias(const QString &alias); | - |
| 435 | | - |
| 436 | QString QPlatformFontDatabase::resolveFontFamilyAlias(const QString &family) const | - |
| 437 | { | - |
| 438 | return qt_resolveFontFamilyAlias(family); | - |
| 439 | } | - |
| 440 | | - |
| 441 | | - |
| 442 | | - |
| 443 | | - |
| 444 | | - |
| 445 | | - |
| 446 | | - |
| 447 | | - |
| 448 | bool QPlatformFontDatabase::fontsAlwaysScalable() const | - |
| 449 | { | - |
| 450 | return false; | - |
| 451 | } | - |
| 452 | | - |
| 453 | | - |
| 454 | | - |
| 455 | | - |
| 456 | | - |
| 457 | | - |
| 458 | | - |
| 459 | QList<int> QPlatformFontDatabase::standardSizes() const | - |
| 460 | { | - |
| 461 | QList<int> ret; | - |
| 462 | static const quint8 standard[] = | - |
| 463 | { 6, 7, 8, 9, 10, 11, 12, 14, 16, 18, 20, 22, 24, 26, 28, 36, 48, 72 }; | - |
| 464 | static const int num_standards = int(sizeof standard / sizeof *standard); | - |
| 465 | ret.reserve(num_standards); | - |
| 466 | std::copy(standard, standard + num_standards, std::back_inserter(ret)); | - |
| 467 | return ret; | - |
| 468 | } | - |
| 469 | | - |
| 470 | QFontEngine::SubpixelAntialiasingType QPlatformFontDatabase::subpixelAntialiasingTypeHint() const | - |
| 471 | { | - |
| 472 | static int type = -1; | - |
| 473 | if (type == -1) { | - |
| 474 | if (QScreen *screen = QGuiApplication::primaryScreen()) | - |
| 475 | type = screen->handle()->subpixelAntialiasingTypeHint(); | - |
| 476 | } | - |
| 477 | return static_cast<QFontEngine::SubpixelAntialiasingType>(type); | - |
| 478 | } | - |
| 479 | | - |
| 480 | | - |
| 481 | | - |
| 482 | | - |
| 483 | static const quint8 requiredUnicodeBits[QFontDatabase::WritingSystemsCount][2] = { | - |
| 484 | { 127, 127 }, | - |
| 485 | { 0, 127 }, | - |
| 486 | { 7, 127 }, | - |
| 487 | { 9, 127 }, | - |
| 488 | { 10, 127 }, | - |
| 489 | { 11, 127 }, | - |
| 490 | { 13, 127 }, | - |
| 491 | { 71, 127 }, | - |
| 492 | { 72, 127 }, | - |
| 493 | { 15, 127 }, | - |
| 494 | { 16, 127 }, | - |
| 495 | { 17, 127 }, | - |
| 496 | { 18, 127 }, | - |
| 497 | { 19, 127 }, | - |
| 498 | { 20, 127 }, | - |
| 499 | { 21, 127 }, | - |
| 500 | { 22, 127 }, | - |
| 501 | { 23, 127 }, | - |
| 502 | { 73, 127 }, | - |
| 503 | { 24, 127 }, | - |
| 504 | { 25, 127 }, | - |
| 505 | { 70, 127 }, | - |
| 506 | { 74, 127 }, | - |
| 507 | { 26, 127 }, | - |
| 508 | { 80, 127 }, | - |
| 509 | { 126, 127 }, | - |
| 510 | { 126, 127 }, | - |
| 511 | { 126, 127 }, | - |
| 512 | { 56, 127 }, | - |
| 513 | { 0, 127 }, | - |
| 514 | { 126, 127 }, | - |
| 515 | { 78, 127 }, | - |
| 516 | { 79, 127 }, | - |
| 517 | { 14, 127 }, | - |
| 518 | }; | - |
| 519 | | - |
| 520 | enum CsbBits { | - |
| 521 | Latin1CsbBit = 0, | - |
| 522 | CentralEuropeCsbBit = 1, | - |
| 523 | TurkishCsbBit = 4, | - |
| 524 | BalticCsbBit = 7, | - |
| 525 | CyrillicCsbBit = 2, | - |
| 526 | GreekCsbBit = 3, | - |
| 527 | HebrewCsbBit = 5, | - |
| 528 | ArabicCsbBit = 6, | - |
| 529 | VietnameseCsbBit = 8, | - |
| 530 | SimplifiedChineseCsbBit = 18, | - |
| 531 | TraditionalChineseCsbBit = 20, | - |
| 532 | ThaiCsbBit = 16, | - |
| 533 | JapaneseCsbBit = 17, | - |
| 534 | KoreanCsbBit = 19, | - |
| 535 | KoreanJohabCsbBit = 21, | - |
| 536 | SymbolCsbBit = 31 | - |
| 537 | }; | - |
| 538 | | - |
| 539 | | - |
| 540 | | - |
| 541 | | - |
| 542 | | - |
| 543 | | - |
| 544 | | - |
| 545 | QSupportedWritingSystems QPlatformFontDatabase::writingSystemsFromTrueTypeBits(quint32 unicodeRange[4], quint32 codePageRange[2]) | - |
| 546 | { | - |
| 547 | QSupportedWritingSystems writingSystems; | - |
| 548 | | - |
| 549 | bool hasScript = false; | - |
| 550 | for (int i = 0; i < QFontDatabase::WritingSystemsCount; ++i) { | - |
| 551 | int bit = requiredUnicodeBits[i][0]; | - |
| 552 | int index = bit/32; | - |
| 553 | int flag = 1 << (bit&31); | - |
| 554 | if (bit != 126 && (unicodeRange[index] & flag)) { | - |
| 555 | bit = requiredUnicodeBits[i][1]; | - |
| 556 | index = bit/32; | - |
| 557 | | - |
| 558 | flag = 1 << (bit&31); | - |
| 559 | if (bit == 127 || (unicodeRange[index] & flag)) { | - |
| 560 | writingSystems.setSupported(QFontDatabase::WritingSystem(i)); | - |
| 561 | hasScript = true; | - |
| 562 | | - |
| 563 | } | - |
| 564 | } | - |
| 565 | } | - |
| 566 | if (codePageRange[0] & ((1 << Latin1CsbBit) | (1 << CentralEuropeCsbBit) | (1 << TurkishCsbBit) | (1 << BalticCsbBit))) { | - |
| 567 | writingSystems.setSupported(QFontDatabase::Latin); | - |
| 568 | hasScript = true; | - |
| 569 | | - |
| 570 | } | - |
| 571 | if (codePageRange[0] & (1 << CyrillicCsbBit)) { | - |
| 572 | writingSystems.setSupported(QFontDatabase::Cyrillic); | - |
| 573 | hasScript = true; | - |
| 574 | | - |
| 575 | } | - |
| 576 | if (codePageRange[0] & (1 << GreekCsbBit)) { | - |
| 577 | writingSystems.setSupported(QFontDatabase::Greek); | - |
| 578 | hasScript = true; | - |
| 579 | | - |
| 580 | } | - |
| 581 | if (codePageRange[0] & (1 << HebrewCsbBit)) { | - |
| 582 | writingSystems.setSupported(QFontDatabase::Hebrew); | - |
| 583 | hasScript = true; | - |
| 584 | | - |
| 585 | } | - |
| 586 | if (codePageRange[0] & (1 << ArabicCsbBit)) { | - |
| 587 | writingSystems.setSupported(QFontDatabase::Arabic); | - |
| 588 | hasScript = true; | - |
| 589 | | - |
| 590 | } | - |
| 591 | if (codePageRange[0] & (1 << ThaiCsbBit)) { | - |
| 592 | writingSystems.setSupported(QFontDatabase::Thai); | - |
| 593 | hasScript = true; | - |
| 594 | | - |
| 595 | } | - |
| 596 | if (codePageRange[0] & (1 << VietnameseCsbBit)) { | - |
| 597 | writingSystems.setSupported(QFontDatabase::Vietnamese); | - |
| 598 | hasScript = true; | - |
| 599 | | - |
| 600 | } | - |
| 601 | if (codePageRange[0] & (1 << SimplifiedChineseCsbBit)) { | - |
| 602 | writingSystems.setSupported(QFontDatabase::SimplifiedChinese); | - |
| 603 | hasScript = true; | - |
| 604 | | - |
| 605 | } | - |
| 606 | if (codePageRange[0] & (1 << TraditionalChineseCsbBit)) { | - |
| 607 | writingSystems.setSupported(QFontDatabase::TraditionalChinese); | - |
| 608 | hasScript = true; | - |
| 609 | | - |
| 610 | } | - |
| 611 | if (codePageRange[0] & (1 << JapaneseCsbBit)) { | - |
| 612 | writingSystems.setSupported(QFontDatabase::Japanese); | - |
| 613 | hasScript = true; | - |
| 614 | | - |
| 615 | } | - |
| 616 | if (codePageRange[0] & ((1 << KoreanCsbBit) | (1 << KoreanJohabCsbBit))) { | - |
| 617 | writingSystems.setSupported(QFontDatabase::Korean); | - |
| 618 | hasScript = true; | - |
| 619 | | - |
| 620 | } | - |
| 621 | if (codePageRange[0] & (1U << SymbolCsbBit)) { | - |
| 622 | writingSystems = QSupportedWritingSystems(); | - |
| 623 | hasScript = false; | - |
| 624 | } | - |
| 625 | | - |
| 626 | if (!hasScript) | - |
| 627 | writingSystems.setSupported(QFontDatabase::Symbol); | - |
| 628 | | - |
| 629 | return writingSystems; | - |
| 630 | } | - |
| 631 | | - |
| 632 | | - |
| 633 | | - |
| 634 | | - |
| 635 | | - |
| 636 | | - |
| 637 | | - |
| 638 | | - |
| 639 | QFont::Weight QPlatformFontDatabase::weightFromInteger(int weight) | - |
| 640 | { | - |
| 641 | if (weight < 150) | - |
| 642 | return QFont::Thin; | - |
| 643 | if (weight < 250) | - |
| 644 | return QFont::ExtraLight; | - |
| 645 | if (weight < 350) | - |
| 646 | return QFont::Light; | - |
| 647 | if (weight < 450) | - |
| 648 | return QFont::Normal; | - |
| 649 | if (weight < 550) | - |
| 650 | return QFont::Medium; | - |
| 651 | if (weight < 650) | - |
| 652 | return QFont::DemiBold; | - |
| 653 | if (weight < 750) | - |
| 654 | return QFont::Bold; | - |
| 655 | if (weight < 850) | - |
| 656 | return QFont::ExtraBold; | - |
| 657 | return QFont::Black; | - |
| 658 | } | - |
| 659 | | - |
| 660 | | - |
| 661 | | - |
| 662 | | - |
| 663 | | - |
| 664 | | - |
| 665 | | - |
| 666 | void QPlatformFontDatabase::registerAliasToFontFamily(const QString &familyName, const QString &alias) | - |
| 667 | { | - |
| 668 | qt_registerAliasToFontFamily(familyName, alias); | - |
| 669 | } | - |
| 670 | | - |
| 671 | | - |
| 672 | | - |
| 673 | | - |
| 674 | | - |
| 675 | | - |
| 676 | | - |
| 677 | | - |
| 678 | | - |
| 679 | | - |
| 680 | | - |
| 681 | | - |
| 682 | | - |
| 683 | | - |
| 684 | | - |
| 685 | | - |
| 686 | | - |
| 687 | | - |
| 688 | | - |
| 689 | | - |
| 690 | | - |
| 691 | | - |
| 692 | | - |
| 693 | | - |
| 694 | | - |
| 695 | | - |
| 696 | | - |
| 697 | QT_END_NAMESPACE | - |
| | |