API Documentation

for 0.0.1
Show:

Font Class

Font are not managed in Mobilizing.js like in a usual DOM context as we are using WebGL. To be able to use both bitmap rendered font and 3D vector rendering, we use openType.js (https://nodebox.github.io/opentype.js/ big thanks to Frederik!) to load any web compilant font and the use it in other classes.

Constructor

Font

(
  • params
)

Parameters:

  • params Object
    • fontFile Mixed

      the font file already loaded, must be loaded with response type setted to arraybuffer

Item Index

Methods

getFont

() Object private

Return the underlying Font.js object to work with it outside of Mobilizing.Font

Returns:

Object:

Font.js object

getTextSize

(
  • text
  • fontSize
)
Object.width, Object.height

Calculates the size (in pixels) that should take the string with this font at the given fontSize. Handy for Label creation.

Parameters:

  • text String

    the string to use for the size computing

  • fontSize Number

    the text font size to use

Returns:

Object.width, Object.height:

width and height