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

x/canvas/src/canvas.ts>TextBlobFactory

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

See SkTextBlob.h for more details.

Methods

MakeFromGlyphs(glyphs: InputGlyphIDArray, font: Font): TextBlob

Return a TextBlob with a single run of text.

It does not perform typeface fallback for characters not found in the Typeface. It does not perform kerning or other complex shaping; glyphs are positioned based on their default advances.

MakeFromRSXform(
str: string,
font: Font,
): TextBlob

Returns a TextBlob built from a single run of text with rotation, scale, and translations.

It uses the default character-to-glyph mapping from the typeface in the font.

MakeFromRSXformGlyphs(): TextBlob

Returns a TextBlob built from a single run of text with rotation, scale, and translations.

MakeFromText(str: string, font: Font): TextBlob

Return a TextBlob with a single run of text.

It uses the default character-to-glyph mapping from the typeface in the font. It does not perform typeface fallback for characters not found in the Typeface. It does not perform kerning or other complex shaping; glyphs are positioned based on their default advances.

MakeOnPath(
str: string,
path: Path,
font: Font,
initialOffset?: number,
): TextBlob

Returns a TextBlob that has the glyphs following the contours of the given path.

It is a convenience wrapper around MakeFromRSXform and ContourMeasureIter.