FontRegistry

open class FontRegistry(val parent: FontRegistry? = null)(source)

Resolves font families to font files, by family, weight and style as in CSS. Families are matched without regard to case. A registry with a parent resolves the families it does not know in its parent.

Inheritors

Constructors

Link copied to clipboard
constructor(parent: FontRegistry? = null)

Properties

Link copied to clipboard

The font file used for families that are not registered, the fallback of the parent when null

Link copied to clipboard

Functions

Link copied to clipboard
fun candidates(families: List<String>, weight: Int = 400, italic: Boolean = false, faces: List<FontFace> = emptyList()): List<String>

The font files for families, in order of preference: for every family, the sources of the matching one of faces or the registered file, then fallback. Faces are matched like registrations are. A font that can not be loaded is followed by the fonts of the next families, as in CSS.

Link copied to clipboard

true when family is registered here or in the parent

Link copied to clipboard
fun register(family: String, fileOrUrl: String, weight: Int = 400, italic: Boolean = false)

Registers the font file for a font family, weight and style. A later registration of the same family, weight and style replaces it.

Link copied to clipboard
fun resolve(families: List<String>, weight: Int = 400, italic: Boolean = false): String?

The font file for the first registered family in families, with the requested style and the nearest weight, or fallback