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

@nocker/font

v0.2.0

Published

Binary pixel fonts and Canvas rendering for games

Readme

@nocker/font

Binary pixel fonts and dependency-free Canvas rendering, in two sizes: 16×16 and 8×8. No React or DOM initialization on import.

Install:

npm install @nocker/font

Import the size you use. Each path carries its own font, so only that size's data is loaded:

import { renderText, layoutText, measureGlyph } from "@nocker/font/16x16"
// or: from "@nocker/font/8x8"

const canvas = document.querySelector<HTMLCanvasElement>("canvas")!

canvas.width = 960
canvas.height = 240

const context = canvas.getContext("2d")!

renderText(context, "こんにちワールド、はじめもして。", {
  x: 8,
  y: 8,
  scale: 3,
  letterSpacing: 1,
  maxWidth: 304,
  color: "#ffffff",
})

const layout = layoutText("ふぉんと Font", { maxWidth: 1000, letterSpacing: 1 })
// width=112, height=16, lineHeight=20 (logical pixels, 16x16)

const ink = measureGlyph("あ")
// {count, x, y, width, height}; computed from filled cells

To use both sizes, import each under a name: import * as small from "@nocker/font/8x8".

| Path | Cell | Advance (full / ASCII) | Default line gap | Source | | --- | --- | --- | --- | --- | | @nocker/font/16x16 | 16×16 | 16 / 8 | 4 | DotGothic16 (SIL OFL 1.1) | | @nocker/font/8x8 | 8×8 | 8 / 4 | 2 | Misaki Gothic by Num Kadoma |

Each path exports renderText(context, text, options), layoutText(text, options), drawText(canvas, text, options), measureGlyph(character) and font (the glyphs, as pixels[y][x] of 0 and 1).

renderText keeps the caller's canvas size, existing pixels and context state. It draws in the current context transform. Coordinates and maxWidth use logical pixels; scale converts them to canvas pixels. Supply integer x/y/scale/spacing, nonnegative spacing/gap and scale >= 1.

layoutText returns lines, width, height and lineHeight. Width uses pen advances, includes whitespace, and excludes trailing letterSpacing. Lines wrap by glyph, not by English word. Height is cell * lines + lineGap * (lines - 1). Small kana keep a full-width advance; their ink is smaller within the cell.

Text normalizes to NFC. Missing glyphs use ?; kanji are not included.

drawText is a preview helper: it resizes and clears the canvas, paints light text and returns width, height and line count. Use renderText to draw into an existing game.

The root path @nocker/font still exports pixel16, pixel8 and the same functions taking the font as their first argument after the context (renderText(context, pixel16, text, options)); it loads both sizes.

Raw JSON (16×16): @nocker/font/data. Each glyph row is hex, the left pixel in the high bit. License text (16×16): @nocker/font/license.

License

  • 16×16: SIL OFL 1.1. Based on DotGothic16, Copyright 2020 The DotGothic16 Project Authors. Full license and upstream copyright are in data/ofl.txt and embedded in the JSON. Preserve them on redistribution. Do not sell the font on its own.
  • 8×8: based on Misaki Gothic (美咲ゴシック), Copyright (C) 2002-2021 Num Kadoma. Its license, embedded in the JSON: free software; unlimited permission to use, copy and distribute, with or without modification, commercially or noncommercially; provided as is, without warranty.