Fix cache cost on DirectWrite font engines
In Qt 6, we deferred getting the ascent/descent of the font until requested. This was used to calculate the cache cost of the font engine, so as an unintended result, the DirectWrite engines were seen as extremely cheap in the font cache, and we would accumulate thousands of them before triggering a flush. The cache_cost is just a heuristic and does not need to be accurate. For most engines, we should just flush when the number of cached fonts exceed 256, so we use the basic em square of a lowercase letter as the cost here instead. Pick-to: 6.5 Change-Id: I73a65cab38adfd9ef56e436f311a7d1a2d7fbf41 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> (cherry picked from commit db6f7908d01134eb2f20e9b2122d4d47456db6c9) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
203f75c923
commit
49ab1b8756
@ -212,7 +212,7 @@ QWindowsFontEngineDirectWrite::QWindowsFontEngineDirectWrite(IDWriteFontFace *di
|
||||
|
||||
fontDef.pixelSize = pixelSize;
|
||||
collectMetrics();
|
||||
cache_cost = (m_ascent.toInt() + m_descent.toInt()) * m_xHeight.toInt() * 2000;
|
||||
cache_cost = m_xHeight.toInt() * m_xHeight.toInt() * 2000;
|
||||
}
|
||||
|
||||
QWindowsFontEngineDirectWrite::~QWindowsFontEngineDirectWrite()
|
||||
|
Loading…
x
Reference in New Issue
Block a user