Libraries.Game.Graphics.Fonts.CharacterMap Documentation

The CharacterMap class is used to lookup characters in a hash table. Primarily, it provides actions for finding the character code of a character, normally in UNICODE, a character's Bezier curve points if they have been stored, a character's glyph if it has been created, and the index and table offset of each character in the font file.

Example Code

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

    class Main is Game
        action Main
            StartGame()
        end

        action CreateGame
            CharacterMap map
            output map:GetGlyphIndex("a")
        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(text character)This action returns the character code for a given character.
GetGlyph(text character)This action returns the glyph of the given character.
GetGlyphIndex(text character)This action returns the location of the character in the glyph table from the font file.
GetGlyphPoints(text character)This action returns the Bezier curve glyph points of the given character.
GetHashCode()This action gets the hash code for an object.
GlyphPointsHaveBeenRead(text character)This action checks if the given character's Bezier curve glyph points have already been read from the file.
HasGlyph(text character)This action returns whether or not a glyph has been created for the given character.
HasKey(text character)This action returns whether or not the given character is in the character table.
SetGlyph(text character, Libraries.Game.Graphics.Glyph glyph)This action sets the glyph of a given character.
SetGlyphIndexAndOffset(text character, integer glyphIndex, integer glyphOffset)This action sets the index of the character in the font file's glyph offset location table, and the character's offset in the glyph table.
SetGlyphPoints(text character, Libraries.Game.Graphics.Fonts.BezierCurveGlyphPoints glyphPoints)This action sets the Bezier curve glyph points 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(text character)

This action returns the character code 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
                CharacterMap map
                output map:GetCharacterCode("a")
            end 
        end

Parameters

Return

integer: Returns the character code, normally in UNICODE, of the character.

GetGlyph(text character)

This action returns the glyph of the given character.

Example Code

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

        class Main is Game
            action Main
                StartGame()
            end

            action CreateGame
                CharacterMap map
                Glyph glyph = map:GetGlyph("a")
            end
        end

Parameters

Return

Libraries.Game.Graphics.Glyph: Returns the glyph of the character.

GetGlyphIndex(text character)

This action returns the location of the character in the glyph table from the font file.

Example Code

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

        class Main is Game
            action Main
                StartGame()
            end

            action CreateGame
                CharacterMap map
                output map:GetGlyphIndex("a")
            end
        end

Parameters

Return

integer: Returns the location of the character in the glyph table.

GetGlyphPoints(text character)

This action returns the Bezier curve glyph points of the given character.

Example Code

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

        class Main is Game
            action Main
                StartGame()
            end

            action CreateGame
                CharacterMap map
                BezierCurveGlyphPoints points = map:GetGlyphPoints("a")
            end
        end

Parameters

Return

Libraries.Game.Graphics.Fonts.BezierCurveGlyphPoints: Returns the Bezier curve glyph points of the character.

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(text character)

This action checks if the given character's Bezier curve glyph points have already 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
                CharacterMap map
                output map:GlyphPointsHaveBeenRead("a")
            end
        end

Parameters

Return

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

HasGlyph(text character)

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

Example Code

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

        class Main is Game
            action Main
                StartGame()
            end

            action CreateGame
                CharacterMap map
                output map:HasGlyph("a")
            end
        end

Parameters

Return

boolean: Returns true if there is a glyph for this character, and false if there is not.

HasKey(text character)

This action returns whether or not the given character is in the character table.

Example Code

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

        class Main is Game
            action Main
                StartGame()
            end

            action CreateGame
                CharacterMap map
                output map:HasKey("a")
            end
        end

Parameters

Return

boolean: Returns true if the character is in the character table, and false if it is not.

SetGlyph(text character, Libraries.Game.Graphics.Glyph glyph)

This action sets the glyph of a given character.

Example Code

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

        class Main is Game
            action Main
                StartGame()
            end

            action CreateGame
                CharacterMap map
                Glyph glyph
                map:SetGlyph("a", glyph)
            end
        end

Parameters

SetGlyphIndexAndOffset(text character, integer glyphIndex, integer glyphOffset)

This action sets the index of the character in the font file's glyph offset location table, and the character's offset in 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
                CharacterMap map
                map:SetGlyphIndexAndOffset("a", 0, 0)
            end
        end

Parameters

SetGlyphPoints(text character, Libraries.Game.Graphics.Fonts.BezierCurveGlyphPoints glyphPoints)

This action sets 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
                CharacterMap map
                BezierCurveGlyphPoints glyphPoints
                map:SetGlyphPoints("a", glyphPoints)
            end
        end

Parameters