Don't use qt_mac_get_fixed_pitch() to resolve fixed pitch fonts on OSX
The call was resulting in inifinite recursion on OSX 10.9 when Qt was built against the 10.7 SDK, as qt_mac_get_fixed_pitch uses QFontMetrics to resolve the pitch, and we would end up in the font resolver again when asking for the metrics. The CoreText font-database already takes care of resolving whether or not a font family is fixed-pitch, so the code is likely a leftover from the ATSUI-days, and can be removed. Task-number: QTBUG-31803 Change-Id: I37c90fa637927eb4adc16c0fd556c4c46c456034 Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>bb10
parent
ecbd3a70e4
commit
bd9a023a41
|
|
@ -314,9 +314,6 @@ struct QtFontFamily
|
|||
QtFontFamily(const QString &n)
|
||||
:
|
||||
fixedPitch(false),
|
||||
#if !defined(QWS) && defined(Q_OS_MAC)
|
||||
fixedPitchComputed(false),
|
||||
#endif
|
||||
name(n), count(0), foundries(0)
|
||||
, bogusWritingSystems(false)
|
||||
, askedForFallback(false)
|
||||
|
|
@ -330,9 +327,6 @@ struct QtFontFamily
|
|||
}
|
||||
|
||||
bool fixedPitch : 1;
|
||||
#if !defined(QWS) && defined(Q_OS_MAC)
|
||||
bool fixedPitchComputed : 1;
|
||||
#endif
|
||||
|
||||
QString name;
|
||||
QStringList aliases;
|
||||
|
|
@ -348,18 +342,6 @@ struct QtFontFamily
|
|||
QtFontFoundry *foundry(const QString &f, bool = false);
|
||||
};
|
||||
|
||||
#if !defined(QWS) && defined(Q_OS_MAC)
|
||||
inline static void qt_mac_get_fixed_pitch(QtFontFamily *f)
|
||||
{
|
||||
if(f && !f->fixedPitchComputed) {
|
||||
QFontMetrics fm(f->name);
|
||||
f->fixedPitch = fm.width(QLatin1Char('i')) == fm.width(QLatin1Char('m'));
|
||||
f->fixedPitchComputed = true;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
QtFontFoundry *QtFontFamily::foundry(const QString &f, bool create)
|
||||
{
|
||||
if (f.isNull() && count == 1)
|
||||
|
|
@ -823,9 +805,6 @@ unsigned int bestFoundry(int script, unsigned int score, int styleStrategy,
|
|||
EncodingMismatch = 0x0002
|
||||
};
|
||||
if (pitch != '*') {
|
||||
#if !defined(QWS) && defined(Q_OS_MAC)
|
||||
qt_mac_get_fixed_pitch(const_cast<QtFontFamily*>(family));
|
||||
#endif
|
||||
if ((pitch == 'm' && !family->fixedPitch)
|
||||
|| (pitch == 'p' && family->fixedPitch))
|
||||
this_score += PitchMismatch;
|
||||
|
|
@ -1263,9 +1242,6 @@ bool QFontDatabase::isFixedPitch(const QString &family,
|
|||
QT_PREPEND_NAMESPACE(load)(familyName);
|
||||
|
||||
QtFontFamily *f = d->family(familyName);
|
||||
#if !defined(QWS) && defined(Q_OS_MAC)
|
||||
qt_mac_get_fixed_pitch(f);
|
||||
#endif
|
||||
return (f && f->fixedPitch);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue