Libraries.Game.Graphics.Fonts.FontManager Documentation

Inherits from: Libraries.Language.Object

Variables Table

VariablesDescription
text SYSTEM_PREFIXA prefix used to indicate a system font.
text FILE_PREFIXA prefix used to indicate a locally loaded font file.
text BORDERED_TAGA tag used to indicate that this font supports borders around glyphs.
text BORDERLESS_TAGA tag used to indicate that this font doesn't support borders around glyphs. The default case.
text FONT_DELIMITERA delimiting character used to separate portions of a Font's identifier.

Actions Documentation

Compare(Libraries.Language.Object object)

This action compares two object hash codes and returns an integer. The result is larger if this hash code is larger than the object passed as a parameter, smaller, or equal. In this case, -1 means smaller, 0 means equal, and 1 means larger. This action was changed in Quorum 7 to return an integer, instead of a CompareResult object, because the previous implementation was causing efficiency issues.

Parameters

Return

integer: The Compare result, Smaller, Equal, or Larger.

Example

Object o
Object t
integer result = o:Compare(t) //1 (larger), 0 (equal), or -1 (smaller)

Equals(Libraries.Language.Object object)

This action determines if two objects are equal based on their hash code values.

Parameters

Return

boolean: True if the hash codes are equal and false if they are not equal.

Example

use Libraries.Language.Object
use Libraries.Language.Types.Text
Object o
Text t
boolean result = o:Equals(t)

GetAvailableFonts()

This action will return an array of all files found in the system's default font folder.

Return

Libraries.Containers.Array: Returns an array with all the font files on the system.

Example

use Libraries.Game.Graphics.Fonts.FontManager
use Libraries.Game.GameStateManager
use Libraries.System.File
use Libraries.Containers.Array
use Libraries.Game.Game

class Main is Game
    action Main
        StartGame()
    end

    action CreateGame
        GameStateManager gameState
        FontManager manager = gameState:GetFontManager()
        Array<File> fontFiles = font:GetAvailableFonts()
        integer index = 0
        output "The following fonts are available on the system: "
        repeat fontFiles:GetSize() times
            File temp = fontFiles:Get(index)
            output temp:GetPath()
            index = index + 1
        end
    end
end

GetFontLocation()

This action provides a single source of truth for where the fonts live on a particular operating system.

Return

text: the folder where fonts live on the currently running operating system.

GetGlyph(Libraries.Game.Graphics.Font font, text character)

A tag used to indicate that this font supports borders around glyphs.

Parameters

Return

Libraries.Game.Graphics.Glyph:

GetHashCode()

This action gets the hash code for an object.

Return

integer: The integer hash code of the object.

Example

Object o
integer hash = o:GetHashCode()

GetKerning(Libraries.Game.Graphics.Font font, text character, text nextCharacter)

A prefix used to indicate a locally loaded font file.

Parameters

Return

integer:

GetLineHeight(Libraries.Game.Graphics.Font font)

A delimiting character used to separate portions of a Font's identifier.

Parameters

Return

integer:

GetMaximumAscent(Libraries.Game.Graphics.Font font)

Parameters

Return

integer

GetMaximumDescent(Libraries.Game.Graphics.Font font)

Parameters

Return

integer

GetUnderlinePosition(Libraries.Game.Graphics.Font font)

Parameters

Return

integer

GetUnderlineThickness(Libraries.Game.Graphics.Font font)

Parameters

Return

integer

IsFontAvailable(text fontName)

This action will look in the default system font folder and look for a font of the given name. If a font is found with the same name, the action will return true. Otherwise, it returns false.

Parameters

  • text fontName: The name of the font to check for on the system.

Return

boolean: Returns true if the font is on the system, and false otherwise.

Example

use Libraries.Game.Graphics.Fonts.FontManager
use Libraries.Game.GameStateManager
use Libraries.Game.Game

class Main is Game
    action Main
        StartGame()
    end

    action CreateGame
        GameStateManager gameStateManager
        FontManager fontManager = gameStateManager:GetFontManager()
        boolean hasFont = fontManager:IsFontAvailable("Times New Roman")
    end
end

OverrideFontLocation(Libraries.System.File file)

This action allows us to override the location fonts are loaded from. This should not be used unless you know what you are doing. This path must be an absolute path to the directory where fonts are loaded.

Parameters

OverrideFontLocation(text value)

This action allows us to override the location fonts are loaded from. This should not be used unless you know what you are doing. This path must be an absolute path to the directory where fonts are loaded.

Parameters

  • text value