Font

Describes a font with render options such as letter spacing, line height, and capitalization.

To load a font and render text, pass a Font to getFontFromURL which returns a FontRenderer.

const font = Font(
  "https://fonts.gstatic.com/s/pacifico/v22/FwZY7-Qmy14u9lezJ96A4sijpFu_.ttf",
  { connect: "dots and letters", lineHeight: 0.8 },
);
const fontRenderer = getFontFromURL(font);
const result = fontRenderer.renderLine("boop");
return result.geometry;

Constructors

Font(font,renderOptions)Font
font
(string | Font)
renderOptions
Partial
{}

Properties

.urlstring

The URL of the font file to load (e.g. a .ttf from Google Fonts).

.renderOptionsPartial

Options that control how text is rendered, such as letter spacing, line height, and capitalization.