| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/gui/text/qrawfont.cpp | 
| Switch to Source code | Preprocessed file | 
| Line | Source | Count | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||||||||
| 2 | - | |||||||||||||||||||
| 3 | - | |||||||||||||||||||
| 4 | - | |||||||||||||||||||
| 5 | - | |||||||||||||||||||
| 6 | - | |||||||||||||||||||
| 7 | - | |||||||||||||||||||
| 8 | QRawFont::QRawFont() | - | ||||||||||||||||||
| 9 | : d(new QRawFontPrivate) | - | ||||||||||||||||||
| 10 | { | - | ||||||||||||||||||
| 11 | } never executed:  end of block | 0 | ||||||||||||||||||
| 12 | QRawFont::QRawFont(const QString &fileName, | - | ||||||||||||||||||
| 13 | qreal pixelSize, | - | ||||||||||||||||||
| 14 | QFont::HintingPreference hintingPreference) | - | ||||||||||||||||||
| 15 | : d(new QRawFontPrivate) | - | ||||||||||||||||||
| 16 | { | - | ||||||||||||||||||
| 17 | loadFromFile(fileName, pixelSize, hintingPreference); | - | ||||||||||||||||||
| 18 | } never executed:  end of block | 0 | ||||||||||||||||||
| 19 | QRawFont::QRawFont(const QByteArray &fontData, | - | ||||||||||||||||||
| 20 | qreal pixelSize, | - | ||||||||||||||||||
| 21 | QFont::HintingPreference hintingPreference) | - | ||||||||||||||||||
| 22 | : d(new QRawFontPrivate) | - | ||||||||||||||||||
| 23 | { | - | ||||||||||||||||||
| 24 | loadFromData(fontData, pixelSize, hintingPreference); | - | ||||||||||||||||||
| 25 | } never executed:  end of block | 0 | ||||||||||||||||||
| 26 | - | |||||||||||||||||||
| 27 | - | |||||||||||||||||||
| 28 | - | |||||||||||||||||||
| 29 | - | |||||||||||||||||||
| 30 | QRawFont::QRawFont(const QRawFont &other) | - | ||||||||||||||||||
| 31 | { | - | ||||||||||||||||||
| 32 | d = other.d; | - | ||||||||||||||||||
| 33 | } never executed:  end of block | 0 | ||||||||||||||||||
| 34 | - | |||||||||||||||||||
| 35 | - | |||||||||||||||||||
| 36 | - | |||||||||||||||||||
| 37 | - | |||||||||||||||||||
| 38 | QRawFont::~QRawFont() | - | ||||||||||||||||||
| 39 | { | - | ||||||||||||||||||
| 40 | } | - | ||||||||||||||||||
| 41 | - | |||||||||||||||||||
| 42 | - | |||||||||||||||||||
| 43 | - | |||||||||||||||||||
| 44 | - | |||||||||||||||||||
| 45 | QRawFont &QRawFont::operator=(const QRawFont &other) | - | ||||||||||||||||||
| 46 | { | - | ||||||||||||||||||
| 47 | d = other.d; | - | ||||||||||||||||||
| 48 |     return never executed:   *this;return *this;never executed:  return *this; | 0 | ||||||||||||||||||
| 49 | } | - | ||||||||||||||||||
| 50 | bool QRawFont::isValid() const | - | ||||||||||||||||||
| 51 | { | - | ||||||||||||||||||
| 52 |     return never executed:   d->isValid();return d->isValid();never executed:  return d->isValid(); | 0 | ||||||||||||||||||
| 53 | } | - | ||||||||||||||||||
| 54 | void QRawFont::loadFromFile(const QString &fileName, | - | ||||||||||||||||||
| 55 | qreal pixelSize, | - | ||||||||||||||||||
| 56 | QFont::HintingPreference hintingPreference) | - | ||||||||||||||||||
| 57 | { | - | ||||||||||||||||||
| 58 | QFile file(fileName); | - | ||||||||||||||||||
| 59 |     if (file.open(QIODevice::ReadOnly)
  | 0 | ||||||||||||||||||
| 60 |         loadFromData(file.readAll(), pixelSize, hintingPreference); never executed:  loadFromData(file.readAll(), pixelSize, hintingPreference); | 0 | ||||||||||||||||||
| 61 | } never executed:  end of block | 0 | ||||||||||||||||||
| 62 | void QRawFont::loadFromData(const QByteArray &fontData, | - | ||||||||||||||||||
| 63 | qreal pixelSize, | - | ||||||||||||||||||
| 64 | QFont::HintingPreference hintingPreference) | - | ||||||||||||||||||
| 65 | { | - | ||||||||||||||||||
| 66 | d.detach(); | - | ||||||||||||||||||
| 67 | d->cleanUp(); | - | ||||||||||||||||||
| 68 | d->hintingPreference = hintingPreference; | - | ||||||||||||||||||
| 69 | d->loadFromData(fontData, pixelSize, hintingPreference); | - | ||||||||||||||||||
| 70 | } never executed:  end of block | 0 | ||||||||||||||||||
| 71 | QImage QRawFont::alphaMapForGlyph(quint32 glyphIndex, AntialiasingType antialiasingType, | - | ||||||||||||||||||
| 72 | const QTransform &transform) const | - | ||||||||||||||||||
| 73 | { | - | ||||||||||||||||||
| 74 |     if (!d->isValid()
  | 0 | ||||||||||||||||||
| 75 |         return never executed:   QImage();return QImage();never executed:  return QImage(); | 0 | ||||||||||||||||||
| 76 | - | |||||||||||||||||||
| 77 |     if (antialiasingType == SubPixelAntialiasing
  | 0 | ||||||||||||||||||
| 78 |         return never executed:   d->fontEngine->alphaRGBMapForGlyph(glyphIndex, QFixed(), transform);return d->fontEngine->alphaRGBMapForGlyph(glyphIndex, QFixed(), transform);never executed:  return d->fontEngine->alphaRGBMapForGlyph(glyphIndex, QFixed(), transform); | 0 | ||||||||||||||||||
| 79 | - | |||||||||||||||||||
| 80 |     return never executed:   d->fontEngine->alphaMapForGlyph(glyphIndex, QFixed(), transform);return d->fontEngine->alphaMapForGlyph(glyphIndex, QFixed(), transform);never executed:  return d->fontEngine->alphaMapForGlyph(glyphIndex, QFixed(), transform); | 0 | ||||||||||||||||||
| 81 | } | - | ||||||||||||||||||
| 82 | QPainterPath QRawFont::pathForGlyph(quint32 glyphIndex) const | - | ||||||||||||||||||
| 83 | { | - | ||||||||||||||||||
| 84 |     if (!d->isValid()
  | 0 | ||||||||||||||||||
| 85 |         return never executed:   QPainterPath();return QPainterPath();never executed:  return QPainterPath(); | 0 | ||||||||||||||||||
| 86 | - | |||||||||||||||||||
| 87 | QFixedPoint position; | - | ||||||||||||||||||
| 88 | QPainterPath path; | - | ||||||||||||||||||
| 89 | d->fontEngine->addGlyphsToPath(&glyphIndex, &position, 1, &path, 0); | - | ||||||||||||||||||
| 90 |     return never executed:   path;return path;never executed:  return path; | 0 | ||||||||||||||||||
| 91 | } | - | ||||||||||||||||||
| 92 | - | |||||||||||||||||||
| 93 | - | |||||||||||||||||||
| 94 | - | |||||||||||||||||||
| 95 | - | |||||||||||||||||||
| 96 | bool QRawFont::operator==(const QRawFont &other) const | - | ||||||||||||||||||
| 97 | { | - | ||||||||||||||||||
| 98 |     return never executed:   d->fontEngine == other.d->fontEngine;return d->fontEngine == other.d->fontEngine;never executed:  return d->fontEngine == other.d->fontEngine; | 0 | ||||||||||||||||||
| 99 | } | - | ||||||||||||||||||
| 100 | qreal QRawFont::ascent() const | - | ||||||||||||||||||
| 101 | { | - | ||||||||||||||||||
| 102 |     return never executed:   d->isValid()return d->isValid() ? d->fontEngine->ascent().toReal() : 0.0;
 never executed:  return d->isValid() ? d->fontEngine->ascent().toReal() : 0.0; | 0 | ||||||||||||||||||
| 103 | } | - | ||||||||||||||||||
| 104 | qreal QRawFont::descent() const | - | ||||||||||||||||||
| 105 | { | - | ||||||||||||||||||
| 106 |     return never executed:   d->isValid()return d->isValid() ? d->fontEngine->descent().toReal() : 0.0;
 never executed:  return d->isValid() ? d->fontEngine->descent().toReal() : 0.0; | 0 | ||||||||||||||||||
| 107 | } | - | ||||||||||||||||||
| 108 | qreal QRawFont::xHeight() const | - | ||||||||||||||||||
| 109 | { | - | ||||||||||||||||||
| 110 |     return never executed:   d->isValid()return d->isValid() ? d->fontEngine->xHeight().toReal() : 0.0;
 never executed:  return d->isValid() ? d->fontEngine->xHeight().toReal() : 0.0; | 0 | ||||||||||||||||||
| 111 | } | - | ||||||||||||||||||
| 112 | qreal QRawFont::leading() const | - | ||||||||||||||||||
| 113 | { | - | ||||||||||||||||||
| 114 |     return never executed:   d->isValid()return d->isValid() ? d->fontEngine->leading().toReal() : 0.0;
 never executed:  return d->isValid() ? d->fontEngine->leading().toReal() : 0.0; | 0 | ||||||||||||||||||
| 115 | } | - | ||||||||||||||||||
| 116 | - | |||||||||||||||||||
| 117 | - | |||||||||||||||||||
| 118 | - | |||||||||||||||||||
| 119 | - | |||||||||||||||||||
| 120 | - | |||||||||||||||||||
| 121 | - | |||||||||||||||||||
| 122 | qreal QRawFont::averageCharWidth() const | - | ||||||||||||||||||
| 123 | { | - | ||||||||||||||||||
| 124 |     return never executed:   d->isValid()return d->isValid() ? d->fontEngine->averageCharWidth().toReal() : 0.0;
 never executed:  return d->isValid() ? d->fontEngine->averageCharWidth().toReal() : 0.0; | 0 | ||||||||||||||||||
| 125 | } | - | ||||||||||||||||||
| 126 | - | |||||||||||||||||||
| 127 | - | |||||||||||||||||||
| 128 | - | |||||||||||||||||||
| 129 | - | |||||||||||||||||||
| 130 | - | |||||||||||||||||||
| 131 | - | |||||||||||||||||||
| 132 | qreal QRawFont::maxCharWidth() const | - | ||||||||||||||||||
| 133 | { | - | ||||||||||||||||||
| 134 |     return never executed:   d->isValid()return d->isValid() ? d->fontEngine->maxCharWidth() : 0.0;
 never executed:  return d->isValid() ? d->fontEngine->maxCharWidth() : 0.0; | 0 | ||||||||||||||||||
| 135 | } | - | ||||||||||||||||||
| 136 | qreal QRawFont::pixelSize() const | - | ||||||||||||||||||
| 137 | { | - | ||||||||||||||||||
| 138 |     return never executed:   d->isValid()return d->isValid() ? d->fontEngine->fontDef.pixelSize : 0.0;
 never executed:  return d->isValid() ? d->fontEngine->fontDef.pixelSize : 0.0; | 0 | ||||||||||||||||||
| 139 | } | - | ||||||||||||||||||
| 140 | qreal QRawFont::unitsPerEm() const | - | ||||||||||||||||||
| 141 | { | - | ||||||||||||||||||
| 142 |     return never executed:   d->isValid()return d->isValid() ? d->fontEngine->emSquareSize().toReal() : 0.0;
 never executed:  return d->isValid() ? d->fontEngine->emSquareSize().toReal() : 0.0; | 0 | ||||||||||||||||||
| 143 | } | - | ||||||||||||||||||
| 144 | - | |||||||||||||||||||
| 145 | - | |||||||||||||||||||
| 146 | - | |||||||||||||||||||
| 147 | - | |||||||||||||||||||
| 148 | - | |||||||||||||||||||
| 149 | qreal QRawFont::lineThickness() const | - | ||||||||||||||||||
| 150 | { | - | ||||||||||||||||||
| 151 |     return never executed:   d->isValid()return d->isValid() ? d->fontEngine->lineThickness().toReal() : 0.0;
 never executed:  return d->isValid() ? d->fontEngine->lineThickness().toReal() : 0.0; | 0 | ||||||||||||||||||
| 152 | } | - | ||||||||||||||||||
| 153 | - | |||||||||||||||||||
| 154 | - | |||||||||||||||||||
| 155 | - | |||||||||||||||||||
| 156 | - | |||||||||||||||||||
| 157 | - | |||||||||||||||||||
| 158 | qreal QRawFont::underlinePosition() const | - | ||||||||||||||||||
| 159 | { | - | ||||||||||||||||||
| 160 |     return never executed:   d->isValid()return d->isValid() ? d->fontEngine->underlinePosition().toReal() : 0.0;
 never executed:  return d->isValid() ? d->fontEngine->underlinePosition().toReal() : 0.0; | 0 | ||||||||||||||||||
| 161 | } | - | ||||||||||||||||||
| 162 | - | |||||||||||||||||||
| 163 | - | |||||||||||||||||||
| 164 | - | |||||||||||||||||||
| 165 | - | |||||||||||||||||||
| 166 | QString QRawFont::familyName() const | - | ||||||||||||||||||
| 167 | { | - | ||||||||||||||||||
| 168 |     return never executed:   d->isValid()return d->isValid() ? d->fontEngine->fontDef.family : QString();
 never executed:  return d->isValid() ? d->fontEngine->fontDef.family : QString(); | 0 | ||||||||||||||||||
| 169 | } | - | ||||||||||||||||||
| 170 | - | |||||||||||||||||||
| 171 | - | |||||||||||||||||||
| 172 | - | |||||||||||||||||||
| 173 | - | |||||||||||||||||||
| 174 | - | |||||||||||||||||||
| 175 | - | |||||||||||||||||||
| 176 | QString QRawFont::styleName() const | - | ||||||||||||||||||
| 177 | { | - | ||||||||||||||||||
| 178 |     return never executed:   d->isValid()return d->isValid() ? d->fontEngine->fontDef.styleName : QString();
 never executed:  return d->isValid() ? d->fontEngine->fontDef.styleName : QString(); | 0 | ||||||||||||||||||
| 179 | } | - | ||||||||||||||||||
| 180 | - | |||||||||||||||||||
| 181 | - | |||||||||||||||||||
| 182 | - | |||||||||||||||||||
| 183 | - | |||||||||||||||||||
| 184 | - | |||||||||||||||||||
| 185 | - | |||||||||||||||||||
| 186 | QFont::Style QRawFont::style() const | - | ||||||||||||||||||
| 187 | { | - | ||||||||||||||||||
| 188 |     return never executed:   d->isValid()return d->isValid() ? QFont::Style(d->fontEngine->fontDef.style) : QFont::StyleNormal;
 never executed:  return d->isValid() ? QFont::Style(d->fontEngine->fontDef.style) : QFont::StyleNormal; | 0 | ||||||||||||||||||
| 189 | } | - | ||||||||||||||||||
| 190 | - | |||||||||||||||||||
| 191 | - | |||||||||||||||||||
| 192 | - | |||||||||||||||||||
| 193 | - | |||||||||||||||||||
| 194 | - | |||||||||||||||||||
| 195 | - | |||||||||||||||||||
| 196 | int QRawFont::weight() const | - | ||||||||||||||||||
| 197 | { | - | ||||||||||||||||||
| 198 |     return never executed:   d->isValid()return d->isValid() ? int(d->fontEngine->fontDef.weight) : -1;
 never executed:  return d->isValid() ? int(d->fontEngine->fontDef.weight) : -1; | 0 | ||||||||||||||||||
| 199 | } | - | ||||||||||||||||||
| 200 | QVector<quint32> QRawFont::glyphIndexesForString(const QString &text) const | - | ||||||||||||||||||
| 201 | { | - | ||||||||||||||||||
| 202 | QVector<quint32> glyphIndexes; | - | ||||||||||||||||||
| 203 |     if (!d->isValid()
 
  | 0 | ||||||||||||||||||
| 204 |         return never executed:   glyphIndexes;return glyphIndexes;never executed:  return glyphIndexes; | 0 | ||||||||||||||||||
| 205 | - | |||||||||||||||||||
| 206 | int numGlyphs = text.size(); | - | ||||||||||||||||||
| 207 | glyphIndexes.resize(numGlyphs); | - | ||||||||||||||||||
| 208 | - | |||||||||||||||||||
| 209 | QGlyphLayout glyphs; | - | ||||||||||||||||||
| 210 | glyphs.numGlyphs = numGlyphs; | - | ||||||||||||||||||
| 211 | glyphs.glyphs = glyphIndexes.data(); | - | ||||||||||||||||||
| 212 |     if (!d->fontEngine->stringToCMap(text.data(), text.size(), &glyphs, &numGlyphs, QFontEngine::GlyphIndicesOnly)
  | 0 | ||||||||||||||||||
| 213 |         do { ((!(false)) ? qt_assert_x("Q_UNREACHABLE()", "Q_UNREACHABLE was reached",__FILE__,493) : qt_noop()); __builtin_unreachable(); } never executed:   while (0);end of block | 0 | ||||||||||||||||||
| 214 | - | |||||||||||||||||||
| 215 | glyphIndexes.resize(numGlyphs); | - | ||||||||||||||||||
| 216 |     return never executed:   glyphIndexes;return glyphIndexes;never executed:  return glyphIndexes; | 0 | ||||||||||||||||||
| 217 | } | - | ||||||||||||||||||
| 218 | bool QRawFont::glyphIndexesForChars(const QChar *chars, int numChars, quint32 *glyphIndexes, int *numGlyphs) const | - | ||||||||||||||||||
| 219 | { | - | ||||||||||||||||||
| 220 | ((!(numGlyphs)) ? qt_assert("numGlyphs",__FILE__,511) : qt_noop()); | - | ||||||||||||||||||
| 221 |     if (!d->isValid()
 
  | 0 | ||||||||||||||||||
| 222 | *numGlyphs = 0; | - | ||||||||||||||||||
| 223 |         return never executed:   false;return false;never executed:  return false; | 0 | ||||||||||||||||||
| 224 | } | - | ||||||||||||||||||
| 225 | - | |||||||||||||||||||
| 226 |     if (*
 
 
  | 0 | ||||||||||||||||||
| 227 | *numGlyphs = numChars; | - | ||||||||||||||||||
| 228 |         return never executed:   false;return false;never executed:  return false; | 0 | ||||||||||||||||||
| 229 | } | - | ||||||||||||||||||
| 230 | - | |||||||||||||||||||
| 231 | QGlyphLayout glyphs; | - | ||||||||||||||||||
| 232 | glyphs.numGlyphs = *numGlyphs; | - | ||||||||||||||||||
| 233 | glyphs.glyphs = glyphIndexes; | - | ||||||||||||||||||
| 234 |     return never executed:   d->fontEngine->stringToCMap(chars, numChars, &glyphs, numGlyphs, QFontEngine::GlyphIndicesOnly);return d->fontEngine->stringToCMap(chars, numChars, &glyphs, numGlyphs, QFontEngine::GlyphIndicesOnly);never executed:  return d->fontEngine->stringToCMap(chars, numChars, &glyphs, numGlyphs, QFontEngine::GlyphIndicesOnly); | 0 | ||||||||||||||||||
| 235 | } | - | ||||||||||||||||||
| 236 | bool QRawFont::advancesForGlyphIndexes(const quint32 *glyphIndexes, QPointF *advances, int numGlyphs, LayoutFlags layoutFlags) const | - | ||||||||||||||||||
| 237 | { | - | ||||||||||||||||||
| 238 | ((!(glyphIndexes && advances)) ? qt_assert("glyphIndexes && advances",__FILE__,566) : qt_noop()); | - | ||||||||||||||||||
| 239 |     if (!d->isValid()
 
  | 0 | ||||||||||||||||||
| 240 |         return never executed:   false;return false;never executed:  return false; | 0 | ||||||||||||||||||
| 241 | - | |||||||||||||||||||
| 242 | QVarLengthArray<QFixed> tmpAdvances(numGlyphs); | - | ||||||||||||||||||
| 243 | - | |||||||||||||||||||
| 244 | QGlyphLayout glyphs; | - | ||||||||||||||||||
| 245 | glyphs.glyphs = const_cast<glyph_t *>(glyphIndexes); | - | ||||||||||||||||||
| 246 | glyphs.numGlyphs = numGlyphs; | - | ||||||||||||||||||
| 247 | glyphs.advances = tmpAdvances.data(); | - | ||||||||||||||||||
| 248 | - | |||||||||||||||||||
| 249 | bool design = layoutFlags & UseDesignMetrics; | - | ||||||||||||||||||
| 250 | - | |||||||||||||||||||
| 251 | d->fontEngine->recalcAdvances(&glyphs, design ? QFontEngine::DesignMetrics : QFontEngine::ShaperFlag(0)); | - | ||||||||||||||||||
| 252 |     if (layoutFlags & KernedAdvances
  | 0 | ||||||||||||||||||
| 253 |         d->fontEngine->doKerning(&glyphs, design ? QFontEngine::DesignMetrics : QFontEngine::ShaperFlag(0)); never executed:  d->fontEngine->doKerning(&glyphs, design ? QFontEngine::DesignMetrics : QFontEngine::ShaperFlag(0)); | 0 | ||||||||||||||||||
| 254 | - | |||||||||||||||||||
| 255 |     for (int i=0; i<numGlyphs
  | 0 | ||||||||||||||||||
| 256 |         advances[i] = QPointF(tmpAdvances[i].toReal(), 0.0); never executed:  advances[i] = QPointF(tmpAdvances[i].toReal(), 0.0); | 0 | ||||||||||||||||||
| 257 | - | |||||||||||||||||||
| 258 |     return never executed:   true;return true;never executed:  return true; | 0 | ||||||||||||||||||
| 259 | } | - | ||||||||||||||||||
| 260 | bool QRawFont::advancesForGlyphIndexes(const quint32 *glyphIndexes, QPointF *advances, int numGlyphs) const | - | ||||||||||||||||||
| 261 | { | - | ||||||||||||||||||
| 262 |     return never executed:   QRawFont::advancesForGlyphIndexes(glyphIndexes, advances, numGlyphs, SeparateAdvances);return QRawFont::advancesForGlyphIndexes(glyphIndexes, advances, numGlyphs, SeparateAdvances);never executed:  return QRawFont::advancesForGlyphIndexes(glyphIndexes, advances, numGlyphs, SeparateAdvances); | 0 | ||||||||||||||||||
| 263 | } | - | ||||||||||||||||||
| 264 | - | |||||||||||||||||||
| 265 | - | |||||||||||||||||||
| 266 | - | |||||||||||||||||||
| 267 | - | |||||||||||||||||||
| 268 | - | |||||||||||||||||||
| 269 | - | |||||||||||||||||||
| 270 | QFont::HintingPreference QRawFont::hintingPreference() const | - | ||||||||||||||||||
| 271 | { | - | ||||||||||||||||||
| 272 |     return never executed:   d->isValid()return d->isValid() ? d->hintingPreference : QFont::PreferDefaultHinting;
 never executed:  return d->isValid() ? d->hintingPreference : QFont::PreferDefaultHinting; | 0 | ||||||||||||||||||
| 273 | } | - | ||||||||||||||||||
| 274 | - | |||||||||||||||||||
| 275 | - | |||||||||||||||||||
| 276 | - | |||||||||||||||||||
| 277 | - | |||||||||||||||||||
| 278 | - | |||||||||||||||||||
| 279 | - | |||||||||||||||||||
| 280 | - | |||||||||||||||||||
| 281 | QByteArray QRawFont::fontTable(const char *tagName) const | - | ||||||||||||||||||
| 282 | { | - | ||||||||||||||||||
| 283 |     if (!d->isValid()
  | 0 | ||||||||||||||||||
| 284 |         return never executed:   QByteArray();return QByteArray();never executed:  return QByteArray(); | 0 | ||||||||||||||||||
| 285 | - | |||||||||||||||||||
| 286 |     return never executed:   d->fontEngine->getSfntTable(( (((quint32)(tagName[0])) << 24) | (((quint32)(tagName[1])) << 16) | (((quint32)(tagName[2])) << 8) | ((quint32)(tagName[3])) ));return d->fontEngine->getSfntTable(( (((quint32)(tagName[0])) << 24) | (((quint32)(tagName[1])) << 16) | (((quint32)(tagName[2])) << 8) | ((quint32)(tagName[3])) ));never executed:  return d->fontEngine->getSfntTable(( (((quint32)(tagName[0])) << 24) | (((quint32)(tagName[1])) << 16) | (((quint32)(tagName[2])) << 8) | ((quint32)(tagName[3])) )); | 0 | ||||||||||||||||||
| 287 | } | - | ||||||||||||||||||
| 288 | QList<QFontDatabase::WritingSystem> QRawFont::supportedWritingSystems() const | - | ||||||||||||||||||
| 289 | { | - | ||||||||||||||||||
| 290 | QList<QFontDatabase::WritingSystem> writingSystems; | - | ||||||||||||||||||
| 291 |     if (d->isValid()
  | 0 | ||||||||||||||||||
| 292 | QByteArray os2Table = fontTable("OS/2"); | - | ||||||||||||||||||
| 293 |         if (os2Table.size() > 86
  | 0 | ||||||||||||||||||
| 294 | const uchar * const data = reinterpret_cast<const uchar *>(os2Table.constData()); | - | ||||||||||||||||||
| 295 | const uchar * const bigEndianUnicodeRanges = data + 42; | - | ||||||||||||||||||
| 296 | const uchar * const bigEndianCodepageRanges = data + 78; | - | ||||||||||||||||||
| 297 | - | |||||||||||||||||||
| 298 | quint32 unicodeRanges[4]; | - | ||||||||||||||||||
| 299 | quint32 codepageRanges[2]; | - | ||||||||||||||||||
| 300 | - | |||||||||||||||||||
| 301 |             for (size_t i = 0; i < sizeof unicodeRanges / sizeof *unicodeRanges
  | 0 | ||||||||||||||||||
| 302 |                 unicodeRanges[i] = qFromBigEndian<quint32>(bigEndianUnicodeRanges + i * sizeof(quint32)); never executed:  unicodeRanges[i] = qFromBigEndian<quint32>(bigEndianUnicodeRanges + i * sizeof(quint32)); | 0 | ||||||||||||||||||
| 303 | - | |||||||||||||||||||
| 304 |             for (size_t i = 0; i < sizeof codepageRanges / sizeof *codepageRanges
  | 0 | ||||||||||||||||||
| 305 |                 codepageRanges[i] = qFromBigEndian<quint32>(bigEndianCodepageRanges + i * sizeof(quint32)); never executed:  codepageRanges[i] = qFromBigEndian<quint32>(bigEndianCodepageRanges + i * sizeof(quint32)); | 0 | ||||||||||||||||||
| 306 | - | |||||||||||||||||||
| 307 | QSupportedWritingSystems ws = QPlatformFontDatabase::writingSystemsFromTrueTypeBits(unicodeRanges, codepageRanges); | - | ||||||||||||||||||
| 308 |             for (int i = 0; i < QFontDatabase::WritingSystemsCount
  | 0 | ||||||||||||||||||
| 309 |                 if (ws.supported(QFontDatabase::WritingSystem(i))
  | 0 | ||||||||||||||||||
| 310 |                     writingSystems.append(QFontDatabase::WritingSystem(i)); never executed:  writingSystems.append(QFontDatabase::WritingSystem(i)); | 0 | ||||||||||||||||||
| 311 |             } never executed:  end of block | 0 | ||||||||||||||||||
| 312 |         } never executed:  end of block | 0 | ||||||||||||||||||
| 313 |     } never executed:  end of block | 0 | ||||||||||||||||||
| 314 | - | |||||||||||||||||||
| 315 |     return never executed:   writingSystems;return writingSystems;never executed:  return writingSystems; | 0 | ||||||||||||||||||
| 316 | } | - | ||||||||||||||||||
| 317 | - | |||||||||||||||||||
| 318 | - | |||||||||||||||||||
| 319 | - | |||||||||||||||||||
| 320 | - | |||||||||||||||||||
| 321 | - | |||||||||||||||||||
| 322 | - | |||||||||||||||||||
| 323 | bool QRawFont::supportsCharacter(QChar character) const | - | ||||||||||||||||||
| 324 | { | - | ||||||||||||||||||
| 325 |     return never executed:   supportsCharacter(character.unicode());return supportsCharacter(character.unicode());never executed:  return supportsCharacter(character.unicode()); | 0 | ||||||||||||||||||
| 326 | } | - | ||||||||||||||||||
| 327 | bool QRawFont::supportsCharacter(uint ucs4) const | - | ||||||||||||||||||
| 328 | { | - | ||||||||||||||||||
| 329 |     return never executed:   d->isValid()return d->isValid() && d->fontEngine->canRender(ucs4);
 
 never executed:  return d->isValid() && d->fontEngine->canRender(ucs4); | 0 | ||||||||||||||||||
| 330 | } | - | ||||||||||||||||||
| 331 | - | |||||||||||||||||||
| 332 | - | |||||||||||||||||||
| 333 | extern int qt_script_for_writing_system(QFontDatabase::WritingSystem writingSystem); | - | ||||||||||||||||||
| 334 | QRawFont QRawFont::fromFont(const QFont &font, QFontDatabase::WritingSystem writingSystem) | - | ||||||||||||||||||
| 335 | { | - | ||||||||||||||||||
| 336 | QRawFont rawFont; | - | ||||||||||||||||||
| 337 | QFontPrivate *font_d = QFontPrivate::get(font); | - | ||||||||||||||||||
| 338 | int script = qt_script_for_writing_system(writingSystem); | - | ||||||||||||||||||
| 339 | QFontEngine *fe = font_d->engineForScript(script); | - | ||||||||||||||||||
| 340 | - | |||||||||||||||||||
| 341 |     if (fe != 0
 
  | 0 | ||||||||||||||||||
| 342 | QFontEngineMulti *multiEngine = static_cast<QFontEngineMulti *>(fe); | - | ||||||||||||||||||
| 343 | fe = multiEngine->engine(0); | - | ||||||||||||||||||
| 344 | ((!(fe)) ? qt_assert("fe",__FILE__,712) : qt_noop()); | - | ||||||||||||||||||
| 345 |     } never executed:  end of block | 0 | ||||||||||||||||||
| 346 | - | |||||||||||||||||||
| 347 |     if (fe != 0
  | 0 | ||||||||||||||||||
| 348 | rawFont.d.data()->setFontEngine(fe); | - | ||||||||||||||||||
| 349 | rawFont.d.data()->hintingPreference = font.hintingPreference(); | - | ||||||||||||||||||
| 350 |     } never executed:  end of block | 0 | ||||||||||||||||||
| 351 |     return never executed:   rawFont;return rawFont;never executed:  return rawFont; | 0 | ||||||||||||||||||
| 352 | } | - | ||||||||||||||||||
| 353 | - | |||||||||||||||||||
| 354 | - | |||||||||||||||||||
| 355 | - | |||||||||||||||||||
| 356 | - | |||||||||||||||||||
| 357 | void QRawFont::setPixelSize(qreal pixelSize) | - | ||||||||||||||||||
| 358 | { | - | ||||||||||||||||||
| 359 |     if (!d->isValid()
 
  | 0 | ||||||||||||||||||
| 360 |         return; never executed:  return; | 0 | ||||||||||||||||||
| 361 | - | |||||||||||||||||||
| 362 | d.detach(); | - | ||||||||||||||||||
| 363 | d->setFontEngine(d->fontEngine->cloneWithSize(pixelSize)); | - | ||||||||||||||||||
| 364 | } never executed:  end of block | 0 | ||||||||||||||||||
| 365 | - | |||||||||||||||||||
| 366 | - | |||||||||||||||||||
| 367 | - | |||||||||||||||||||
| 368 | - | |||||||||||||||||||
| 369 | void QRawFontPrivate::loadFromData(const QByteArray &fontData, qreal pixelSize, | - | ||||||||||||||||||
| 370 | QFont::HintingPreference hintingPreference) | - | ||||||||||||||||||
| 371 | { | - | ||||||||||||||||||
| 372 | ((!(fontEngine == 0)) ? qt_assert("fontEngine == 0",__FILE__,740) : qt_noop()); | - | ||||||||||||||||||
| 373 | - | |||||||||||||||||||
| 374 | QPlatformFontDatabase *pfdb = QGuiApplicationPrivate::platformIntegration()->fontDatabase(); | - | ||||||||||||||||||
| 375 | setFontEngine(pfdb->fontEngine(fontData, pixelSize, hintingPreference)); | - | ||||||||||||||||||
| 376 | } never executed:  end of block | 0 | ||||||||||||||||||
| 377 | - | |||||||||||||||||||
| 378 | - | |||||||||||||||||||
| 379 | - | |||||||||||||||||||
| 380 | - | |||||||||||||||||||
| 381 | - | |||||||||||||||||||
| 382 | - | |||||||||||||||||||
| 383 | QRectF QRawFont::boundingRect(quint32 glyphIndex) const | - | ||||||||||||||||||
| 384 | { | - | ||||||||||||||||||
| 385 |     if (!d->isValid()
  | 0 | ||||||||||||||||||
| 386 |         return never executed:   QRectF();return QRectF();never executed:  return QRectF(); | 0 | ||||||||||||||||||
| 387 | - | |||||||||||||||||||
| 388 | glyph_metrics_t gm = d->fontEngine->boundingBox(glyphIndex); | - | ||||||||||||||||||
| 389 |     return never executed:   QRectF(gm.x.toReal(), gm.y.toReal(), gm.width.toReal(), gm.height.toReal());return QRectF(gm.x.toReal(), gm.y.toReal(), gm.width.toReal(), gm.height.toReal());never executed:  return QRectF(gm.x.toReal(), gm.y.toReal(), gm.width.toReal(), gm.height.toReal()); | 0 | ||||||||||||||||||
| 390 | } | - | ||||||||||||||||||
| 391 | - | |||||||||||||||||||
| 392 | - | |||||||||||||||||||
| 393 | - | |||||||||||||||||||
| 394 | - | |||||||||||||||||||
| Switch to Source code | Preprocessed file |