Skip to main content
Module

x/targadactyl/deps.ts>ParagraphBuilder

tga.js implemented in Deno
Latest
interface ParagraphBuilder
import { type ParagraphBuilder } from "https://deno.land/x/targadactyl@1.2.0/deps.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 Canvas.

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: Paint,
bg: Paint,
): void

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