npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

unglyph

v0.1.3

Published

Parse, render, create, and subset TTF/OTF/WOFF/WOFF2 fonts with one typed glyph-first API

Readme

unglyph

npm version npm downloads npm license

The font engineering layer of By Sages Typography — parse real font binaries into normalized glyph data, render them, subset with HarfBuzz, and build TrueType or CFF-based OpenType fonts from a typed path model.

Features

  • 🔍 Broad font input — read TTF, OTF, WOFF, WOFF2, and TrueType Collections through fontkit; preserve cmap alternatives, .notdef, advances, variation axes, width/weight, and color-format capabilities.
  • 🏗 Creation without CFF-only limits — export TrueType glyf outlines, CFF-based OTF, and WOFF/WOFF2 containers; write standard name metadata, PostScript-safe names, metrics, and cmap subtables.
  • 🧩 One glyph model — the same normalized path commands feed rendering, editing, parsing, and generation, so an icon pipeline does not need one representation for SVG and another for fonts.
  • 🎨 Rendering built in — generate SVG, draw to a Canvas 2D context, or rasterize through the optional Node @napi-rs/canvas dependency; compose text with a simple horizontal advance layout when full shaping is unnecessary.
  • ✂️ Production-safe subsetting — unglyph/subset uses HarfBuzz WASM and preserves GSUB/GPOS closure; instance variable-font axes and emit WOFF or WOFF2 in Node and browsers.
  • 🌍 Runtime-neutral core — parsing, creation, SVG rendering, and subsetting are designed for Node and modern browsers; platform compression APIs handle WOFF/WOFF2 without bundled polyfills.

Installation

# pnpm
pnpm add unglyph

# npm
npm install unglyph

# yarn
yarn add unglyph

# bun
bun add unglyph

Quick Start

Inspect a font and render a glyph:

import { parseFont, renderGlyphToSVG } from "unglyph";

const font = await parseFont(fontBytes);
console.log(font.familyName, font.glyphs.length, font.variationAxes);

const glyph = font.glyphs.find((item) => item.unicode === 65);
const svg = renderGlyphToSVG(glyph, {
  size: 64,
  color: "#111111",
  backgroundColor: "transparent",
});

Only need the name table? Skip glyph decoding entirely:

import { parseFontMetadata } from "unglyph";

const metadata = await parseFontMetadata(fontBytes);
console.log(metadata.designer, metadata.license, metadata.version);

Create glyph data once and export it as a real font:

import { createFont, generateFont } from "unglyph";

const font = createFont(glyphs, {
  familyName: "Example Icons",
  styleName: "Regular",
  ascender: 800,
  descender: -200,
  metadata: {
    manufacturer: "BY SAGES",
    description: "Generated icon font",
    version: "1.0.0",
  },
});

const ttf = await generateFont(font, { format: "ttf" });
const otf = await generateFont(font, { format: "otf" });
const woff2 = await generateFont(font, { format: "woff2" });

For an existing font, subset the glyphs actually used while keeping shaping intact:

import { subsetFont } from "unglyph/subset";

const latin = await subsetFont(fontBytes, "Hello world", {
  targetFormat: "woff2",
});

const regular = await subsetFont(variableFontBytes, "Hello world", {
  variationAxes: { wght: 400 },
});

createFont rebuilds from extracted paths, so it intentionally drops hinting and original layout features. Use subsetFont when the output must remain a faithful, shippable font; use creation APIs for generated fonts such as icon and picture fonts. Scalar identity — names, metrics, OS/2 heights and width class, and full name-table metadata — is preserved across a parseFont → createFont → generateFont round trip; variable axes, color tables, and layout features are not rebuilt. Pass the parsed font straight back to rebuild it: createFont(parsedFont) keeps every scalar without re-typing fields.

The normalized path model uses SVG direction: y increases downward and the baseline is 0. Node-only image rendering requires installing @napi-rs/canvas.

License