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

@grida/fonts

v0.0.0

Published

A unified font management system that mimics Skia's font collection/font manager approach. Designed for high-performance graphics applications that need to load and manage fonts across different rendering backends.

Downloads

182

Readme

Grida Fonts

A unified font management system that mimics Skia's font collection/font manager approach. Designed for high-performance graphics applications that need to load and manage fonts across different rendering backends.

What it does

  • Google Fonts Support: Loads fonts directly from Google Fonts with full metadata support
  • Skia-like Font Management: Mimics Skia's font collection/font manager pattern for consistent font handling
  • Family-based Loading: Load fonts by family name, automatically creating the required FontFace/Typeface sets per family
  • CSS2 API Compatibility: Generates font configurations that match Google Fonts CSS2 API output
  • In-Memory Management: Manages fonts in memory for passing to WASM modules

When to use it

  • Canvas/Skia Applications: When you need font management similar to Skia's approach
  • WASM Graphics: When passing fonts to WASM modules for rendering
  • Google Fonts Integration: When you need programmatic access to Google Fonts
  • Cross-Platform Font Handling: When you need consistent font management across DOM and WASM backends

Quick Start

Basic Usage

import { FontFaceManager } from "@grida/fonts/fontface-dom";

// Load a Google Font family
const manager = new FontFaceManager();
await manager.loadGoogleFont({
  family: "Roboto",
  variants: ["regular", "italic", "700"],
  files: {
    regular: "https://fonts.gstatic.com/s/roboto/v30/KFOmCnqEu92Fr1Mu4mxK.ttf",
    italic:
      "https://fonts.gstatic.com/s/roboto/v30/KFOkCnqEu92Fr1Mu51xIIzI.ttf",
    "700":
      "https://fonts.gstatic.com/s/roboto/v30/KFOlCnqEu92Fr1MmWUlfBBc9.ttf",
  },
  // ... other metadata
});

WASM Integration

import { UnifiedFontManager } from "@grida/fonts/fontface";

// Create custom adapter for your WASM graphics system
class WasmFontAdapter {
  async register(bytes: ArrayBuffer, variant) {
    // Register with your WASM font system
    const fontId = await yourWasmSystem.loadFont(bytes, variant);
    return { id: fontId };
  }

  unregister(handle, variant) {
    yourWasmSystem.unloadFont(handle.id);
  }
}

const manager = new UnifiedFontManager(new WasmFontAdapter());
await manager.loadGoogleFont(googleFontData);

Google Fonts Integration

import { FontFaceManager } from "@grida/fonts/fontface-dom";

// Load Google Fonts data
const response = await fetch("https://fonts.grida.co/webfonts.json");
const googleFonts = await response.json();

const manager = new FontFaceManager();

// Find and load a font family
const roboto = googleFonts.items.find((font) => font.family === "Roboto");
if (roboto) {
  await manager.loadGoogleFont(roboto);
}

Parsing Fonts in a Web Worker

import { FontParserWorker } from "@grida/fonts/parser/worker";

const worker = new FontParserWorker();
const response = await fetch("/fonts/Roboto-Regular.ttf");
const buffer = await response.arrayBuffer();

// Parse full font data without blocking the UI
const font = await worker.parse(buffer);
console.log(font);

await worker.terminate();

Key Features

  • Variable Font Support: Full support for variable font axes (weight, width, slant)
  • Reference Counting: Automatic font lifecycle management
  • Memory Efficient: LRU caching with configurable capacity
  • Type Safe: Full TypeScript support
  • Backend Agnostic: Works with DOM, WASM, or custom rendering systems

Architecture

The system provides a unified interface that works across different backends:

  • DOM Backend: Uses browser's FontFace API
  • WASM Backend: Designed for Canvas/Skia rendering
  • Custom Backends: Pluggable adapter system

API Overview

Core Classes

  • FontFaceManager: DOM-specific manager (easiest to use)
  • UnifiedFontManager: Core manager with adapter pattern
  • DomFontAdapter: DOM backend adapter
  • FontAdapter: Interface for custom backends

Main Methods

  • loadGoogleFont(font): Load a Google Font family
  • loadGoogleFonts(fonts): Load multiple font families
  • acquire(source, variant): Load specific font variant
  • release(variant): Release font reference

Browser Support

  • DOM Adapter: Requires FontFace API (Chrome 35+, Firefox 41+, Safari 10+)
  • Core Manager: Works in any JavaScript environment
  • WASM Adapter: Depends on your WASM graphics system

License

MIT