For the complete documentation index, see llms.txt. This page is also available as Markdown.

Quick Start

This documentation for fontkit is created and provided by the Typogram team. It’s a third-party documentation intended to delve deeper into the fontkit API. For the most accurate information, refer to fontkit’s official documentation.

Installation

Install via NPM:

npm install fontkit

Load a font

import * as fontkit from 'fontkit';

async function loadFont(url) {
  const response = await fetch(url);
  const arrayBuffer = await response.arrayBuffer();
  const buf = new Uint8Array(arrayBuffer);
  const font = fontkit.create(buf);
  console.log(font)
}
var fontkit = require('fontkit');

// open a font synchronously
var font = fontkit.openSync('font.ttf');

Layout a line of text

const run = font.layout('Hello World!');

Get pathData of a GlyphRun

Last updated

Was this helpful?