Size Metrics

class freetype.SizeMetrics(metrics)

The size metrics structure gives the metrics of a size object.

Note

The scaling values, if relevant, are determined first during a size changing operation. The remaining fields are then set by the driver. For scalable formats, they are usually set to scaled values of the corresponding fields in Face.

Note that due to glyph hinting, these values might not be exact for certain fonts. Thus they must be treated as unreliable with an error margin of at least one pixel!

Indeed, the only way to get the exact metrics is to render all glyphs. As this would be a definite performance hit, it is up to client applications to perform such computations.

The SizeMetrics structure is valid for bitmap fonts also.

ascender

The ascender in 26.6 fractional pixels. See Face for the details.

descender

The descender in 26.6 fractional pixels. See Face for the details.

height

The height in 26.6 fractional pixels. See Face for the details.

max_advance

The maximal advance width in 26.6 fractional pixels. See Face for the details.

x_ppem

The width of the scaled EM square in pixels, hence the term ‘ppem’ (pixels per EM). It is also referred to as ‘nominal width’.

x_scale

A 16.16 fractional scaling value used to convert horizontal metrics from font units to 26.6 fractional pixels. Only relevant for scalable font formats.

y_ppem

The height of the scaled EM square in pixels, hence the term ‘ppem’ (pixels per EM). It is also referred to as ‘nominal height’.

y_scale

A 16.16 fractional scaling value used to convert vertical metrics from font units to 26.6 fractional pixels. Only relevant for scalable font formats.