diff options
author | Allan Sandfeld Jensen <allan.jensen@digia.com> | 2014-08-13 18:44:24 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@digia.com> | 2014-08-14 17:54:34 +0200 |
commit | a128347c9b51fc9fa629662a14b77e1489537276 (patch) | |
tree | 7abf9725f21eadf29695d02958d71c10b43d8389 /src/gui | |
parent | 91e103d7571e3df88c70e0f043ccac0670191b62 (diff) |
Fix rendering of fonts matched based on stretch
If the fontdatabase matches a font based on the stretch aka width
then the stretch factor on the font-engine needs to be 100
to avoid the fontengine doing manual stretching.
Without this a font requested with 75 stretch and matched with a font
of 75 stretch would be further condensed 25% by the fontengine.
Change-Id: Ib85ff027420c0ce891b0808dab13d25417d22df1
Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/text/qfontdatabase.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp index 7aa5af8a98..c3be9da2f7 100644 --- a/src/gui/text/qfontdatabase.cpp +++ b/src/gui/text/qfontdatabase.cpp @@ -822,6 +822,13 @@ QFontEngine *loadSingleEngine(int script, QFontCache::Key key(def,script); QFontEngine *engine = QFontCache::instance()->findEngine(key); if (!engine) { + // If the font data's native stretch matches the requested stretch we need to set stretch to 100 + // to avoid the fontengine synthesizing stretch. If they didn't match exactly we need to calculate + // the new stretch factor. This only done if not matched by styleName. + bool styleNameMatch = !request.styleName.isEmpty() && request.styleName == style->styleName; + if (!styleNameMatch && style->key.stretch != 0 && request.stretch != 0) + def.stretch = (request.stretch * 100 + 50) / style->key.stretch; + engine = pfdb->fontEngine(def, size->handle); if (engine) { Q_ASSERT(engine->type() != QFontEngine::Multi); |