Libraries.Game.Graphics.Fonts.FontManager Documentation

Inherits from: Libraries.Language.Object

Summary

Variable Summary Table

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

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.
GetGlyph(Libraries.Game.Graphics.Font font, text character)
GetHashCode()This action gets the hash code for an object.
GetKerning(Libraries.Game.Graphics.Font font, text character, text nextCharacter)
GetLineGap(Libraries.Game.Graphics.Font font)
GetLineHeight(Libraries.Game.Graphics.Font font)
GetMaximumAscent(Libraries.Game.Graphics.Font font)
GetMaximumDescent(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.

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 (smaller)

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(t)

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
        end

Return

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

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

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

GetLineGap(Libraries.Game.Graphics.Font font)

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

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
        end

Parameters

Return

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