Static methods

staticfromBytes(bytes:Bytes):Font

Creates a Font instance from byte data.

Parameters:

bytes

The byte data containing the font.

Returns:

A Font instance.

staticfromFile(path:String):Font

Creates a Font instance from a file path.

Parameters:

path

The file path of the font.

Returns:

A Font instance.

staticloadFromBytes(bytes:Bytes):Future<Font>

Loads a Font from byte data asynchronously.

Parameters:

bytes

The byte data containing the font.

Returns:

A Future containing a Font instance.

staticloadFromFile(path:String):Future<Font>

Loads a Font from a file path asynchronously.

Parameters:

path

The file path of the font.

Returns:

A Future containing a Font instance.

staticloadFromName(path:String):Future<Font>

Loads a Font by its name asynchronously.

Parameters:

path

The name of the font.

Returns:

A Future containing a Font instance.

Constructor

@:value({ name : null })new(?name:String)

Creates a new instance of a Font object.

Parameters:

name

Optional name of the font.

Variables

ascender:Int

The ascender value of the font.

descender:Int

The descender value of the font.

height:Int

The height of the font.

read onlyname:String

The name of the font.

numGlyphs:Int

The number of glyphs in the font.

src:Dynamic

underlinePosition:Int

The underline position of the font.

underlineThickness:Int

The underline thickness of the font.

unitsPerEM:Int

The units per EM of the font.

Methods

decompose():NativeFontData

Decomposes the font into outline data.

Returns:

An instance of NativeFontData that contains decomposed font outline information.

getGlyph(character:String):Glyph

Retrieves a glyph from the font by a character.

Parameters:

character

The character whose glyph to retrieve.

Returns:

A Glyph instance representing the glyph of the character.

getGlyphMetrics(glyph:Glyph):GlyphMetrics

Retrieves metrics for a given glyph.

Parameters:

glyph

The glyph whose metrics to retrieve.

Returns:

A GlyphMetrics instance containing the metrics of the glyph.

@:value({ characters : "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^`'\"/\\&*()[]{}<>|:;_-+=?,. " })getGlyphs(characters:String = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^`'\"/\\&*()[]{}<>|):Array<Glyph>

Retrieves an array of glyphs for a set of characters.

Parameters:

characters

The string containing characters to retrieve glyphs for.

Returns:

An array of Glyph instances representing the glyphs of the characters.

renderGlyph(glyph:Glyph, fontSize:Int):Image

Renders a specific glyph to an image.

Parameters:

glyph

The glyph to render.

fontSize

The size to render the glyph at.

Returns:

An Image instance representing the rendered glyph.

renderGlyphs(glyphs:Array<Glyph>, fontSize:Int):Map<Glyph, Image>

Renders a set of glyphs to images.

Parameters:

glyphs

The glyphs to render.

fontSize

The size to render the glyphs at.

Returns:

A Map containing glyphs mapped to their corresponding images.