Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/canvas/src/canvaskit.ts>Paragraph

Canvas API for Deno, ported from canvaskit-wasm (Skia).
Go to Latest
interface Paragraph
implements EmbindObject<Paragraph>
import { type Paragraph } from "https://deno.land/x/canvas@v1.3.0/src/canvaskit.ts";

See Paragraph.h for more information on this class. This is only available if Paragraph has been compiled in.

Methods

didExceedMaxLines(): boolean
getAlphabeticBaseline(): number
getGlyphPositionAtCoordinate(dx: number, dy: number): PositionWithAffinity

Returns the index of the glyph that corresponds to the provided coordinate, with the top left corner as the origin, and +y direction as down.

getHeight(): number
getIdeographicBaseline(): number
getLineMetrics(): LineMetrics[]
getLongestLine(): number
getMaxIntrinsicWidth(): number
getMaxWidth(): number
getMinIntrinsicWidth(): number
getRectsForPlaceholders(): FlattenedRectangleArray
getRectsForRange(
start: number,
end: number,
): FlattenedRectangleArray

Returns bounding boxes that enclose all text in the range of glpyh indexes [start, end).

getWordBoundary(offset: number): URange

Finds the first and last glyphs that define a word containing the glyph at index offset.

getShapedLines(): ShapedLine[]

Returns an array of ShapedLine objects, describing the paragraph.

layout(width: number): void

Lays out the text in the paragraph so it is wrapped to the given width.