| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/gui/text/qplatformfontdatabase.cpp |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||||||||
| 2 | - | |||||||||||||||||||
| 3 | - | |||||||||||||||||||
| 4 | - | |||||||||||||||||||
| 5 | - | |||||||||||||||||||
| 6 | - | |||||||||||||||||||
| 7 | void qt_registerFont(const QString &familyname, const QString &stylename, | - | ||||||||||||||||||
| 8 | const QString &foundryname, int weight, | - | ||||||||||||||||||
| 9 | QFont::Style style, int stretch, bool antialiased, | - | ||||||||||||||||||
| 10 | bool scalable, int pixelSize, bool fixedPitch, | - | ||||||||||||||||||
| 11 | const QSupportedWritingSystems &writingSystems, void *hanlde); | - | ||||||||||||||||||
| 12 | - | |||||||||||||||||||
| 13 | void qt_registerFontFamily(const QString &familyName); | - | ||||||||||||||||||
| 14 | void qt_registerAliasToFontFamily(const QString &familyName, const QString &alias); | - | ||||||||||||||||||
| 15 | void QPlatformFontDatabase::registerQPF2Font(const QByteArray &dataArray, void *handle) | - | ||||||||||||||||||
| 16 | { | - | ||||||||||||||||||
| 17 | if (dataArray.size() == 0
| 0 | ||||||||||||||||||
| 18 | return; never executed: return; | 0 | ||||||||||||||||||
| 19 | - | |||||||||||||||||||
| 20 | const uchar *data = reinterpret_cast<const uchar *>(dataArray.constData()); | - | ||||||||||||||||||
| 21 | if (QFontEngineQPF2::verifyHeader(data, dataArray.size())
| 0 | ||||||||||||||||||
| 22 | QString fontName = QFontEngineQPF2::extractHeaderField(data, QFontEngineQPF2::Tag_FontName).toString(); | - | ||||||||||||||||||
| 23 | int pixelSize = QFontEngineQPF2::extractHeaderField(data, QFontEngineQPF2::Tag_PixelSize).toInt(); | - | ||||||||||||||||||
| 24 | QVariant weight = QFontEngineQPF2::extractHeaderField(data, QFontEngineQPF2::Tag_Weight); | - | ||||||||||||||||||
| 25 | QVariant style = QFontEngineQPF2::extractHeaderField(data, QFontEngineQPF2::Tag_Style); | - | ||||||||||||||||||
| 26 | QByteArray writingSystemBits = QFontEngineQPF2::extractHeaderField(data, QFontEngineQPF2::Tag_WritingSystems).toByteArray(); | - | ||||||||||||||||||
| 27 | - | |||||||||||||||||||
| 28 | if (!fontName.isEmpty()
| 0 | ||||||||||||||||||
| 29 | QFont::Weight fontWeight = QFont::Normal; | - | ||||||||||||||||||
| 30 | if (weight.type() == QVariant::Int
| 0 | ||||||||||||||||||
| 31 | fontWeight = QFont::Weight(weight.toInt()); never executed: fontWeight = QFont::Weight(weight.toInt()); | 0 | ||||||||||||||||||
| 32 | - | |||||||||||||||||||
| 33 | QFont::Style fontStyle = static_cast<QFont::Style>(style.toInt()); | - | ||||||||||||||||||
| 34 | - | |||||||||||||||||||
| 35 | QSupportedWritingSystems writingSystems; | - | ||||||||||||||||||
| 36 | for (int i = 0; i < writingSystemBits.count()
| 0 | ||||||||||||||||||
| 37 | uchar currentByte = writingSystemBits.at(i); | - | ||||||||||||||||||
| 38 | for (int j = 0; j < 8
| 0 | ||||||||||||||||||
| 39 | if (currentByte & 1
| 0 | ||||||||||||||||||
| 40 | writingSystems.setSupported(QFontDatabase::WritingSystem(i * 8 + j)); never executed: writingSystems.setSupported(QFontDatabase::WritingSystem(i * 8 + j)); | 0 | ||||||||||||||||||
| 41 | currentByte >>= 1; | - | ||||||||||||||||||
| 42 | } never executed: end of block | 0 | ||||||||||||||||||
| 43 | } never executed: end of block | 0 | ||||||||||||||||||
| 44 | QFont::Stretch stretch = QFont::Unstretched; | - | ||||||||||||||||||
| 45 | registerFont(fontName,QString(),QString(),fontWeight,fontStyle,stretch,true,false,pixelSize,false,writingSystems,handle); | - | ||||||||||||||||||
| 46 | } never executed: end of block | 0 | ||||||||||||||||||
| 47 | } never executed: else {end of block | 0 | ||||||||||||||||||
| 48 | QMessageLogger(__FILE__, 97, __PRETTY_FUNCTION__).debug() << "header verification of QPF2 font failed. maybe it is corrupt?"; | - | ||||||||||||||||||
| 49 | } never executed: end of block | 0 | ||||||||||||||||||
| 50 | } | - | ||||||||||||||||||
| 51 | void QPlatformFontDatabase::registerFont(const QString &familyname, const QString &stylename, | - | ||||||||||||||||||
| 52 | const QString &foundryname, QFont::Weight weight, | - | ||||||||||||||||||
| 53 | QFont::Style style, QFont::Stretch stretch, bool antialiased, | - | ||||||||||||||||||
| 54 | bool scalable, int pixelSize, bool fixedPitch, | - | ||||||||||||||||||
| 55 | const QSupportedWritingSystems &writingSystems, void *usrPtr) | - | ||||||||||||||||||
| 56 | { | - | ||||||||||||||||||
| 57 | if (scalable
| 0 | ||||||||||||||||||
| 58 | pixelSize = 0; never executed: pixelSize = 0; | 0 | ||||||||||||||||||
| 59 | - | |||||||||||||||||||
| 60 | qt_registerFont(familyname, stylename, foundryname, weight, style, | - | ||||||||||||||||||
| 61 | stretch, antialiased, scalable, pixelSize, | - | ||||||||||||||||||
| 62 | fixedPitch, writingSystems, usrPtr); | - | ||||||||||||||||||
| 63 | } never executed: end of block | 0 | ||||||||||||||||||
| 64 | void QPlatformFontDatabase::registerFontFamily(const QString &familyName) | - | ||||||||||||||||||
| 65 | { | - | ||||||||||||||||||
| 66 | qt_registerFontFamily(familyName); | - | ||||||||||||||||||
| 67 | } never executed: end of block | 0 | ||||||||||||||||||
| 68 | - | |||||||||||||||||||
| 69 | class QWritingSystemsPrivate | - | ||||||||||||||||||
| 70 | { | - | ||||||||||||||||||
| 71 | public: | - | ||||||||||||||||||
| 72 | QWritingSystemsPrivate() | - | ||||||||||||||||||
| 73 | : ref(1) | - | ||||||||||||||||||
| 74 | , vector(QFontDatabase::WritingSystemsCount,false) | - | ||||||||||||||||||
| 75 | { | - | ||||||||||||||||||
| 76 | } never executed: end of block | 0 | ||||||||||||||||||
| 77 | - | |||||||||||||||||||
| 78 | QWritingSystemsPrivate(const QWritingSystemsPrivate *other) | - | ||||||||||||||||||
| 79 | : ref(1) | - | ||||||||||||||||||
| 80 | , vector(other->vector) | - | ||||||||||||||||||
| 81 | { | - | ||||||||||||||||||
| 82 | } never executed: end of block | 0 | ||||||||||||||||||
| 83 | - | |||||||||||||||||||
| 84 | QAtomicInt ref; | - | ||||||||||||||||||
| 85 | QVector<bool> vector; | - | ||||||||||||||||||
| 86 | }; | - | ||||||||||||||||||
| 87 | - | |||||||||||||||||||
| 88 | - | |||||||||||||||||||
| 89 | - | |||||||||||||||||||
| 90 | - | |||||||||||||||||||
| 91 | QSupportedWritingSystems::QSupportedWritingSystems() | - | ||||||||||||||||||
| 92 | { | - | ||||||||||||||||||
| 93 | d = new QWritingSystemsPrivate; | - | ||||||||||||||||||
| 94 | } never executed: end of block | 0 | ||||||||||||||||||
| 95 | - | |||||||||||||||||||
| 96 | - | |||||||||||||||||||
| 97 | - | |||||||||||||||||||
| 98 | - | |||||||||||||||||||
| 99 | QSupportedWritingSystems::QSupportedWritingSystems(const QSupportedWritingSystems &other) | - | ||||||||||||||||||
| 100 | { | - | ||||||||||||||||||
| 101 | d = other.d; | - | ||||||||||||||||||
| 102 | d->ref.ref(); | - | ||||||||||||||||||
| 103 | } never executed: end of block | 0 | ||||||||||||||||||
| 104 | - | |||||||||||||||||||
| 105 | - | |||||||||||||||||||
| 106 | - | |||||||||||||||||||
| 107 | - | |||||||||||||||||||
| 108 | QSupportedWritingSystems &QSupportedWritingSystems::operator=(const QSupportedWritingSystems &other) | - | ||||||||||||||||||
| 109 | { | - | ||||||||||||||||||
| 110 | if (d != other.d
| 0 | ||||||||||||||||||
| 111 | other.d->ref.ref(); | - | ||||||||||||||||||
| 112 | if (!d->ref.deref()
| 0 | ||||||||||||||||||
| 113 | delete d; never executed: delete d; | 0 | ||||||||||||||||||
| 114 | d = other.d; | - | ||||||||||||||||||
| 115 | } never executed: end of block | 0 | ||||||||||||||||||
| 116 | return never executed: *this;return *this;never executed: return *this; | 0 | ||||||||||||||||||
| 117 | } | - | ||||||||||||||||||
| 118 | - | |||||||||||||||||||
| 119 | - | |||||||||||||||||||
| 120 | - | |||||||||||||||||||
| 121 | - | |||||||||||||||||||
| 122 | QSupportedWritingSystems::~QSupportedWritingSystems() | - | ||||||||||||||||||
| 123 | { | - | ||||||||||||||||||
| 124 | if (!d->ref.deref()
| 0 | ||||||||||||||||||
| 125 | delete d; never executed: delete d; | 0 | ||||||||||||||||||
| 126 | } never executed: end of block | 0 | ||||||||||||||||||
| 127 | - | |||||||||||||||||||
| 128 | - | |||||||||||||||||||
| 129 | - | |||||||||||||||||||
| 130 | - | |||||||||||||||||||
| 131 | void QSupportedWritingSystems::detach() | - | ||||||||||||||||||
| 132 | { | - | ||||||||||||||||||
| 133 | if (d->ref.load() != 1
| 0 | ||||||||||||||||||
| 134 | QWritingSystemsPrivate *newd = new QWritingSystemsPrivate(d); | - | ||||||||||||||||||
| 135 | if (!d->ref.deref()
| 0 | ||||||||||||||||||
| 136 | delete d; never executed: delete d; | 0 | ||||||||||||||||||
| 137 | d = newd; | - | ||||||||||||||||||
| 138 | } never executed: end of block | 0 | ||||||||||||||||||
| 139 | } never executed: end of block | 0 | ||||||||||||||||||
| 140 | - | |||||||||||||||||||
| 141 | - | |||||||||||||||||||
| 142 | - | |||||||||||||||||||
| 143 | - | |||||||||||||||||||
| 144 | - | |||||||||||||||||||
| 145 | void QSupportedWritingSystems::setSupported(QFontDatabase::WritingSystem writingSystem, bool support) | - | ||||||||||||||||||
| 146 | { | - | ||||||||||||||||||
| 147 | detach(); | - | ||||||||||||||||||
| 148 | d->vector[writingSystem] = support; | - | ||||||||||||||||||
| 149 | } never executed: end of block | 0 | ||||||||||||||||||
| 150 | - | |||||||||||||||||||
| 151 | - | |||||||||||||||||||
| 152 | - | |||||||||||||||||||
| 153 | - | |||||||||||||||||||
| 154 | - | |||||||||||||||||||
| 155 | bool QSupportedWritingSystems::supported(QFontDatabase::WritingSystem writingSystem) const | - | ||||||||||||||||||
| 156 | { | - | ||||||||||||||||||
| 157 | return never executed: d->vector.at(writingSystem);return d->vector.at(writingSystem);never executed: return d->vector.at(writingSystem); | 0 | ||||||||||||||||||
| 158 | } | - | ||||||||||||||||||
| 159 | QPlatformFontDatabase::~QPlatformFontDatabase() | - | ||||||||||||||||||
| 160 | { | - | ||||||||||||||||||
| 161 | } | - | ||||||||||||||||||
| 162 | void QPlatformFontDatabase::populateFontDatabase() | - | ||||||||||||||||||
| 163 | { | - | ||||||||||||||||||
| 164 | QString fontpath = fontDir(); | - | ||||||||||||||||||
| 165 | if(!QFile::exists(fontpath)
| 0 | ||||||||||||||||||
| 166 | QMessageLogger(__FILE__, 275, __PRETTY_FUNCTION__).warning("QFontDatabase: Cannot find font directory '%s' - is Qt installed correctly?", | - | ||||||||||||||||||
| 167 | QString(QDir::toNativeSeparators(fontpath)).toLocal8Bit().constData()); | - | ||||||||||||||||||
| 168 | return; never executed: return; | 0 | ||||||||||||||||||
| 169 | } | - | ||||||||||||||||||
| 170 | - | |||||||||||||||||||
| 171 | QDir dir(fontpath); | - | ||||||||||||||||||
| 172 | dir.setNameFilters(QStringList() << QLatin1String("*.qpf2")); | - | ||||||||||||||||||
| 173 | dir.refresh(); | - | ||||||||||||||||||
| 174 | for (int i = 0; i < int(dir.count())
| 0 | ||||||||||||||||||
| 175 | const QByteArray fileName = QFile::encodeName(dir.absoluteFilePath(dir[i])); | - | ||||||||||||||||||
| 176 | QFile file(QString::fromLocal8Bit(fileName)); | - | ||||||||||||||||||
| 177 | if (file.open(QFile::ReadOnly)
| 0 | ||||||||||||||||||
| 178 | const QByteArray fileData = file.readAll(); | - | ||||||||||||||||||
| 179 | QByteArray *fileDataPtr = new QByteArray(fileData); | - | ||||||||||||||||||
| 180 | registerQPF2Font(fileData, fileDataPtr); | - | ||||||||||||||||||
| 181 | } never executed: end of block | 0 | ||||||||||||||||||
| 182 | } never executed: end of block | 0 | ||||||||||||||||||
| 183 | } never executed: end of block | 0 | ||||||||||||||||||
| 184 | void QPlatformFontDatabase::populateFamily(const QString &familyName) | - | ||||||||||||||||||
| 185 | { | - | ||||||||||||||||||
| 186 | (void)familyName;; | - | ||||||||||||||||||
| 187 | } never executed: end of block | 0 | ||||||||||||||||||
| 188 | - | |||||||||||||||||||
| 189 | - | |||||||||||||||||||
| 190 | - | |||||||||||||||||||
| 191 | - | |||||||||||||||||||
| 192 | - | |||||||||||||||||||
| 193 | - | |||||||||||||||||||
| 194 | - | |||||||||||||||||||
| 195 | void QPlatformFontDatabase::invalidate() | - | ||||||||||||||||||
| 196 | { | - | ||||||||||||||||||
| 197 | } | - | ||||||||||||||||||
| 198 | - | |||||||||||||||||||
| 199 | - | |||||||||||||||||||
| 200 | - | |||||||||||||||||||
| 201 | - | |||||||||||||||||||
| 202 | - | |||||||||||||||||||
| 203 | - | |||||||||||||||||||
| 204 | QFontEngineMulti *QPlatformFontDatabase::fontEngineMulti(QFontEngine *fontEngine, QChar::Script script) | - | ||||||||||||||||||
| 205 | { | - | ||||||||||||||||||
| 206 | return never executed: new QFontEngineMulti(fontEngine, script);return new QFontEngineMulti(fontEngine, script);never executed: return new QFontEngineMulti(fontEngine, script); | 0 | ||||||||||||||||||
| 207 | } | - | ||||||||||||||||||
| 208 | - | |||||||||||||||||||
| 209 | - | |||||||||||||||||||
| 210 | - | |||||||||||||||||||
| 211 | - | |||||||||||||||||||
| 212 | - | |||||||||||||||||||
| 213 | QFontEngine *QPlatformFontDatabase::fontEngine(const QFontDef &fontDef, void *handle) | - | ||||||||||||||||||
| 214 | { | - | ||||||||||||||||||
| 215 | QByteArray *fileDataPtr = static_cast<QByteArray *>(handle); | - | ||||||||||||||||||
| 216 | QFontEngineQPF2 *engine = new QFontEngineQPF2(fontDef,*fileDataPtr); | - | ||||||||||||||||||
| 217 | - | |||||||||||||||||||
| 218 | return never executed: engine;return engine;never executed: return engine; | 0 | ||||||||||||||||||
| 219 | } | - | ||||||||||||||||||
| 220 | - | |||||||||||||||||||
| 221 | QFontEngine *QPlatformFontDatabase::fontEngine(const QByteArray &fontData, qreal pixelSize, | - | ||||||||||||||||||
| 222 | QFont::HintingPreference hintingPreference) | - | ||||||||||||||||||
| 223 | { | - | ||||||||||||||||||
| 224 | (void)fontData;; | - | ||||||||||||||||||
| 225 | (void)pixelSize;; | - | ||||||||||||||||||
| 226 | (void)hintingPreference;; | - | ||||||||||||||||||
| 227 | QMessageLogger(__FILE__, 344, __PRETTY_FUNCTION__).warning("This plugin does not support font engines created directly from font data"); | - | ||||||||||||||||||
| 228 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||
| 229 | } | - | ||||||||||||||||||
| 230 | QStringList QPlatformFontDatabase::addApplicationFont(const QByteArray &fontData, const QString &fileName) | - | ||||||||||||||||||
| 231 | { | - | ||||||||||||||||||
| 232 | (void)fontData;; | - | ||||||||||||||||||
| 233 | (void)fileName;; | - | ||||||||||||||||||
| 234 | - | |||||||||||||||||||
| 235 | QMessageLogger(__FILE__, 373, __PRETTY_FUNCTION__).warning("This plugin does not support application fonts"); | - | ||||||||||||||||||
| 236 | return never executed: QStringList();return QStringList();never executed: return QStringList(); | 0 | ||||||||||||||||||
| 237 | } | - | ||||||||||||||||||
| 238 | - | |||||||||||||||||||
| 239 | - | |||||||||||||||||||
| 240 | - | |||||||||||||||||||
| 241 | - | |||||||||||||||||||
| 242 | void QPlatformFontDatabase::releaseHandle(void *handle) | - | ||||||||||||||||||
| 243 | { | - | ||||||||||||||||||
| 244 | QByteArray *fileDataPtr = static_cast<QByteArray *>(handle); | - | ||||||||||||||||||
| 245 | delete fileDataPtr; | - | ||||||||||||||||||
| 246 | } never executed: end of block | 0 | ||||||||||||||||||
| 247 | - | |||||||||||||||||||
| 248 | - | |||||||||||||||||||
| 249 | - | |||||||||||||||||||
| 250 | - | |||||||||||||||||||
| 251 | QString QPlatformFontDatabase::fontDir() const | - | ||||||||||||||||||
| 252 | { | - | ||||||||||||||||||
| 253 | QString fontpath = QString::fromLocal8Bit(qgetenv("QT_QPA_FONTDIR")); | - | ||||||||||||||||||
| 254 | if (fontpath.isEmpty()
| 0 | ||||||||||||||||||
| 255 | fontpath = QLibraryInfo::location(QLibraryInfo::LibrariesPath); | - | ||||||||||||||||||
| 256 | fontpath += QLatin1String("/fonts"); | - | ||||||||||||||||||
| 257 | } never executed: end of block | 0 | ||||||||||||||||||
| 258 | - | |||||||||||||||||||
| 259 | return never executed: fontpath;return fontpath;never executed: return fontpath; | 0 | ||||||||||||||||||
| 260 | } | - | ||||||||||||||||||
| 261 | - | |||||||||||||||||||
| 262 | - | |||||||||||||||||||
| 263 | - | |||||||||||||||||||
| 264 | - | |||||||||||||||||||
| 265 | - | |||||||||||||||||||
| 266 | bool QPlatformFontDatabase::isPrivateFontFamily(const QString &family) const | - | ||||||||||||||||||
| 267 | { | - | ||||||||||||||||||
| 268 | (void)family;; | - | ||||||||||||||||||
| 269 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||
| 270 | } | - | ||||||||||||||||||
| 271 | QFont QPlatformFontDatabase::defaultFont() const | - | ||||||||||||||||||
| 272 | { | - | ||||||||||||||||||
| 273 | return never executed: QFont(QLatin1String("Helvetica"));return QFont(QLatin1String("Helvetica"));never executed: return QFont(QLatin1String("Helvetica")); | 0 | ||||||||||||||||||
| 274 | } | - | ||||||||||||||||||
| 275 | - | |||||||||||||||||||
| 276 | - | |||||||||||||||||||
| 277 | - | |||||||||||||||||||
| 278 | - | |||||||||||||||||||
| 279 | - | |||||||||||||||||||
| 280 | - | |||||||||||||||||||
| 281 | - | |||||||||||||||||||
| 282 | QString qt_resolveFontFamilyAlias(const QString &alias); | - | ||||||||||||||||||
| 283 | - | |||||||||||||||||||
| 284 | QString QPlatformFontDatabase::resolveFontFamilyAlias(const QString &family) const | - | ||||||||||||||||||
| 285 | { | - | ||||||||||||||||||
| 286 | return never executed: qt_resolveFontFamilyAlias(family);return qt_resolveFontFamilyAlias(family);never executed: return qt_resolveFontFamilyAlias(family); | 0 | ||||||||||||||||||
| 287 | } | - | ||||||||||||||||||
| 288 | bool QPlatformFontDatabase::fontsAlwaysScalable() const | - | ||||||||||||||||||
| 289 | { | - | ||||||||||||||||||
| 290 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||
| 291 | } | - | ||||||||||||||||||
| 292 | - | |||||||||||||||||||
| 293 | - | |||||||||||||||||||
| 294 | - | |||||||||||||||||||
| 295 | - | |||||||||||||||||||
| 296 | - | |||||||||||||||||||
| 297 | - | |||||||||||||||||||
| 298 | - | |||||||||||||||||||
| 299 | QList<int> QPlatformFontDatabase::standardSizes() const | - | ||||||||||||||||||
| 300 | { | - | ||||||||||||||||||
| 301 | QList<int> ret; | - | ||||||||||||||||||
| 302 | static const quint8 standard[] = | - | ||||||||||||||||||
| 303 | { 6, 7, 8, 9, 10, 11, 12, 14, 16, 18, 20, 22, 24, 26, 28, 36, 48, 72 }; | - | ||||||||||||||||||
| 304 | static const int num_standards = int(sizeof standard / sizeof *standard); | - | ||||||||||||||||||
| 305 | ret.reserve(num_standards); | - | ||||||||||||||||||
| 306 | std::copy(standard, standard + num_standards, std::back_inserter(ret)); | - | ||||||||||||||||||
| 307 | return never executed: ret;return ret;never executed: return ret; | 0 | ||||||||||||||||||
| 308 | } | - | ||||||||||||||||||
| 309 | - | |||||||||||||||||||
| 310 | QFontEngine::SubpixelAntialiasingType QPlatformFontDatabase::subpixelAntialiasingTypeHint() const | - | ||||||||||||||||||
| 311 | { | - | ||||||||||||||||||
| 312 | static int type = -1; | - | ||||||||||||||||||
| 313 | if (type == -1
| 0 | ||||||||||||||||||
| 314 | if (QScreen *screen = QGuiApplication::primaryScreen()
| 0 | ||||||||||||||||||
| 315 | type = screen->handle()->subpixelAntialiasingTypeHint(); never executed: type = screen->handle()->subpixelAntialiasingTypeHint(); | 0 | ||||||||||||||||||
| 316 | } never executed: end of block | 0 | ||||||||||||||||||
| 317 | return never executed: static_cast<QFontEngine::SubpixelAntialiasingType>(type);return static_cast<QFontEngine::SubpixelAntialiasingType>(type);never executed: return static_cast<QFontEngine::SubpixelAntialiasingType>(type); | 0 | ||||||||||||||||||
| 318 | } | - | ||||||||||||||||||
| 319 | - | |||||||||||||||||||
| 320 | - | |||||||||||||||||||
| 321 | - | |||||||||||||||||||
| 322 | - | |||||||||||||||||||
| 323 | static const quint8 requiredUnicodeBits[QFontDatabase::WritingSystemsCount][2] = { | - | ||||||||||||||||||
| 324 | { 127, 127 }, | - | ||||||||||||||||||
| 325 | { 0, 127 }, | - | ||||||||||||||||||
| 326 | { 7, 127 }, | - | ||||||||||||||||||
| 327 | { 9, 127 }, | - | ||||||||||||||||||
| 328 | { 10, 127 }, | - | ||||||||||||||||||
| 329 | { 11, 127 }, | - | ||||||||||||||||||
| 330 | { 13, 127 }, | - | ||||||||||||||||||
| 331 | { 71, 127 }, | - | ||||||||||||||||||
| 332 | { 72, 127 }, | - | ||||||||||||||||||
| 333 | { 15, 127 }, | - | ||||||||||||||||||
| 334 | { 16, 127 }, | - | ||||||||||||||||||
| 335 | { 17, 127 }, | - | ||||||||||||||||||
| 336 | { 18, 127 }, | - | ||||||||||||||||||
| 337 | { 19, 127 }, | - | ||||||||||||||||||
| 338 | { 20, 127 }, | - | ||||||||||||||||||
| 339 | { 21, 127 }, | - | ||||||||||||||||||
| 340 | { 22, 127 }, | - | ||||||||||||||||||
| 341 | { 23, 127 }, | - | ||||||||||||||||||
| 342 | { 73, 127 }, | - | ||||||||||||||||||
| 343 | { 24, 127 }, | - | ||||||||||||||||||
| 344 | { 25, 127 }, | - | ||||||||||||||||||
| 345 | { 70, 127 }, | - | ||||||||||||||||||
| 346 | { 74, 127 }, | - | ||||||||||||||||||
| 347 | { 26, 127 }, | - | ||||||||||||||||||
| 348 | { 80, 127 }, | - | ||||||||||||||||||
| 349 | { 126, 127 }, | - | ||||||||||||||||||
| 350 | { 126, 127 }, | - | ||||||||||||||||||
| 351 | { 126, 127 }, | - | ||||||||||||||||||
| 352 | { 56, 127 }, | - | ||||||||||||||||||
| 353 | { 0, 127 }, | - | ||||||||||||||||||
| 354 | { 126, 127 }, | - | ||||||||||||||||||
| 355 | { 78, 127 }, | - | ||||||||||||||||||
| 356 | { 79, 127 }, | - | ||||||||||||||||||
| 357 | { 14, 127 }, | - | ||||||||||||||||||
| 358 | }; | - | ||||||||||||||||||
| 359 | - | |||||||||||||||||||
| 360 | enum { | - | ||||||||||||||||||
| 361 | Latin1CsbBit = 0, | - | ||||||||||||||||||
| 362 | CentralEuropeCsbBit = 1, | - | ||||||||||||||||||
| 363 | TurkishCsbBit = 4, | - | ||||||||||||||||||
| 364 | BalticCsbBit = 7, | - | ||||||||||||||||||
| 365 | CyrillicCsbBit = 2, | - | ||||||||||||||||||
| 366 | GreekCsbBit = 3, | - | ||||||||||||||||||
| 367 | HebrewCsbBit = 5, | - | ||||||||||||||||||
| 368 | ArabicCsbBit = 6, | - | ||||||||||||||||||
| 369 | VietnameseCsbBit = 8, | - | ||||||||||||||||||
| 370 | SimplifiedChineseCsbBit = 18, | - | ||||||||||||||||||
| 371 | TraditionalChineseCsbBit = 20, | - | ||||||||||||||||||
| 372 | ThaiCsbBit = 16, | - | ||||||||||||||||||
| 373 | JapaneseCsbBit = 17, | - | ||||||||||||||||||
| 374 | KoreanCsbBit = 19, | - | ||||||||||||||||||
| 375 | KoreanJohabCsbBit = 21, | - | ||||||||||||||||||
| 376 | SymbolCsbBit = 31 | - | ||||||||||||||||||
| 377 | }; | - | ||||||||||||||||||
| 378 | - | |||||||||||||||||||
| 379 | - | |||||||||||||||||||
| 380 | - | |||||||||||||||||||
| 381 | - | |||||||||||||||||||
| 382 | - | |||||||||||||||||||
| 383 | - | |||||||||||||||||||
| 384 | - | |||||||||||||||||||
| 385 | QSupportedWritingSystems QPlatformFontDatabase::writingSystemsFromTrueTypeBits(quint32 unicodeRange[4], quint32 codePageRange[2]) | - | ||||||||||||||||||
| 386 | { | - | ||||||||||||||||||
| 387 | QSupportedWritingSystems writingSystems; | - | ||||||||||||||||||
| 388 | - | |||||||||||||||||||
| 389 | bool hasScript = false; | - | ||||||||||||||||||
| 390 | for (int i = 0; i < QFontDatabase::WritingSystemsCount
| 0 | ||||||||||||||||||
| 391 | int bit = requiredUnicodeBits[i][0]; | - | ||||||||||||||||||
| 392 | int index = bit/32; | - | ||||||||||||||||||
| 393 | int flag = 1 << (bit&31); | - | ||||||||||||||||||
| 394 | if (bit != 126
| 0 | ||||||||||||||||||
| 395 | bit = requiredUnicodeBits[i][1]; | - | ||||||||||||||||||
| 396 | index = bit/32; | - | ||||||||||||||||||
| 397 | - | |||||||||||||||||||
| 398 | flag = 1 << (bit&31); | - | ||||||||||||||||||
| 399 | if (bit == 127
| 0 | ||||||||||||||||||
| 400 | writingSystems.setSupported(QFontDatabase::WritingSystem(i)); | - | ||||||||||||||||||
| 401 | hasScript = true; | - | ||||||||||||||||||
| 402 | - | |||||||||||||||||||
| 403 | } never executed: end of block | 0 | ||||||||||||||||||
| 404 | } never executed: end of block | 0 | ||||||||||||||||||
| 405 | } never executed: end of block | 0 | ||||||||||||||||||
| 406 | if (codePageRange[0] & ((1 << Latin1CsbBit) | (1 << CentralEuropeCsbBit) | (1 << TurkishCsbBit) | (1 << BalticCsbBit))
| 0 | ||||||||||||||||||
| 407 | writingSystems.setSupported(QFontDatabase::Latin); | - | ||||||||||||||||||
| 408 | hasScript = true; | - | ||||||||||||||||||
| 409 | - | |||||||||||||||||||
| 410 | } never executed: end of block | 0 | ||||||||||||||||||
| 411 | if (codePageRange[0] & (1 << CyrillicCsbBit)
| 0 | ||||||||||||||||||
| 412 | writingSystems.setSupported(QFontDatabase::Cyrillic); | - | ||||||||||||||||||
| 413 | hasScript = true; | - | ||||||||||||||||||
| 414 | - | |||||||||||||||||||
| 415 | } never executed: end of block | 0 | ||||||||||||||||||
| 416 | if (codePageRange[0] & (1 << GreekCsbBit)
| 0 | ||||||||||||||||||
| 417 | writingSystems.setSupported(QFontDatabase::Greek); | - | ||||||||||||||||||
| 418 | hasScript = true; | - | ||||||||||||||||||
| 419 | - | |||||||||||||||||||
| 420 | } never executed: end of block | 0 | ||||||||||||||||||
| 421 | if (codePageRange[0] & (1 << HebrewCsbBit)
| 0 | ||||||||||||||||||
| 422 | writingSystems.setSupported(QFontDatabase::Hebrew); | - | ||||||||||||||||||
| 423 | hasScript = true; | - | ||||||||||||||||||
| 424 | - | |||||||||||||||||||
| 425 | } never executed: end of block | 0 | ||||||||||||||||||
| 426 | if (codePageRange[0] & (1 << ArabicCsbBit)
| 0 | ||||||||||||||||||
| 427 | writingSystems.setSupported(QFontDatabase::Arabic); | - | ||||||||||||||||||
| 428 | hasScript = true; | - | ||||||||||||||||||
| 429 | - | |||||||||||||||||||
| 430 | } never executed: end of block | 0 | ||||||||||||||||||
| 431 | if (codePageRange[0] & (1 << ThaiCsbBit)
| 0 | ||||||||||||||||||
| 432 | writingSystems.setSupported(QFontDatabase::Thai); | - | ||||||||||||||||||
| 433 | hasScript = true; | - | ||||||||||||||||||
| 434 | - | |||||||||||||||||||
| 435 | } never executed: end of block | 0 | ||||||||||||||||||
| 436 | if (codePageRange[0] & (1 << VietnameseCsbBit)
| 0 | ||||||||||||||||||
| 437 | writingSystems.setSupported(QFontDatabase::Vietnamese); | - | ||||||||||||||||||
| 438 | hasScript = true; | - | ||||||||||||||||||
| 439 | - | |||||||||||||||||||
| 440 | } never executed: end of block | 0 | ||||||||||||||||||
| 441 | if (codePageRange[0] & (1 << SimplifiedChineseCsbBit)
| 0 | ||||||||||||||||||
| 442 | writingSystems.setSupported(QFontDatabase::SimplifiedChinese); | - | ||||||||||||||||||
| 443 | hasScript = true; | - | ||||||||||||||||||
| 444 | - | |||||||||||||||||||
| 445 | } never executed: end of block | 0 | ||||||||||||||||||
| 446 | if (codePageRange[0] & (1 << TraditionalChineseCsbBit)
| 0 | ||||||||||||||||||
| 447 | writingSystems.setSupported(QFontDatabase::TraditionalChinese); | - | ||||||||||||||||||
| 448 | hasScript = true; | - | ||||||||||||||||||
| 449 | - | |||||||||||||||||||
| 450 | } never executed: end of block | 0 | ||||||||||||||||||
| 451 | if (codePageRange[0] & (1 << JapaneseCsbBit)
| 0 | ||||||||||||||||||
| 452 | writingSystems.setSupported(QFontDatabase::Japanese); | - | ||||||||||||||||||
| 453 | hasScript = true; | - | ||||||||||||||||||
| 454 | - | |||||||||||||||||||
| 455 | } never executed: end of block | 0 | ||||||||||||||||||
| 456 | if (codePageRange[0] & ((1 << KoreanCsbBit) | (1 << KoreanJohabCsbBit))
| 0 | ||||||||||||||||||
| 457 | writingSystems.setSupported(QFontDatabase::Korean); | - | ||||||||||||||||||
| 458 | hasScript = true; | - | ||||||||||||||||||
| 459 | - | |||||||||||||||||||
| 460 | } never executed: end of block | 0 | ||||||||||||||||||
| 461 | if (codePageRange[0] & (1U << SymbolCsbBit)
| 0 | ||||||||||||||||||
| 462 | writingSystems = QSupportedWritingSystems(); | - | ||||||||||||||||||
| 463 | hasScript = false; | - | ||||||||||||||||||
| 464 | } never executed: end of block | 0 | ||||||||||||||||||
| 465 | - | |||||||||||||||||||
| 466 | if (!hasScript
| 0 | ||||||||||||||||||
| 467 | writingSystems.setSupported(QFontDatabase::Symbol); never executed: writingSystems.setSupported(QFontDatabase::Symbol); | 0 | ||||||||||||||||||
| 468 | - | |||||||||||||||||||
| 469 | return never executed: writingSystems;return writingSystems;never executed: return writingSystems; | 0 | ||||||||||||||||||
| 470 | } | - | ||||||||||||||||||
| 471 | QFont::Weight QPlatformFontDatabase::weightFromInteger(int weight) | - | ||||||||||||||||||
| 472 | { | - | ||||||||||||||||||
| 473 | if (weight < 150
| 0 | ||||||||||||||||||
| 474 | return never executed: QFont::Thin;return QFont::Thin;never executed: return QFont::Thin; | 0 | ||||||||||||||||||
| 475 | if (weight < 250
| 0 | ||||||||||||||||||
| 476 | return never executed: QFont::ExtraLight;return QFont::ExtraLight;never executed: return QFont::ExtraLight; | 0 | ||||||||||||||||||
| 477 | if (weight < 350
| 0 | ||||||||||||||||||
| 478 | return never executed: QFont::Light;return QFont::Light;never executed: return QFont::Light; | 0 | ||||||||||||||||||
| 479 | if (weight < 450
| 0 | ||||||||||||||||||
| 480 | return never executed: QFont::Normal;return QFont::Normal;never executed: return QFont::Normal; | 0 | ||||||||||||||||||
| 481 | if (weight < 550
| 0 | ||||||||||||||||||
| 482 | return never executed: QFont::Medium;return QFont::Medium;never executed: return QFont::Medium; | 0 | ||||||||||||||||||
| 483 | if (weight < 650
| 0 | ||||||||||||||||||
| 484 | return never executed: QFont::DemiBold;return QFont::DemiBold;never executed: return QFont::DemiBold; | 0 | ||||||||||||||||||
| 485 | if (weight < 750
| 0 | ||||||||||||||||||
| 486 | return never executed: QFont::Bold;return QFont::Bold;never executed: return QFont::Bold; | 0 | ||||||||||||||||||
| 487 | if (weight < 850
| 0 | ||||||||||||||||||
| 488 | return never executed: QFont::ExtraBold;return QFont::ExtraBold;never executed: return QFont::ExtraBold; | 0 | ||||||||||||||||||
| 489 | return never executed: QFont::Black;return QFont::Black;never executed: return QFont::Black; | 0 | ||||||||||||||||||
| 490 | } | - | ||||||||||||||||||
| 491 | - | |||||||||||||||||||
| 492 | - | |||||||||||||||||||
| 493 | - | |||||||||||||||||||
| 494 | - | |||||||||||||||||||
| 495 | - | |||||||||||||||||||
| 496 | - | |||||||||||||||||||
| 497 | - | |||||||||||||||||||
| 498 | void QPlatformFontDatabase::registerAliasToFontFamily(const QString &familyName, const QString &alias) | - | ||||||||||||||||||
| 499 | { | - | ||||||||||||||||||
| 500 | qt_registerAliasToFontFamily(familyName, alias); | - | ||||||||||||||||||
| 501 | } never executed: end of block | 0 | ||||||||||||||||||
| 502 | - | |||||||||||||||||||
| Switch to Source code | Preprocessed file |