summaryrefslogtreecommitdiffstats
path: root/src/gui/text/qfontdatabase.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/text/qfontdatabase.cpp')
-rw-r--r--src/gui/text/qfontdatabase.cpp36
1 files changed, 21 insertions, 15 deletions
diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp
index c61c749148..d2da24ca94 100644
--- a/src/gui/text/qfontdatabase.cpp
+++ b/src/gui/text/qfontdatabase.cpp
@@ -663,11 +663,8 @@ struct QtFontDesc
static void initFontDef(const QtFontDesc &desc, const QFontDef &request, QFontDef *fontDef, bool multi)
{
fontDef->family = desc.family->name;
- if (! desc.foundry->name.isEmpty() && desc.family->count > 1) {
- fontDef->family += QString::fromLatin1(" [");
- fontDef->family += desc.foundry->name;
- fontDef->family += QLatin1Char(']');
- }
+ if (! desc.foundry->name.isEmpty() && desc.family->count > 1)
+ fontDef->family += QLatin1String(" [") + desc.foundry->name + QLatin1Char(']');
if (desc.style->smoothScalable
|| QGuiApplicationPrivate::platformIntegration()->fontDatabase()->fontsAlwaysScalable()
@@ -956,12 +953,14 @@ QFontEngine *loadSingleEngine(int script,
}
}
- // 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.
+ // To avoid synthesized stretch we need a matching stretch to be 100 after this point.
+ // If stretch didn't match exactly we need to calculate the new stretch factor.
+ // This only done if not matched by styleName.
if (style->key.stretch != 0 && request.stretch != 0
&& (request.styleName.isEmpty() || request.styleName != style->styleName)) {
- def.stretch = (request.stretch * 100 + 50) / style->key.stretch;
+ def.stretch = (request.stretch * 100 + style->key.stretch / 2) / style->key.stretch;
+ } else {
+ def.stretch = 100;
}
engine = pfdb->fontEngine(def, size->handle);
@@ -1224,7 +1223,8 @@ static int match(int script, const QFontDef &request,
QtFontStyle::Key styleKey;
styleKey.style = request.style;
styleKey.weight = request.weight;
- styleKey.stretch = request.stretch;
+ // Prefer a stretch closest to 100.
+ styleKey.stretch = request.stretch ? request.stretch : 100;
char pitch = request.ignorePitch ? '*' : request.fixedPitch ? 'm' : 'p';
@@ -2220,10 +2220,18 @@ QString QFontDatabase::writingSystemSample(WritingSystem writingSystem)
sample += QChar(0x05D3);
break;
case Arabic:
+ sample += QChar(0x0623);
+ sample += QChar(0x0628);
+ sample += QChar(0x062C);
+ sample += QChar(0x062F);
+ sample += QChar(0x064A);
+ sample += QChar(0x0629);
+ sample += QChar(0x0020);
+ sample += QChar(0x0639);
+ sample += QChar(0x0631);
sample += QChar(0x0628);
+ sample += QChar(0x064A);
sample += QChar(0x0629);
- sample += QChar(0x062A);
- sample += QChar(0x063A);
break;
case Syriac:
sample += QChar(0x0715);
@@ -2426,7 +2434,7 @@ int QFontDatabasePrivate::addAppFont(const QByteArray &fontData, const QString &
}
if (font.fileName.isEmpty() && !fontData.isEmpty())
- font.fileName = QString::fromLatin1(":qmemoryfonts/") + QString::number(i);
+ font.fileName = QLatin1String(":qmemoryfonts/") + QString::number(i);
registerFont(&font);
if (font.families.isEmpty())
@@ -2731,8 +2739,6 @@ void QFontDatabase::load(const QFontPrivate *d, int script)
}
if (req.pointSize < 0)
req.pointSize = req.pixelSize*72.0/d->dpi;
- if (req.stretch == 0)
- req.stretch = 100;
// respect the fallback families that might be passed through the request
const QStringList fallBackFamilies = familyList(req);