Class “FontResources”

Object > Resources > FontResources

This is the base class for all font resource dictionaries. Instances can be obtained via the from method, or by subclassing. All members of a FontResources (or subclass) instance will be of the type Font.

Type: FontResources extends Resources<Font, FontValue>
Constructor: protected
Singleton: No
Namespace: tabris
Direct subclasses: None
JSX Support: No

See also:

Resource Management in Tabris.js
Defining raw font resource data in a separate JSON file.
Converting raw font resource data to FontResources instance.
TSX Using a FontResources dictionary [► Run in Playground]

Static Methods

from(base, data)

Creates a fonts dictionary from the given raw “data” object. All fonts from the given “base” dictionary are inherited unless overwritten.

Entries in the “data” object starting with “$” are considered configuration options and will not become entries in the final fonts dictionary.

Parameter Type Description
base Base A plain object or another FontResources instance containing values to inherit by the new FontResources dictionary.
data Data The raw data (plain object) to create the dictionary from. The format must match the Tabris.js fonts JSON schema.

Returns: FontResources

from(data)

Creates a fonts dictionary from the given raw “data” object. The format must match the Tabris.js fonts JSON schema. Entries in the “data” object starting with “$” are considered configuration options and will not become entries in the final fonts dictionary.

Parameter Type Description
data Data The raw data (plain object) to create the dictionary from. The format must match the Tabris.js fonts JSON schema.

Returns: FontResources