The Font class is used to manage embedded fonts in SWF files. Embedded fonts are represented as a subclass of the Font class. The Font class is currently useful only to find out information about embedded fonts; you cannot alter a font by using this class. You cannot use the Font class to load external fonts, or to create an instance of a Font object by itself. Use the Font class as an abstract base class.
Static methods
staticenumerateFonts(enumerateDeviceFonts:Bool = false):Array<Font>
Specifies whether to provide a list of the currently available embedded fonts.
Parameters:
enumerateDeviceFonts | Indicates whether you want to limit the list
to only the currently available embedded
fonts. If this is set to |
---|
Returns:
A list of available fonts as an array of Font objects.
staticfromBytes(bytes:ByteArray):Font
Creates a new Font from bytes (a haxe.io.Bytes or openfl.utils.ByteArray) synchronously. This means that the Font will be returned immediately (if supported).
Parameters:
bytes | A haxe.io.Bytes or openfl.utils.ByteArray instance |
---|
Returns:
A new Font if successful, or null
if unsuccessful
staticfromFile(path:String):Font
Creates a new Font from a file path synchronously. This means that the Font will be returned immediately (if supported).
Parameters:
path | A local file path containing a font |
---|
Returns:
A new Font if successful, or null
if unsuccessful
staticloadFromBytes(bytes:ByteArray):Future<Font>
Creates a new Font from haxe.io.Bytes or openfl.utils.ByteArray data asynchronously. The font decoding will occur in the background. Progress, completion and error callbacks will be dispatched in the current thread using callbacks attached to a returned Future object.
Parameters:
bytes | A haxe.io.Bytes or openfl.utils.ByteArray instance |
---|
Returns:
A Future Font
staticloadFromFile(path:String):Future<Font>
Creates a new Font from a file path or web address asynchronously. The file load and font decoding will occur in the background. Progress, completion and error callbacks will be dispatched in the current thread using callbacks attached to a returned Future object.
Parameters:
path | A local file path or web address containing a font |
---|
Returns:
A Future Font
staticloadFromName(path:String):Future<Font>
Creates a new Font from a font name asynchronously. This feature should work for embedded CSS fonts on the HTML5 target, but is not implemented for registered OS fonts on native targets currently. The file load and font decoding will occur in the background. Progress, completion and error callbacks will be dispatched in the current thread using callbacks attached to a returned Future object.
Parameters:
path | A font name |
---|
Returns:
A Future Font