[][src]Module sixtyfps_corelib::font

Font abstraction for the run-time library.

The module receives FontRequest objects and returns Rc, which represents a font provided by the underlying platform that matches the specified font request as closely as possible.

Internally a FontRequest is resolved to a Rc and a list of Rc instances, one for each pixel size. The Rc is basically an Rc and the pixel size specific, cached glyph metrics -- base on the assumption that the platform provides scalable fonts.

On the graphics side, the generated rasterized glyphs may be cached in textures. That cache is indexed by the Rc since the underlying platform may map different font requests to the same physical PlatformFont (typically backed by a .ttf file or ttf inside a .ttc)

Structs

Font
FontCache

FontCache caches the expensive process of looking up fonts by family, weight, style, etc. (FontRequest)

FontRequest

FontRequest collects all the developer-configurable properties for fonts, such as family, weight, etc. It is submitted as a request to the platform font system (i.e. CoreText on macOS) and in exchange we store a Rc

GlyphMetrics

GlyphMetrics contains the different kinds of measures for glyphs. This is typically obtained using the Font APIs.

PlatformFont

Constants

FONT_CACHE

The thread-local font-cache holding references to resolved font requests

Traits

HasFont

HasFont is a convenience trait for items holding font properties, such as Text or TextInput.

Functions

register_application_font_from_memory

This function can be used to register a custom TrueType font with SixtyFPS, for use with the font-family property. The provided slice must be a valid TrueType font.