Function: measurementFace()
ts
function measurementFace(face): MeasurementFace;Experimental
The face to measure a font request with, i.e. the font troika will draw it with (plan E2.18):
- A registered family (resolveFontFace): its name and the registered face's weight and style (troika draws that file as is, without synthesizing bold or italic).
- Else, with an app default font URL: DEFAULT_FONT_CSS_FAMILY at 400/normal.
- Else the built-in default font: BUILTIN_FONT_CSS_FAMILY at the weight and style of the face that draws the request (defaultFontFace). Asking starts loading that face (text is being measured, so it is about to be drawn); its CSS face is registered once loaded.
The requested family list follows the drawn family as a CSS fallback, so measurements taken before a face has loaded use the requested font rather than the browser default (the cache is cleared when the face loads). Results are memoized until the next font change.
Parameters
| Parameter | Type |
|---|---|
face | Omit<TextFont, "size"> |