Quick Start
Installation
Install via NPM:
npm install fontkitLoad 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
GlyphRunLast updated
Was this helpful?