Skip to main content
Module

x/canvas/mod.ts>LineMetrics

Canvas API for Deno, ported from canvaskit-wasm (Skia).
Latest
interface LineMetrics
import { type LineMetrics } from "https://deno.land/x/canvas@v1.4.1/mod.ts";

See Metrics.h for more on this struct.

Properties

startIndex: number

The index in the text buffer the line begins.

endIndex: number

The index in the text buffer the line ends.

endExcludingWhitespaces: number
endIncludingNewline: number
isHardBreak: boolean

True if the line ends in a hard break (e.g. newline)

ascent: number

The final computed ascent for the line. This can be impacted by the strut, height, scaling, as well as outlying runs that are very tall.

descent: number

The final computed descent for the line. This can be impacted by the strut, height, scaling, as well as outlying runs that are very tall.

height: number

round(ascent + descent)

width: number

width of the line

left: number

The left edge of the line. The right edge can be obtained with left + width

baseline: number

The y position of the baseline for this line from the top of the paragraph.

lineNumber: number

Zero indexed line number.