System
class System(val typeface: Typeface) : Face() /** The bundled Lato family - the "no custom font configured" state. */ object Lato : Face() } private val _faces: MutableMap<FontRole, Face> = mutableMapOf( FontRole.HEADING to Face.Lato, FontRole.BODY to Face.Lato ) /** * The [FontResolution] each role was last given, so a repeat [apply] / [applyRole] with the * same resolution - the resolver's memo answering a role that was never actually cleared, for * instance - can skip [_faceFor] entirely rather than re-opening the font file only to find * [_sameFace] discards the result (#20290 review). */ private val _lastResolution: MutableMap<FontRole, FontResolution> = mutableMapOf() /** role x style -> Typeface. Every `createFromFile` / `create` allocates, so memoise. */ private val _typefaces: MutableMap<String, Typeface> = mutableMapOf() private val _listeners: MutableList<() -> Unit> = mutableListOf() /** * The specs the owner last asked for, per role. Kept here so the runtime-playout delta * ([FontPlayoutDelta]) has a "current" to compare an incoming payload against - an absent key * means "leave this role alone", which is only expressible against a remembered state. */ var currentSpecs: Map<FontRole, FontSpec> = mapOf( FontRole.HEADING to FontSpec.None, FontRole.BODY to FontSpec.None ) /** * Roles whose last applied [FontResolution] was [FontResolution.Unavailable] - a transient * failure (network hiccup, or the shared module's resolution timeout) rather than a final * answer. The download for these keeps running in the background and lands in the cache, but * nobody asks again unless prompted (#20290: `BBNativePlayerView` retries once on a timer, and * re-resolves a re-sent playout even when its specs did not change). [FontResolution.Unusable] * is a permanent, contractual answer and must never show up here. */ val unavailableRoles: Set<FontRole> get() = _lastResolution.filterValues
A font that was already on the device, found by family name.