Library / SDK
patorjk/figlet.js avatar
patorjk/figlet.js

figlet.js documents its vertical layout option by copying the horizontal one

A FIG Driver written in JavaScript which aims to fully implement the FIGfont spec.

3,044 stars188 forksJavaScriptMIT

At a glance

What is it?
A FIGfont implementation written in TypeScript and shipped as compiled JavaScript, with an exports map that resolves eight different type declarations for one entry point. Its option reference describes the vertical layout setting in the horizontal layout's words, then admits most fonts ignore it.
Who is it for?
figlet.js suits someone who needs FIGfont output in a browser bundle or a Node script and wants the font files and the layout engine rather than a shell binary. Before using it, check four things.
Can I use it commercially?
Yes. MIT is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
Is it still maintained?
Yes. The repository last received commits 4 days ago.
What is it written in?
Mainly JavaScript, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on November 25, 2026, and from our analysis. They are not legal advice.

From daily snapshots

Star history

  • patorjk/figlet.js3,044 ★ · +22
Star history
Repository2026-09-252026-11-25
patorjk/figlet.js3k3k

22 Stars in the last 61 days, measured from the daily GitHub snapshot. Compare with other projects

Editorial analysis

The vertical layout option is documented with the horizontal one's text

The options reference is organised as one subsection per setting, and two of those subsections are worth reading together.

The horizontal layout entry gives its type, its default, and then describes five accepted values: the default, full spacing, fitted spacing, and the two smushing behaviours. The explanation says the default does the kerning the way the font designer intended, that full uses full letter spacing, that fitted moves letters together until they almost touch, and that the two smushing values are common kerning setups in this kind of tool.

The vertical layout entry immediately below repeats that paragraph almost word for word. Same type, same default, same list of five values, same sentence about doing the kerning the way the designer intended, same sentence about full letter spacing, same sentence about fitted and the same sentence about smushing being common setups.

The only thing that changes is the word vertical in the first line. Everything after it describes horizontal behaviour, and the sentence about a font designer intending the kerning makes no sense applied to how glyphs stack downwards.

So a reader looking up the vertical option gets a plausible-sounding description of the wrong axis. Nothing is obviously broken in the text; it simply answers a different question.

The section that follows the option reference partly acknowledges the problem rather than fixing it. It says that in most cases you will use either the default or the fitted setting, and that most fonts do not support vertical kerning, with a handful that do. So the option is real, the default and fitted advice applies to both axes, and the per-option description is the part that is wrong.

Eight type declaration paths for one entry point

The manifest's exports field is the most carefully constructed part of this package, and it is worth reading as a table.

There are two independent axes. One is the environment, resolved as browser first and then node. The other is module system, resolved as import and then require. Each of those four combinations names its own type declaration file and its own implementation file, so the single package entry point has eight declaration paths behind it: four type files for browser, four for node, import and require in each.

The two environments get genuinely different implementations. The browser condition resolves to a general build, while the node condition resolves to a build with a different name, implying the Node entry carries filesystem access or other server-side capability the browser build omits.

After the two environment branches there are two more fallback branches with no condition, one for import and one for require, for resolvers that match neither environment explicitly.

And that last require branch names a different file extension from every other require branch in the map. All of the others point at files ending in the CommonJS extension; this one points at a file ending in plain JavaScript. Since the package declares itself a module, a plain JavaScript file is interpreted as a module rather than as CommonJS, so that branch does not obviously deliver the CommonJS build its siblings do.

There is also a second export subpath alongside the main one, pointing only at the node build. That gives browser consumers a way to ask for the browser bundle explicitly, or to avoid pulling the node build when a bundler guesses.

It is thorough work, and the single extension inconsistency in the final fallback is exactly the kind of thing that survives because every supported environment hits one of the earlier branches.

The old toolchain and the new one are both still in the tree

The repository root carries configuration files from two different eras of JavaScript tooling, and nothing has been removed between them.

The older group is a linter configuration for JSHint, a task-runner file for Grunt, and a configuration for Travis as the continuous integration service. There is also a commit-hooks directory, which predates the current generation of hooks tooling.

The newer group is a TypeScript configuration, a bundler configuration for Vite, a test configuration for Vitest, and a formatter configuration with its own ignore file.

Both sets are present at once. A project that had finished migrating would have deleted the JSHint configuration, the Grunt file and the Travis configuration rather than leaving them to drift. Their presence suggests the migration was additive, which is a normal way to do it and a common way to forget the cleanup.

Two smaller signals sit alongside. The lockfile in the repository is the one belonging to the Node package manager, which is consistent with a project using the modern bundler and test tooling while still installing with that package manager. And the commit-hooks directory is present alongside the newer hooks configuration, so the hook mechanism may also be configured twice.

None of this affects what the library does when consumed. It affects what a contributor runs, and there is no documentation in the readme telling them which of the two lint configurations is authoritative.

Two font directories, a command line entry, and an action definition

Three things in the tree are not mentioned anywhere in the visible documentation.

The first is a pair of font directories with different names. One is the plain name; the other carries an adjective suggesting fonts that can be imported or added by a user rather than shipped. The readme's option reference names a font by name and gives a default, and its examples use one font from the bundled set, but nothing explains the distinction or tells a user which directory to drop a new font into.

For a library whose whole job is rendering text in a font, that is the most consequential undocumented thing in the repository. A user who wants their own font has to guess.

The second is a command line entry point. The manifest declares a binary pointing into a directory at the root of the repository, and there is a matching directory in the tree. The readme documents a library API for the browser and for Node and never mentions that a command exists, so its flags, its output format and whether it reads the same options are all unknown from the documentation.

The third is a workflow definition file, which is the format GitHub uses to package an action. So the project is also distributable as a step in someone else's pipeline. Nothing in the readme says what the action does, what inputs it takes, or what it would be used for.

Taken together these are three features described by their presence in the repository rather than by their documentation, which is a pattern worth knowing about before deciding the project is only a library.

The banner at the top of the readme was rendered by the library it documents

The readme opens with a block of ASCII art spelling the project's name, and it is set in the distinctive angular style of this family of tools rather than in a plain banner font.

That is the project's own output. The library renders text as FIGfont art, and the first thing in its documentation is itself rendered by it.

It is a small thing, but it is the only place the readme demonstrates the product, and it does so without saying so. Everything after that point is prose and code.

The same paragraph that introduces the project explains its provenance, and the provenance is unusually specific. The implementation is written in TypeScript and compiled to JavaScript. It works in a browser and it works under Node. And it was written to power a specific application: the author's own web-based tool for previewing these fonts, which the readme links to and which still runs today.

So the library was extracted from a real application rather than designed as a standalone package, which explains a few things about its shape. It ships two environment-specific builds because the browser tool and the Node library have different needs. It has a command line entry, which an application previewing fonts in a terminal would want. And its documentation leads with rendering rather than with font management, because that was the problem it was first written to solve.

Two calling styles are documented side by side in a module-typed package

The quick start opens with a single install line:

sh
npm install figlet

Everything after that is library usage, which is why the readme gives two complete examples of the same call rather than one:

The first is a modern one. It uses a default import from the package, wraps the call in an asynchronous function, and awaits the result before printing it. The library is called as a function with one argument.

The second is introduced as the classic callback version. It uses a CommonJS require, and the call takes a string and a function whose parameters are an error and the generated art. The example handles the error by printing a message and returning.

Both are presented as current, in a package whose manifest declares itself a module. That combination works because the exports field provides a CommonJS branch, so the second example resolves to the CommonJS build rather than failing. But the framing tells you the second form predates the first, and that both are being maintained for readers who arrive from either direction.

The return value is documented once, in the reference section rather than in the quick start: the text method returns a promise resolving to the generated art. That promise is what the first example awaits, and the second example ignores because it uses the callback instead.

There is a third form documented separately, and it is the odd one out. The synchronous method takes only the text and the options, with no callback parameter at all. So the package offers a promise-returning asynchronous call, a callback-style asynchronous call, and a synchronous call with neither, and the reference section states the return type for only one of the three.

A user choosing between them is left inferring that the synchronous form returns the art directly, which the examples demonstrate but the prose does not say.

One badge, and it compares download counts against another package of the same name

The readme carries a single badge, and it is not a build status.

It points at a download comparison chart that queries the package registry for this name against another, rendered in its minimal form. So the one piece of status the project advertises is how its weekly downloads compare with a different package that shares its name.

That is an unusual choice, and it is informative in two ways. There is another package on the registry with this name, which means a bare install command can resolve to something other than this project depending on which one the registry prefers, and a reader has to be more careful than usual about the name they type.

There is no build badge, no coverage figure and no licence badge anywhere in the visible documentation, despite the presence of a test configuration, a coverage-capable test runner and a licence file at the root.

The four option defaults, meanwhile, are stated precisely, and they are the most practically useful numbers in the file. The font defaults to the standard one. Both layout options default to the designer's own kerning. The width limit defaults to nothing at all rather than to a number, so output is unbounded unless you set it. And whitespace breaking defaults to off, which means a width limit will cut words mid-token unless you also turn that on.

That last pair is the interaction worth knowing. Two options that appear unrelated in the reference are load-bearing together, and neither default tells you so.

Editorial conclusion

figlet.js suits someone who needs FIGfont output in a browser bundle or a Node script and wants the font files and the layout engine rather than a shell binary. Before using it, check four things. Read the exports map rather than assuming the entry points are interchangeable, since one fallback branch names a different file extension from the others and there is a separate subpath for Node consumers. Know that the vertical layout option is documented by accident and is supported by few fonts, so treat it as untested rather than as a feature. Decide whether you want the asynchronous or synchronous call, because only one of them is documented as returning a promise and the synchronous form takes no callback at all. And if you need a font that is not bundled, check which of the two font directories it belongs in, since the readme does not explain the difference.

Frequently asked questions

How to install figlet?

With the Node package manager, using the install command shown in the readme. The manifest also declares a command line entry point pointing into a directory in the repository, though the readme does not document that binary.

What is figlet used for?

Rendering text as ASCII art in the FIGfont style. This project is the JavaScript implementation, written in TypeScript and compiled to JavaScript, and it works both in a browser and under Node. A separate Python implementation exists and is not covered here.

Is figlet available for Linux?

The readme states it works in the browser and with Node, and does not list platforms. The package ships separate browser and Node builds through its exports map, plus a subpath export for Node consumers, so platform support follows whatever Node supports.

What is the difference between figlet.text and figlet.textSync?

One is asynchronous and documented as returning a promise that resolves to the art, with an optional callback. The other is synchronous, takes only the text and options, has no callback parameter, and returns the art directly.

Does the figlet.js vertical layout option work?

It exists and accepts the same five values as the horizontal option, but its readme entry is a copy of the horizontal one. The documentation later notes that most fonts do not support vertical kerning, with a handful that do.

How do I add my own font to figlet.js?

The repository contains two font directories, one plainly named and one named as importable, and the readme does not explain the difference or say which to use. The font option takes a string name, and the default is the standard font.

Official sources

  1. Issues
  2. License: MIT
  3. patorjk/figlet.js on GitHub
  4. README
  5. Releases
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/patorjk-figlet-js.svg)](https://hysenlabs.com/projects/patorjk-figlet-js)

Star history chart for your README

markdown
[![Star history](https://hysenlabs.com/chart/patorjk-figlet-js.svg)](https://hysenlabs.com/projects/patorjk-figlet-js)

Was this useful?