Module skrifa::metrics

source ·
Expand description

Global font and glyph specific metrics.

Metrics are various measurements that define positioning and layout characteristics for a font. They come in two flavors:

  • Global metrics: these are applicable to all glyphs in a font and generally define values that are used for the layout of a collection of glyphs. For example, the ascent, descent and leading values determine the position of the baseline where a glyph should be rendered as well as the suggested spacing above and below it.

  • Glyph metrics: these apply to single glyphs. For example, the advance width value describes the distance between two consecutive glyphs on a line.

§Selecting an “instance”

Both global and glyph specific metrics accept two additional pieces of information to select the desired instance of a font:

  • Size: represented by the Size type, this determines the scaling factor that is applied to all metrics.
  • Normalized variation coordinates: represented by the LocationRef type, these define the position in design space for a variable font. For a non-variable font, these coordinates are ignored and you can pass LocationRef::default() as an argument for this parameter.

Structs§

Type Aliases§

  • Type for a bounding box with single precision floating point coordinates.