Libraries.Game.Graphics.Fonts.FontManager Documentation

Inherits from: Libraries.Language.Object

Summary

Variable Summary Table

VariablesDescription
text FILE_PREFIXA prefix used to indicate a locally loaded font fil
text SYSTEM_PREFIXA prefix used to indicate a system fon
text FONT_DELIMITERA delimiting character used to separate portions of a Font's identifie

Actions Summary Table

ActionsDescription
Compare(Libraries.Language.Object object)This action compares two object hash codes and returns an integer.
Equals(Libraries.Language.Object object)This action determines if two objects are equal based on their hash code values.
GetAvailableFonts()This action will return an array of all files found in the system's default font folder.
GetFontLocation()This action provides a single source of truth for where the fonts live on a particular operating system.
GetGlyph(Libraries.Game.Graphics.Font font, text character)A prefix used to indicate a locally loaded font fil
GetHashCode()This action gets the hash code for an object.
GetKerning(Libraries.Game.Graphics.Font font, text character, text nextCharacter)
GetLineHeight(Libraries.Game.Graphics.Font font)
GetMaximumAscent(Libraries.Game.Graphics.Font font)
GetMaximumDescent(Libraries.Game.Graphics.Font font)
GetUnderlinePosition(Libraries.Game.Graphics.Font font)
GetUnderlineThickness(Libraries.Game.Graphics.Font font)
IsFontAvailable(text fontName)This action will look in the default system font folder and look for a font of the given name.
OverrideFontLocation(Libraries.System.File file)This action allows us to override the location fonts are loaded from.
OverrideFontLocation(text value)This action allows us to override the location fonts are loaded from.

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.

Example Code

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

Parameters

Return

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

Equals(Libraries.Language.Object object)

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

Example Code

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

Parameters

Return

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

GetAvailableFonts()

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

Example Code

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
        e

Return

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

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 syste

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

A prefix used to indicate a locally loaded font fil

Parameters

Return

Libraries.Game.Graphics.Glyph:

GetHashCode()

This action gets the hash code for an object.

Example Code

Object o
        integer hash = o:GetHashCode

Return

integer: The integer hash code of the object.

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

Parameters

Return

integer

GetLineHeight(Libraries.Game.Graphics.Font font)

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.

Example Code

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
        e

Parameters

Return

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

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 loade

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 loade

Parameters