Repository

Font

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 Summary

Public Constructor
public

Member Summary

Public Members
public
public

font: *

public

Method Summary

Public Methods
public

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

public

getTextSize(text: String, fontSize: Number): Object.width, Object.height

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

Public Constructors

public constructor(params: Object) source

Params:

NameTypeAttributeDescription
paramsObject

Parameters object, given by the constructor.

params.fontFileMixed

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

Public Members

public base64String: * source

public font: * source

public fontFile: * source

Public Methods

public getFont(): Object source

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

Return:

Object

Font.js object

public getTextSize(text: String, fontSize: Number): Object.width, Object.height source

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

Params:

NameTypeAttributeDescription
textString

the string to use for the size computing

fontSizeNumber

the text font size to use

Return:

Object.width, Object.height

width and height