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

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)

GetCharacterCode()

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

Return

integer: Returns the character code of the character.

Example

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

GetGlyph()

This action returns the glyph for a given character.

Return

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

Example

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

GetGlyphLocationTableIndex()

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

Return

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

Example

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

GetGlyphPoints()

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

Return

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

Example

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

GetGlyphTableOffset()

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

Return

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

Example

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

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

GlyphPointsHaveBeenRead()

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

Return

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

Example

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

HasGlyph()

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

Return

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

Example

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

SetCharacterCode(integer charCode)

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

Parameters

  • integer charCode: The numeric code, normally in UNICODE, for the character.

Example

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

SetGlyph(Libraries.Game.Graphics.Glyph glyph)

This actions sets the glyph for a given character.

Parameters

Example

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

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.

Parameters

  • integer glyphIndex: The location of the glyph within the table.
  • integer glyphOffset: The location of the glyph table within the file.

Example

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

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

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

Parameters

Example

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