font-atlas ![experimental](https://camo.githubusercontent.com/dac819f88a300cef4d60fc98040a4f9d3b4d5a50821a80fc6917639f767da856/687474703a2f2f6261646765732e6769746875622e696f2f73746162696c6974792d6261646765732f646973742f6578706572696d656e74616c2e737667)
Populate a <canvas>
element with a font texture atlas – can be used to quickly generate bitmap fonts.
Usage
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 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
License
MIT. See LICENSE.md for details.