Appearance
Class: FontMetricsRegistry ​
Registry of FontMetrics keyed by (face, bold, italic). Variant advances differ, so bold/italic are stored separately; lookup falls back to the regular variant (then any registered variant of the face) so a deck that only registers the regular weight still measures bold runs approximately rather than not at all.
Constructors ​
Constructor ​
new FontMetricsRegistry():
FontMetricsRegistry
Returns ​
FontMetricsRegistry
Accessors ​
size ​
Get Signature ​
get size():
number
Returns ​
number
Methods ​
get() ​
get(
face,bold?,italic?):FontMetrics|undefined
Resolve metrics for a run, falling back from exact variant → regular → any variant.
Parameters ​
| Parameter | Type | Default value |
|---|---|---|
face | string | null | undefined | undefined |
bold | boolean | false |
italic | boolean | false |
Returns ​
FontMetrics | undefined
hasCodepoint() ​
hasCodepoint(
face,cp,opts?):boolean|undefined
Coverage of code point cp for face, read from the registered font's cmap: true/false when a variant of face is registered (see get for the exact→regular→any-variant fallback), or undefined when the face has no registered metrics — "unknown", deliberately distinct from a false "registered but not covered". A coverage audit must not treat an unregistered face as fully covered, so callers get undefined here rather than the per-face FontMetrics.hasCodepoint boolean (which, for the heuristic fallback, always reports covered). Register the face via parseFontMetrics + set first.
Parameters ​
| Parameter | Type |
|---|---|
face | string | null | undefined |
cp | number |
opts? | { bold?: boolean; italic?: boolean; } |
opts.bold? | boolean |
opts.italic? | boolean |
Returns ​
boolean | undefined
hasFace() ​
hasFace(
face):boolean
True if any variant of face has registered metrics.
Parameters ​
| Parameter | Type |
|---|---|
face | string |
Returns ​
boolean
set() ​
set(
face,metrics,opts?):void
Parameters ​
| Parameter | Type |
|---|---|
face | string |
metrics | FontMetrics |
opts? | { bold?: boolean; italic?: boolean; } |
opts.bold? | boolean |
opts.italic? | boolean |
Returns ​
void