summaryrefslogtreecommitdiffstats
path: root/src/gui/text
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@theqtcompany.com>2015-05-04 13:16:14 +0200
committerSimon Hausmann <simon.hausmann@theqtcompany.com>2015-05-04 13:19:31 +0200
commit7f8719e663edae8b08d34cc67cb5000e8402d3d7 (patch)
treeb098d2c8077a88c2ada577ac874e1416adaf66f7 /src/gui/text
parentaf851c290b7cea22f26bb8c852b0029696469d74 (diff)
parenteb82959d6688f9e58be4b67670afba3649f1f799 (diff)
Merge remote-tracking branch 'origin/5.5' into HEAD
Diffstat (limited to 'src/gui/text')
-rw-r--r--src/gui/text/qfont.cpp6
-rw-r--r--src/gui/text/qfontdatabase.cpp44
-rw-r--r--src/gui/text/qplatformfontdatabase.cpp2
3 files changed, 11 insertions, 41 deletions
diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp
index a5fade99fd..ce39645246 100644
--- a/src/gui/text/qfont.cpp
+++ b/src/gui/text/qfont.cpp
@@ -1724,10 +1724,8 @@ bool QFont::rawMode() const
*/
QFont QFont::resolve(const QFont &other) const
{
- if (*this == other
- && (resolve_mask == other.resolve_mask || resolve_mask == 0)
- && d->dpi == other.d->dpi) {
- QFont o = other;
+ if (resolve_mask == 0 || (resolve_mask == other.resolve_mask && *this == other)) {
+ QFont o(other);
o.resolve_mask = resolve_mask;
return o;
}
diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp
index 0f3cb21c70..126f0bf3ec 100644
--- a/src/gui/text/qfontdatabase.cpp
+++ b/src/gui/text/qfontdatabase.cpp
@@ -172,16 +172,6 @@ static int getFontWeight(const QString &weightString)
return QFont::Normal;
}
-struct QtFontEncoding
-{
- signed int encoding : 16;
-
- uint xpoint : 16;
- uint xres : 8;
- uint yres : 8;
- uint avgwidth : 16;
- uchar pitch : 8;
-};
struct QtFontSize
{
@@ -617,19 +607,13 @@ static void parseFontName(const QString &name, QString &foundry, QString &family
struct QtFontDesc
{
- inline QtFontDesc() : family(0), foundry(0), style(0), size(0), encoding(0), familyIndex(-1) {}
+ inline QtFontDesc() : family(0), foundry(0), style(0), size(0) {}
QtFontFamily *family;
QtFontFoundry *foundry;
QtFontStyle *style;
QtFontSize *size;
- QtFontEncoding *encoding;
- int familyIndex;
};
-static int match(int script, const QFontDef &request,
- const QString &family_name, const QString &foundry_name, int force_encoding_id,
- QtFontDesc *desc, const QList<int> &blacklisted);
-
static void initFontDef(const QtFontDesc &desc, const QFontDef &request, QFontDef *fontDef, bool multi)
{
fontDef->family = desc.family->name;
@@ -981,16 +965,14 @@ static
unsigned int bestFoundry(int script, unsigned int score, int styleStrategy,
const QtFontFamily *family, const QString &foundry_name,
QtFontStyle::Key styleKey, int pixelSize, char pitch,
- QtFontDesc *desc, int force_encoding_id, const QString &styleName = QString())
+ QtFontDesc *desc, const QString &styleName = QString())
{
- Q_UNUSED(force_encoding_id);
Q_UNUSED(script);
Q_UNUSED(pitch);
desc->foundry = 0;
desc->style = 0;
desc->size = 0;
- desc->encoding = 0;
FM_DEBUG(" REMARK: looking for best foundry for family '%s' [%d]", family->name.toLatin1().constData(), family->count);
@@ -1084,8 +1066,7 @@ unsigned int bestFoundry(int script, unsigned int score, int styleStrategy,
enum {
PitchMismatch = 0x4000,
StyleMismatch = 0x2000,
- BitmapScaledPenalty = 0x1000,
- EncodingMismatch = 0x0002
+ BitmapScaledPenalty = 0x1000
};
if (pitch != '*') {
if ((pitch == 'm' && !family->fixedPitch)
@@ -1128,10 +1109,9 @@ static bool matchFamilyName(const QString &familyName, QtFontFamily *f)
Tries to find the best match for a given request and family/foundry
*/
static int match(int script, const QFontDef &request,
- const QString &family_name, const QString &foundry_name, int force_encoding_id,
+ const QString &family_name, const QString &foundry_name,
QtFontDesc *desc, const QList<int> &blacklistedFamilies)
{
- Q_UNUSED(force_encoding_id);
int result = -1;
QtFontStyle::Key styleKey;
@@ -1156,8 +1136,6 @@ static int match(int script, const QFontDef &request,
desc->foundry = 0;
desc->style = 0;
desc->size = 0;
- desc->encoding = 0;
- desc->familyIndex = -1;
unsigned int score = ~0u;
@@ -1174,16 +1152,12 @@ static int match(int script, const QFontDef &request,
continue;
QtFontDesc test;
test.family = db->families[x];
- test.familyIndex = x;
if (!matchFamilyName(family_name, test.family))
continue;
test.family->ensurePopulated();
- if (family_name.isEmpty())
- load(test.family->name, script);
-
// Check if family is supported in the script we want
if (writingSystem != QFontDatabase::Any && !(test.family->writingSystems[writingSystem] & QtFontFamily::Supported))
continue;
@@ -1193,13 +1167,13 @@ static int match(int script, const QFontDef &request,
unsigned int newscore =
bestFoundry(script, score, request.styleStrategy,
test.family, foundry_name, styleKey, request.pixelSize, pitch,
- &test, force_encoding_id, request.styleName);
+ &test, request.styleName);
if (test.foundry == 0 && !foundry_name.isEmpty()) {
// the specific foundry was not found, so look for
// any foundry matching our requirements
newscore = bestFoundry(script, score, request.styleStrategy, test.family,
QString(), styleKey, request.pixelSize,
- pitch, &test, force_encoding_id, request.styleName);
+ pitch, &test, request.styleName);
}
if (newscore < score) {
@@ -2537,8 +2511,6 @@ QFontDatabase::findFont(int script, const QFontPrivate *fp,
{
QMutexLocker locker(fontDatabaseMutex());
- const int force_encoding_id = -1;
-
if (!privateDb()->count)
initializeDb();
@@ -2561,7 +2533,7 @@ QFontDatabase::findFont(int script, const QFontPrivate *fp,
QtFontDesc desc;
QList<int> blackListed;
- int index = match(script, request, family_name, foundry_name, force_encoding_id, &desc, blackListed);
+ int index = match(script, request, family_name, foundry_name, &desc, blackListed);
if (index >= 0) {
engine = loadEngine(script, request, desc.family, desc.foundry, desc.style, desc.size);
if (!engine)
@@ -2604,7 +2576,7 @@ QFontDatabase::findFont(int script, const QFontPrivate *fp,
if (!engine) {
QtFontDesc desc;
do {
- index = match(script, def, def.family, QLatin1String(""), 0, &desc, blackListed);
+ index = match(script, def, def.family, QLatin1String(""), &desc, blackListed);
if (index >= 0) {
QFontDef loadDef = def;
if (loadDef.family.isEmpty())
diff --git a/src/gui/text/qplatformfontdatabase.cpp b/src/gui/text/qplatformfontdatabase.cpp
index 5fa43948aa..502348a79a 100644
--- a/src/gui/text/qplatformfontdatabase.cpp
+++ b/src/gui/text/qplatformfontdatabase.cpp
@@ -611,7 +611,7 @@ QSupportedWritingSystems QPlatformFontDatabase::writingSystemsFromTrueTypeBits(q
hasScript = true;
//qDebug("font %s supports Korean", familyName.latin1());
}
- if (codePageRange[0] & (1 << SymbolCsbBit)) {
+ if (codePageRange[0] & (1U << SymbolCsbBit)) {
writingSystems = QSupportedWritingSystems();
hasScript = false;
}