Font Class

Extends Resource
Module: Resources

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

Font objects are used for booth 2D and 3D text.

Constructor

Font

(
  • url
)

Parameters:

  • url String

    URL to font file

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 font shapes used to create 3D geometries.

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