FontRegistry
Defined in: src/core/font/font-registry.ts:54
A registry of parsed font variants. The renderer resolves a (bold, italic)
request to the closest available face via pickVariant, degrading
through bold → italic → regular when an exact match is missing.
Methods
Section titled “Methods”entries()
Section titled “entries()”entries():
IterableIterator<[FontVariant,ParsedTtf]>
Defined in: src/core/font/font-registry.ts:88
Iterate the [variant, parsed font] pairs the registry holds.
Returns
Section titled “Returns”IterableIterator<[FontVariant, ParsedTtf]>
hasVariant()
Section titled “hasVariant()”hasVariant(
v):boolean
Defined in: src/core/font/font-registry.ts:93
Whether a given variant is present.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”boolean
resolveByStyle()
Section titled “resolveByStyle()”resolveByStyle(
bold,italic):object
Defined in: src/core/font/font-registry.ts:80
Resolve a style request to the closest available face.
Parameters
Section titled “Parameters”boolean
Whether bold was requested.
italic
Section titled “italic”boolean
Whether italic was requested.
Returns
Section titled “Returns”object
The chosen variant and its parsed font.
parsed
Section titled “parsed”parsed:
ParsedTtf
variant
Section titled “variant”variant:
FontVariant
Throws
Section titled “Throws”Error when the registry has no usable (regular) font.
fromBytes()
Section titled “fromBytes()”
staticfromBytes(input):FontRegistry
Defined in: src/core/font/font-registry.ts:63
Parse a set of font bytes into a registry.
Parameters
Section titled “Parameters”The bytes per variant (regular required).
Returns
Section titled “Returns”FontRegistry
A registry holding the parsed faces.