Skip to main content

Module fonts

Module fonts 

Source
Expand description

The font a piece of text with no role is set in.

Text with a role takes its font from the theme, and nothing on this side can change that for one node. Text with no role, which is what a page laid out by CSS draws, names its own: a list of candidates tried in order, the way a CSS font-family list is. The text is set in the first one the Renderer can resolve, and a letter it has no glyph for comes from the next candidate that has one.

The list travels as fixed-length records followed by the bytes of the family names they point at. The same records sit in a Text’s Font property, in a run of a Text’s spans, and in a measure request, so the Renderer resolves all three with one function and the text it measures is set in exactly the font it draws.

Structs§

FontRefs
A list of candidates, ready to travel.
FontStack
Fonts the application shipped, tried a glyph at a time in the order given.

Enums§

FontRef
One candidate.

Constants§

FONT_REF_ASSET
A registered font asset. value is its id.
FONT_REF_GENERIC
A generic family. value is its GenericFamily tag.
FONT_REF_KIND_AT
Where each word of a candidate starts.
FONT_REF_LEN
Bytes of one candidate: what kind it is, then two words whose meaning the kind gives.
FONT_REF_LENGTH_AT
FONT_REF_SYSTEM
An installed family, by name. value and length are where the UTF-8 name sits, counted from the start of the buffer the record is in.
FONT_REF_VALUE_AT
FONT_STACK_MAGIC
What the bytes of a font stack start with.
FONT_STACK_VERSION
The layout of a stack after the magic. Version 1 is a family count, then for each family a face count and that many face ids, every number a little endian u32.
MAX_FONT_REFS
The most candidates one list may hold. A CSS list longer than this is a page that names fonts it does not expect to find, and the ninth would never be reached.
MAX_FONT_STACK_FACES
The most faces one family of a stack may hold: one for each of the nine standard weights, upright and italic.
MAX_FONT_STACK_FAMILIES
The most families one stack may hold, for the same reason a font list stops at eight.