Murl Engine Lua Addon API  Version 1.0 beta
Murl.Resource.IFont

The IFont resource object interface.

A font resource can either store a number of individual glyph rectangles referencing sub-regions of a Resource::IImage in order to render bitmap fonts, or a number of glyph outlines for rendering vector fonts on the fly (without the need of a Resource::IImage). Note, that bitmap font rendering works similar to using a Resource::IAtlas, in that the font resource does not store the actual glyph bitmaps. A corresponding Resource::IImage must be active during rendering e.g. a Graph::ITextGeometry object to produce the correct output.


Table members

Methods


GetScaleFactor()

Get the font's scale factor.

Number GetScaleFactor()

Returns
Number The scale factor.

GetSizeY()

Get the font's vertical line size.

Number GetSizeY()

Returns
Number The vertical line size.

GetBaseLine()

Get the font's base line offset.

Number GetBaseLine()

Returns
Number The base line offset.

GetAscent()

Get the font's ascent.

Number GetAscent()

Returns
Number The ascent.

GetDescent()

Get the font's descent.

Number GetDescent()

Returns
Number The descent.

GetSpacing()

Get the font spacing, i.e. the horizontal distance between glyphs.

Number GetSpacing()

Returns
Number The spacing value.

GetLeading()

Get the font leading, i.e. the vertical distance between lines.

Number GetLeading()

Returns
Number The leading value.

GetSpaceWidth()

Get the horizontal size of the whitespace character.

Number GetSpaceWidth()

Returns
Number The whitespace width.

GetDigitWidth()

Get the common horizontal size of all digits.

Number GetDigitWidth()

Returns
Number The digit width.

GetOffsetX()

Get the horizontal screen offset for rendering.

Number GetOffsetX()

Returns
Number The horizontal offset.

GetOffsetY()

Get the vertical screen offset for rendering.

Number GetOffsetY()

Returns
Number The vertical offset.

HasRectangles()

Check if the font resource contains bitmap glyph rectangles.

Boolean HasRectangles()

Returns
Boolean true if present.

GetNumberOfRectangles()

Get the actual number of bitmap glyph rectangles contained in the font.

Integer GetNumberOfRectangles()

Returns
Integer The number of rectangles.

GetRectangleByIndex(index)

Get a bitmap glyph rectangle by its index.

Murl.Resource.IRectangle GetRectangleByIndex(Integer index)

Parameters
indexThe index in the range from 0 to GetNumberOfRectangles()-1.
Returns
Murl.Resource.IRectangle A pointer to the glyph's rectangle, or null if index is out of range.

GetRectangleByCode(charCode)

Get a bitmap glyph rectangle for a given Unicode value.

Murl.Resource.IRectangle GetRectangleByCode(Integer charCode)

Parameters
charCodeThe Unicode value to query.
Returns
Murl.Resource.IRectangle A pointer to the glyph's rectangle, or null if not found.

HasOutlines()

Check if the font resource contains glyph outlines.

Boolean HasOutlines()

Returns
Boolean true if present.

GetNumberOfOutlines()

Get the actual number of glyph outlines contained in the font.

Integer GetNumberOfOutlines()

Returns
Integer The number of outlines.

GetOutlineByIndex(index)

Get a glyph outline by its index.

Murl.Resource.IOutline GetOutlineByIndex(Integer index)

Parameters
indexThe index in the range from 0 to GetNumberOfOutlines()-1.
Returns
Murl.Resource.IOutline A pointer to the glyph's outline, or null if index is out of range.

GetOutlineByCode(charCode)

Get a glyph outline for a given Unicode value.

Murl.Resource.IOutline GetOutlineByCode(Integer charCode)

Parameters
charCodeThe Unicode value to query.
Returns
Murl.Resource.IOutline A pointer to the glyph's outline, or null if not found.

HasKerning()

Check if the font resource contains kerning information.

Boolean HasKerning()

Returns
Boolean true if present.

GetKerningByCode(charCodeLeft, charCodeRight)

Get the kerning offset for a pair of Unicode characters.

Number GetKerningByCode(Integer charCodeLeft, Integer charCodeRight)

Parameters
charCodeLeftThe Unicode value of the left character.
charCodeRightThe Unicode value of the right character.
Returns
Number The horizontal offset.