QFontEngine: Fix cache_cost might be not initialized
Change-Id: I4cf4de5797e6623a71593e8f382496188e3abac8 Reviewed-by: jian liang <jianliang79@gmail.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
This commit is contained in:
parent
112b31bed6
commit
1f3a67e870
@ -199,6 +199,7 @@ QFontEngine::QFontEngine()
|
||||
font_(0), font_destroy_func(0),
|
||||
face_(0), face_destroy_func(0)
|
||||
{
|
||||
cache_cost = 0;
|
||||
fsType = 0;
|
||||
symbol = false;
|
||||
|
||||
|
@ -688,6 +688,7 @@ void QFontEngineMultiQPA::init(QFontEngine *fe)
|
||||
fe->ref.ref();
|
||||
fontDef = engines[0]->fontDef;
|
||||
setObjectName(QStringLiteral("QFontEngineMultiQPA"));
|
||||
cache_cost = fe->cache_cost;
|
||||
}
|
||||
|
||||
void QFontEngineMultiQPA::loadEngine(int at)
|
||||
|
@ -189,6 +189,8 @@ void QCoreTextFontEngine::init()
|
||||
avgCharWidth = QFixed::fromReal(width * fontDef.pixelSize / emSize);
|
||||
} else
|
||||
avgCharWidth = QFontEngine::averageCharWidth();
|
||||
|
||||
cache_cost = (CTFontGetAscent(ctfont) + CTFontGetDescent(ctfont)) * avgCharWidth.toInt() * 2000;
|
||||
}
|
||||
|
||||
bool QCoreTextFontEngine::stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs,
|
||||
|
@ -220,6 +220,7 @@ QWindowsFontEngineDirectWrite::QWindowsFontEngineDirectWrite(IDWriteFontFace *di
|
||||
|
||||
fontDef.pixelSize = pixelSize;
|
||||
collectMetrics();
|
||||
cache_cost = (m_ascent.toInt() + m_descent.toInt()) * m_xHeight.toInt() * 2000;
|
||||
}
|
||||
|
||||
QWindowsFontEngineDirectWrite::~QWindowsFontEngineDirectWrite()
|
||||
|
Loading…
Reference in New Issue
Block a user