Skip to main content
Deno 2 is finally here 🎉️
Learn more
Latest
interface ParagraphBuilder
import { type ParagraphBuilder } from "https://deno.land/x/canvaseno@v1.0.2/types.ts";

Methods

addPlaceholder(
width?: number,
height?: number,
baseline?: TextBaseline,
offset?: number,
): void

Pushes the information required to leave an open space.

addText(str: string): void

Adds text to the builder. Forms the proper runs to use the upper-most style on the style_stack.

build(): Paragraph

Returns a Paragraph object that can be used to be layout and paint the text to an SkCanvas.

pop(): void

Remove a style from the stack. Useful to apply different styles to chunks of text such as bolding.

pushStyle(text: TextStyle): void

Push a style to the stack. The corresponding text added with addText will use the top-most style.

pushPaintStyle(
textStyle: TextStyle,
fg: SkPaint,
bg: SkPaint,
): void

Pushes a TextStyle using paints instead of colors for foreground and background.