GlyphMaps

The glyph maps of boundary drawers, one for every boundary drawer: everything that draws text with the same boundary drawer, like compositions and user interfaces, finds the outlines of glyphs in the same map, and uploads every glyph once.

Glyphs whose outlines keep changing, those of variable faces whose axes are animated, would make that map grow without end, since every master has outlines of its own. Their glyphs go into a transient map instead, one per boundary drawer as well, which is cleared as a whole once it uses more than transientBudget bytes. A face goes there when it is marked with setTransient, also a face that is not variable, or by itself when its font is seen with more than churnMasters masters within churnSeconds. Who keeps indices of the transient map, like SlugTextDrawer, finds them again when its BoundaryGlyphMap.generation changed.

Properties

Link copied to clipboard

the number of masters of a font within churnSeconds above which its glyphs become transient

Link copied to clipboard

the time over which the masters of a font are counted, see churnMasters

Link copied to clipboard

the most bytes the transient map of a boundary drawer uses before it is cleared, 8 MiB by default

Functions

Link copied to clipboard
fun isTransient(face: Face): Boolean

true when the glyphs of face go into the transient map

Link copied to clipboard
fun of(boundaryDrawer: BoundaryDrawer): BoundaryGlyphMap

the glyph map of boundaryDrawer

Link copied to clipboard
fun setTransient(face: Face, transient: Boolean = true)

Marks the font of face, with all its masters, as one whose glyphs are transient, like a variable face whose axes are animated, or as not transient when transient is false, which also keeps the heuristic from making it transient

Link copied to clipboard
fun transientOf(boundaryDrawer: BoundaryDrawer): BoundaryGlyphMap

the transient glyph map of boundaryDrawer, for glyphs of faces that isTransient

Link copied to clipboard
fun trimTransient(boundaryDrawer: BoundaryDrawer): Boolean

Clears the transient map of boundaryDrawer when it uses more than transientBudget, before glyphs are added to it; gives true when it was cleared, which bumps its BoundaryGlyphMap.generation

Link copied to clipboard
fun use(face: Face): Boolean

Notes that glyphs of face are about to be used, for the heuristic that makes fonts whose masters change often transient; gives true when the glyphs of face go into the transient map