Abstract Class: MeasureScope
Defined in: render/measure-scope.ts:15
Provides text-measurement primitives to any context that needs to know how wide a run of text will be before actually drawing it (e.g. for layout calculations, line-breaking, or positioning).
RenderContext implements this interface so nodes can measure text through
the same object they use to draw — no separate measurement pass needed.
Constructors
Constructor
new MeasureScope():
MeasureScope
Returns
MeasureScope
Methods
measureText()
abstractmeasureText(text,fontSize,fontFamily,fontWeight?,letterSpacing?,fontStyle?):number
Defined in: render/measure-scope.ts:28
Returns the advance width (in pixels) of text rendered at the given
fontSize with the specified font properties.
Parameters
text
string
The string to measure.
fontSize
number
Size in pixels.
fontFamily
string
CSS-style family name (e.g. "Inter").
fontWeight?
number
Numeric weight (100–900). Defaults to 400 when omitted.
letterSpacing?
number
Extra inter-glyph spacing in pixels. Defaults to 0.
fontStyle?
Italic / oblique variant. Defaults to normal.
Returns
number
Advance width in pixels.