Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including fontjs with all npm packages installed. Try it out:

var fontjs = require("fontjs")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

fontjs v1.0.2

FontJS (Font.js) is a packages for TrueType font parsing and manipulation

Font.js (FontJS)

Font.js (FontJS) is library helping parse/encode and manipulate TrueType font files. In a future there is a plan to extend support to OpenType fonts as well.

Supported TrueType Tables

  • cmap
  • cvt
  • fpgm
  • glyf
  • hdmx
  • head
  • hhea
  • hmtx
  • loca
  • maxp
  • name
  • OS/2
  • post
  • prep


import * as fontjs from "fontjs";
import { SeqStream, ByteStream } from "bytestream";

async function fontTest()
    const fontFetchResult = await fetch("./fonts/times.ttf");
    const fontFetchBuffer = await fontFetchResult.arrayBuffer();
    const font = fontjs.Font.fromStream(new SeqStream({ stream: new ByteStream({ buffer: fontFetchBuffer }) }));
    const fontStream = new SeqStream();
    const toStreamResult = font.toStream(fontStream);


RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free