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

textmode.figlet.js

v1.0.0

Published

FIGlet font add-on for textmode.js

Readme

textmode.figlet.js (✿◠‿◠)

textmode.figlet.js is an add-on library for textmode.js that provides FIGlet / FIGfont support. It includes a FIGfont parser, layout engine, and rendering API that integrates with the Textmodifier system in textmode.js, allowing you to draw FIGlet text with configurable layout behavior and measurement helpers.

Features

  • Parse raw .flf sources into reusable TextmodeFigFont instances
  • Load FIGfonts at runtime with loadFigFont()
  • Draw FIGlet text with configurable horizontal and vertical layout behavior
  • Measure rendered output with width, height, and bounds helpers before drawing
  • Store alignment and baseline preferences per Textmodifier instance

Installation

Prerequisites

To get started with textmode.figlet.js, you'll need:

  • textmode.js 0.11.0 or newer
  • A modern browser with the same runtime requirements as textmode.js
  • Node.js 20.8.1+ and npm (optional, for ESM installation)

UMD

To use textmode.figlet.js in a browser without a bundler, load the UMD builds for both textmode.js and this add-on. textmode.js must be loaded first so the FIGlet add-on can attach to the expected global runtime.

<!doctype html>
<html lang="en">
	<head>
		<meta charset="utf-8" />
		<title>textmode.figlet.js sketch</title>

		<script src="https://cdn.jsdelivr.net/npm/textmode.js@latest/dist/textmode.umd.js"></script>
		<script src="https://cdn.jsdelivr.net/npm/textmode.figlet.js@latest/dist/textmode.figlet.umd.js"></script>
	</head>
	<body>
		<script src="./sketch.js"></script>
	</body>
</html>
const t = textmode.create({
	width: window.innerWidth,
	height: window.innerHeight,
	fontSize: 16,
	plugins: [FigletPlugin],
});

t.setup(async () => {
	const bulbhead = await t.loadFigFont('https://cdn.jsdelivr.net/gh/xero/figlet-fonts@master/Bulbhead.flf');

	t.figFont(bulbhead);
	t.figTextAlign('center');
	t.figTextBaseline('center');
});

t.draw(() => {
	t.background(8, 12, 24);
	t.charColor(255, 220, 120);
	t.figText('FIGLET', 0, 0, {
		horizontalLayout: 'fitted',
	});
});

t.windowResized(() => {
	t.resizeCanvas(window.innerWidth, window.innerHeight);
});

The UMD bundle exposes FigletPlugin globally, along with the other runtime exports such as TextmodeFigFont and FigFontParser.

ESM

Install the core library and the FIGlet add-on together:

npm install textmode.js textmode.figlet.js

Then import both packages in your sketch or application code:

import { textmode } from 'textmode.js';
import { FigletPlugin } from 'textmode.figlet.js';

Importing textmode.figlet.js provides the TypeScript augmentation. Installing FigletPlugin enables the runtime FIGlet methods on that Textmodifier instance.

Plugin setup

import { textmode } from 'textmode.js';
import { FigletPlugin } from 'textmode.figlet.js';

const t = textmode.create({
	width: 800,
	height: 600,
	plugins: [FigletPlugin],
});

The plugin installs the FIGlet drawing and measurement API during setup and removes it again if the plugin is uninstalled.

Loading .flf fonts

const bulbhead = await t.loadFigFont('https://cdn.jsdelivr.net/gh/xero/figlet-fonts@master/Bulbhead.flf');

t.figFont(bulbhead);

const custom = t.parseFigFont('Custom', figFontSource);

Any CORS-enabled .flf URL works for runtime loading.

Drawing and measuring text

t.figTextAlign('center');
t.figTextBaseline('center');

t.figText('HELLO', 0, 0, {
	horizontalLayout: 'fitted',
});

const width = t.figTextWidth('HELLO');
const height = t.figTextHeight('HELLO');
const bounds = t.figTextBounds('HELLO');

Use the measurement helpers when you need to position FIGlet text precisely before rendering it.

Alignment and baseline

  • figTextAlign('left' | 'center' | 'right')
  • figTextBaseline('top' | 'center' | 'baseline' | 'bottom')

These settings are stored in plugin-owned state per Textmodifier instance and apply to subsequent figText() calls until changed.

Next steps

Visit the textmode.js documentation at code.textmode.art for broader library guides and API reference, then use the local examples in this package to validate your FIGlet setup and rendering behavior.

License

textmode.figlet.js is licensed under the MIT License.