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>
This commit is contained in:
parent
91e103d757
commit
a128347c9b
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user