FontFaces

Faces loaded once for every font file, size and variation: the same font at the same size is the same Face, so that caches keyed by faces, like those of shaped text and of glyphs, are shared by everything that draws text.

Functions

Link copied to clipboard
fun face(file: String, size: Double, weight: Int = 400, opticalSize: Double? = size, settings: Map<String, Double> = emptyMap()): Face

The face of file at size. A variable font is set to the axes of settings, given by their tags as in CSS font-variation-settings; its weight axis follows weight and its optical size follows opticalSize when the settings do not give them, as browsers do.

Link copied to clipboard
fun first(candidates: List<String>, size: Double, weight: Int = 400, opticalSize: Double? = size, settings: Map<String, Double> = emptyMap()): Face?

The face of the first of candidates that loads, at size; null when none loads. Fonts that fail to load are not tried again. See face for the variations.