Font Class

Extends Resource
Module: Resources

Font class stores font data, font data can be stored as an json or as a TTF file (stored in Base64).

Font objects are used to draw text using the TextMesh object and/or generate text bitmap.

Item Index

Properties

Methods

fileIsFont

(
  • fname
)
Boolean static

Check if a file name refers to a font file.

Parameters:

  • fname String

Returns:

Boolean:

True if the fname refers to a supported font format.

generateShapes

(
  • text
  • size
  • divisions
)
Array

Generate shapes from font data.

The shapes generated can be extruded to create 3D geometry.

Parameters:

  • text String
  • size Number
  • divisions Number

Returns:

Array:

paths

loadTTF

()

Load font from data using the TTF loader.

reverseGlyphs

()

Reverse the font glyphs.

Can be used to fix fonts that have paths defined CW.

toJSON

(
  • meta
)
Object

Serialize font resource to json.

Font data is stored as Base64 is present in a binary format, or JSON otherwise.

Parameters:

  • meta Object

Returns:

Object:

json

Properties

font

Object

Font data, can be an ArrayBuffer or JSON.

Default: null

reversed

Boolean

If true the font glyphs are reversed.

Default: false