letter-bitmap
v1.0.0
Published
Generate a single-channel bitmap for an individual character of a given font
Downloads
5
Maintainers
Readme
letter-bitmap
Generate a single-channel bitmap for an individual character of a given font.
Usage
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 besize * size
.context
is an optional 2D canvas context to use. Note that this will mess with the canvas itself.
License
MIT. See LICENSE.md for details.