Libraries.Game.Graphics.Fonts.CharacterInformation Documentation

The CharacterInformation class is used to store information about each character and ways to retrieve that information.

Example Code

use Libraries.Game.Graphics.Fonts.all
    use Libraries.Game.Game
    use Libraries.Containers.HashTable

    class Main is Game
        action Main
            StartGame()
        end
        
        action CreateGame
            HashTable<text, CharacterInformation> characterTable
            CharacterInformation info
            info:SetCharacterCode(97)
            characterTable:Add("a", info)
        end
    end

Inherits from: Libraries.Language.Object

Summary

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.
GetCharacterCode()This action returns the character code, normally in UNICODE, for a given character.
GetGlyph()This action returns the glyph for a given character.
GetGlyphLocationTableIndex()This action returns the location of the glyph within the glyph table.
GetGlyphPoints()This action returns the Bezier curve glyph points for a given character.
GetGlyphTableOffset()This action returns the offset for the location of the glyph table within the file.
GetHashCode()This action gets the hash code for an object.
GlyphPointsHaveBeenRead()This action returns whether or not the Bezier curve glyph points have been read from the file.
HasGlyph()This action returns whether or not the glyph has been created for a given character.
SetCharacterCode(integer charCode)This action sets the character code, normally in UNICODE, for the character.
SetGlyph(Libraries.Game.Graphics.Glyph glyph)This actions sets the glyph for a given character.
SetGlyphIndexAndOffset(integer glyphIndex, integer glyphOffset)This action sets the offset of the glyph table in the font file, and the index of this glyph within the glyph table.
SetGlyphPoints(Libraries.Game.Graphics.Fonts.BezierCurveGlyphPoints glyphPoints)This action sets the Bezier curve points of the glyph for a given character.

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.

GetCharacterCode()

This action returns the character code, normally in UNICODE, for a given character.

Example Code

use Libraries.Game.Graphics.Fonts.all
        use Libraries.Game.Game

        class Main is Game
            action Main
                StartGame()
            end

            action CreateGame
                CharacterInformation info
                integer characterCode = info:GetCharacterCode()
            end
        end

Return

integer: Returns the character code of the character.

GetGlyph()

This action returns the glyph for a given character.

Example Code

use Libraries.Game.Graphics.Fonts.all
        use Libraries.Game.Graphics.Glyph
        use Libraries.Game.Game

        class Main is Game
            action Main
                StartGame()
            end 

            action CreateGame
                CharacterInformation info
                Glyph glyph = info:GetGlyph()
            end
        end

Return

Libraries.Game.Graphics.Glyph: Returns the glyph for a given character.

GetGlyphLocationTableIndex()

This action returns the location of the glyph within the glyph table.

Example Code

use Libraries.Game.Graphics.Fonts.all
        use Libraries.Game.Game

        class Main is Game
            action Main
                StartGame()
            end

            action CreateGame
                CharacterInformation info
                integer location = info:GetGlyphLocationTableIndex()
            end
        end

Return

integer: Returns the location of the glyph within the glyph table.

GetGlyphPoints()

This action returns the Bezier curve glyph points for a given character.

Example Code

use Libraries.Game.Graphics.Fonts.all
        use Libraries.Game.Game

        class Main is Game
            action Main
                StartGame()
            end

            action CreateGame
                CharacterInformation info
                BezierCurveGlyphPoints glyphPoints = info:GetGlyphPoints()
            end
        end

Return

Libraries.Game.Graphics.Fonts.BezierCurveGlyphPoints: Returns the Bezier curve glyph points for a given character.

GetGlyphTableOffset()

This action returns the offset for the location of the glyph table within the file.

Example Code

use Libraries.Game.Graphics.Fonts.all
        use Libraries.Game.Game

        class Main is Game
            action Main
                StartGame()
            end

            action CreateGame
                CharacterInformation info
                integer offset = info:GetGlyphTableOffset()
            end
        end

Return

integer: Returns the offset for the location of the glyph table.

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.

GlyphPointsHaveBeenRead()

This action returns whether or not the Bezier curve glyph points have been read from the file.

Example Code

use Libraries.Game.Graphics.Fonts.all
        use Libraries.Game.Game
       
        class Main is Game
            action Main
                StartGame()
            end

            action CreateGame
                CharacterInformation info
                output info:GlyphPointsHaveBeenRead()
            end
        end

Return

boolean: Returns true if the Bezier curve glyph points have been read from the file, and false if they have not.

HasGlyph()

This action returns whether or not the glyph has been created for a given character.

Example Code

use Libraries.Game.Graphics.Fonts.all
        use Libraries.Game.Game

        class Main is Game
            action Main
                StartGame()
            end

            action CreateGame
                CharacterInformation info
                output info:HasGlyph()
            end
        end

Return

boolean: Returns true if the glyph for a given character has been created, and false if it has not.

SetCharacterCode(integer charCode)

This action sets the character code, normally in UNICODE, for the character.

Example Code

use Libraries.Game.Graphics.Fonts.all
        use Libraries.Game.Game

        class Main is Game
            action Main
                StartGame()
            end

            action CreateGame
                CharacterInformation info
                info:SetCharacterCode(97)
            end
        end

Parameters

SetGlyph(Libraries.Game.Graphics.Glyph glyph)

This actions sets the glyph for a given character.

Example Code

use Libraries.Game.Graphics.Fonts.all
        use Libraries.Game.Graphics.Glyph
        use Libraries.Game.Game

        class Main is Game
            action Main
                StartGame()
            end

            action CreateGame
                CharacterInformation info
                Glyph glyph
                info:SetGlyph(glyph)
            end
        end

Parameters

SetGlyphIndexAndOffset(integer glyphIndex, integer glyphOffset)

This action sets the offset of the glyph table in the font file, and the index of this glyph within the glyph table.

Example Code

use Libraries.Game.Graphics.Fonts.all
        use Libraries.Game.Game

        class Main is Game
            action Main
                StartGame()
            end

            action CreateGame
                CharacterInformation info
                info:SetGlyphIndexAndOffset(0, 0)
            end
        end

Parameters

SetGlyphPoints(Libraries.Game.Graphics.Fonts.BezierCurveGlyphPoints glyphPoints)

This action sets the Bezier curve points of the glyph for a given character.

Example Code

use Libraries.Game.Graphics.Fonts.all
        use Libraries.Game.Game

        class Main is Game
            action Main
                StartGame()
            end

            action CreateGame
                CharacterInformation info
                BezierCurveGlyphPoints glyphOutline
                info:SetGlyphPoints(glyphOutline)
            end
        end

Parameters