Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hughsk/letter-bitmap
Generate a single-channel bitmap for an individual character of a given font
https://github.com/hughsk/letter-bitmap
Last synced: 12 days ago
JSON representation
Generate a single-channel bitmap for an individual character of a given font
- Host: GitHub
- URL: https://github.com/hughsk/letter-bitmap
- Owner: hughsk
- License: other
- Created: 2014-09-18T17:58:38.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2014-09-18T17:58:46.000Z (about 10 years ago)
- Last Synced: 2024-10-17T16:41:28.752Z (22 days ago)
- Language: JavaScript
- Homepage: http://hughsk.io/letter-bitmap
- Size: 137 KB
- Stars: 8
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# letter-bitmap [![stable](http://badges.github.io/stability-badges/dist/stable.svg)](http://github.com/badges/stability-badges)
Generate a single-channel bitmap for an individual character of a given font.
## Usage
[![NPM](https://nodei.co/npm/letter-bitmap.png)](https://nodei.co/npm/letter-bitmap/)
### `data = letter(char, font, size, [context])`
Returns a 2D `Float32Array` containing the font data, on a scale from 0 (empty)
to 255 (solid).* `char` is the character you want to render.
* `font` is the font family you'd like to use.
* `size` is the total width/height of the canvas, in pixels. The final data
length will be `size * size`.
* `context` is an optional 2D canvas context to use. Note that this will mess
with the canvas itself.[![letter-bitmap](http://imgur.com/5W9XirT.png)](http://hughsk.io/letter-bitmap)
## License
MIT. See [LICENSE.md](http://github.com/hughsk/letter-bitmap/blob/master/LICENSE.md) for details.