CachedFontMetrics

template<typename T>
class CachedFontMetrics

A cache class for font measurements.

Stores calculated widths in an array so when asking for a character’s width second time, it is returned instantly without any calculation

Template Parameters:

T – The type used for dimensions, such as int or qreal

Public Functions

inline explicit CachedFontMetrics(const QFont &font)
inline T width(const QChar &ch)
inline T width(const QString &text)
inline T height()
inline T position(const QString &text, T offset)
inline T ascent()