Module

x/canvas/types.ts

Canvas API for Deno, ported from canvaskit-wasm (Skia).
Go to Latest
interface ParagraphBuilder
import { type ParagraphBuilder } from "https://deno.land/x/canvas@v1.0.0/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.