letter-bitmap

Generate a single-channel bitmap for an individual character of a given font

OTHER License

Downloads
4
Stars
8
Committers
1

letter-bitmap stable

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 be size * 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.