# font-atlas

> Populate a element with a font texture atlas

Latest version **2.1.0** (published 2018-06-20) · MIT license · 0 weekly downloads

## Install

```sh
npm install font-atlas
pnpm add font-atlas
yarn add font-atlas
bun add font-atlas
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.1.0 |
| Published | 2018-06-20 |
| First published | 2014-07-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 26 |
| Author | Hugh Kennedy |
| Maintainers | dfcreative, hughsk |
| Keywords | font, type, typography, gamedev, canvas, browser, browserify, element, atlas, text |

## Links

- npm: https://www.npmjs.com/package/font-atlas
- Repository: https://github.com/hughsk/font-atlas
- Issues: https://github.com/hughsk/font-atlas/issues
- npm.io page: https://npm.io/package/font-atlas

## Dependencies (1)

- [css-font](https://npm.io/package/css-font.md) ^1.0.0

## Alternatives

- [@opentelemetry/exporter-zipkin](https://npm.io/package/@opentelemetry/exporter-zipkin.md) — 14.8M weekly downloads
- [pusher-js](https://npm.io/package/pusher-js.md) — 2.0M weekly downloads
- [browserify](https://npm.io/package/browserify.md) — 1.7M weekly downloads
- [sqs-consumer](https://npm.io/package/sqs-consumer.md) — 1.7M weekly downloads
- [@sanity/eventsource](https://npm.io/package/@sanity/eventsource.md) — 930.8K weekly downloads

## Recent versions

- 2.1.0 (latest) — 2018-06-20
- 2.0.0 — 2018-06-06
- 1.0.0 — 2014-07-07

## README

# font-atlas [![experimental](http://badges.github.io/stability-badges/dist/experimental.svg)](http://github.com/badges/stability-badges)

Populate a `<canvas>` element with a font texture atlas – can be used to quickly generate bitmap fonts.

## Usage

[![NPM](https://nodei.co/npm/font-atlas.png)](https://nodei.co/npm/font-atlas/)

### canvas = fontAtlas([options])

Populates and returns a `<canvas>` element with a font texture atlas. Takes
the following options:

* `canvas`: use an existing `<canvas>` element. By default, a new one will
  be created for you.
* `font`: the font family to use when drawing the text. Can be a [css font](https://developer.mozilla.org/en-US/docs/Web/CSS/font) string or an object with font properties: `size`, `family`, `style`, `weight`, `variant`, `stretch`.
* `shape`: an array containing the `[width, height]` for the canvas in pixels.
  Default: `[512, 512]`.
* `step`: an array containing the `[width, height]` for each cell in pixels.
  Default: `[32, 32]`.
* `chars`: may be one of either:
  * a string containing all of the characters to use.
  * an array of all the characters to use.
  * an array specifying the `[start, end]` character codes to use. By default,
    this is `[32, 126]`.

## See also

* [font-atlas-sdf](https://npmjs.org/package/font-atlas-sdf)

## License

MIT. See [LICENSE.md](http://github.com/hughsk/font-atlas/blob/master/LICENSE.md) for details.

![font-atlas](http://imgur.com/FWLDbPP.png)

---
_Source: https://npm.io/package/font-atlas · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
