diff options
author | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com> | 2010-05-03 09:55:44 +0200 |
---|---|---|
committer | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com> | 2010-06-04 08:59:59 +0200 |
commit | cad70d64d0bbada72a072ac7fdf461839db9d72a (patch) | |
tree | d90c97fdc9561d6108820126e8c7e6d46683f88f /src/gui/text/qfontengine.cpp | |
parent | a64791bdf663fb1d7595f11fbe7e44a62acd4126 (diff) |
New class: QGlyphs
Introduce an API to access glyph indexes in a font directly.
A bug was discovered during this work, where different hinting flags
in loadGlyph() and loadGlyphMetrics() would make the metrics in
the two functions different, thus causing drawCachedGlyphs()
(which uses loadGlyphMetrics() indirectly) to use different metrics
than the standard drawTextItem() code path (which uses loadGlyph()).
The bug was visible in the tst_QGlyphs::drawExistingGlyphs() test.
Reviewed-by: Simon Hausmann
Diffstat (limited to 'src/gui/text/qfontengine.cpp')
-rw-r--r-- | src/gui/text/qfontengine.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp index 194c5f3dd4..2d95baef1f 100644 --- a/src/gui/text/qfontengine.cpp +++ b/src/gui/text/qfontengine.cpp @@ -242,6 +242,24 @@ glyph_metrics_t QFontEngine::boundingBox(glyph_t glyph, const QTransform &matrix return metrics; } +QFont QFontEngine::createExplicitFont() const +{ + return createExplicitFontWithName(fontDef.family); +} + +QFont QFontEngine::createExplicitFontWithName(const QString &familyName) const +{ + QFont font(familyName); + font.setStyleStrategy(QFont::NoFontMerging); + font.setWeight(fontDef.weight); + font.setItalic(fontDef.style == QFont::StyleItalic); + if (fontDef.pointSize < 0) + font.setPixelSize(fontDef.pixelSize); + else + font.setPointSizeF(fontDef.pointSize); + return font; +} + QFixed QFontEngine::xHeight() const { QGlyphLayoutArray<8> glyphs; |