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 6.6 Change-Id: I73a65cab38adfd9ef56e436f311a7d1a2d7fbf41 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>bb10
parent
1248979968
commit
db6f7908d0
|
|
@ -217,7 +217,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…
Reference in New Issue