Create a builder for laying out styled text.
Text is shaped with the process-global font library. CanvasKit takes a
FontMgr here; this build has no per-builder equivalent, so the parameter
is omitted rather than accepted and ignored.
const para = new ParagraphBuilder({ textStyle: { fontSize: 16 } })
.addText("hello")
.build()
Optionalstyle: ParagraphStyleInputReserve a rectangle in the text flow for something drawn separately.
align and baseline were accepted and discarded until 4.2.0, so every
placeholder laid out on the baseline whatever was passed. A value outside
either set now throws rather than silently reverting to the default.
Optionalalign: PlaceholderAlignmentValue
Optionalbaseline: TextBaselineValue
see TextBaseline; consulted by the three
baseline-relative alignments -- Baseline, AboveBaseline and
BelowBaseline -- and ignored by Top, Bottom and Middle
Optionaloffset: number
distance from the placeholder's top edge to its baseline
Append text in the current style.
Finishes the paragraph. Call Paragraph.layout on the result before measuring or drawing it.
StaticMakeText is shaped with the process-global font library. CanvasKit takes a
FontMgr here; this build has no per-builder equivalent, so the parameter
is omitted rather than accepted and ignored.
Optionalstyle: ParagraphStyleInputEnd the innermost pushStyle, returning to the style beneath it. Popping with nothing pushed is harmless.
Begin a run in style, stacked on top of whatever is already pushed.
Text added from here on uses it until the matching pop.
Font variations are the exception: the paragraph's font collection is
fixed when the builder is created, so an axis position pushed here has
no effect. Set those on the constructor's textStyle.
🧪 Not in the HTML Canvas standard.