TextBitmap Class
Text bitmap atlas with support for signed distance field data.
Input data should be composed of a BMFont file (can be a .fnt, .json. etc) file and a character atlas texture from an image.
Font atlas can be generate using the tool http:// www.angelcode.com/products/bmfont/
Based on the three-bmfont-text library.
- https:// github.com/Jam3/three-bmfont-text
- https:// github.com/Jam3/load-bmfont
Item Index
Methods
Methods
setText
-
text
Set the text to be displayed.
Parameters:
-
text
String
updateGeometry
()
Update the text bitmap geometry to match config.
Should be called every time after changes to configuration are made.
updateShader
()
Update the shader used to draw the bitmap information in the screen.
Attributes
config
Object
BMFont text configuration object.
Passed to the BMFont text geometry generator. It is a object with the format.
{ font: (Object) Font data should be parsed from (.json, .fnt, etc) file, text: (String), width: (Number) Width of the text area, align: (String) Side to align the text, lineHeight: (Number) Line height/font size, letterSpacing: (Number) Spacing between characters, mode: (String) a mode for word-wrapper; can be 'pre' (maintain spacing), or 'nowrap' (collapse whitespace but only break on newline characters), otherwise assumes normal word-wrap behaviour (collapse whitespace, break at width or newlines) tabSize: (Number) the number of spaces to use in a single tab (default 4) start: (Number) the starting index into the text to layout (default 0) end: (Number) the ending index (exclusive) into the text to layout (default text.length) }
font
Object
BMFont text font data, contains the data about all characters available, and their position in the atlas.
Font data should be parsed from (.json, .fnt, etc) file.
Passed to the BMFont text geometry generator.
shader
Number
Text bitmap rendering shader, can be:
- TextBitmap.BITMAP
- TextBitmap.SDF
- TextBitmap.MSDF
texture
Texture
Texture containing the bitmap characters.
Data specifiyng the position of each character in the texture should be placed in the font.