Libraries.Game.Graphics.Fonts.KerningTable Documentation

The KerningTable class is used to store and lookup kerning values for a font.

Example Code

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

    class Main is Game
        action Main
            StartGame()
        end

        action CreateGame
            KerningTable kerningTable
            // Sets the kerning value between the characters indexed at 0 and 1
            // in the glyph table to 10.
            kerningTable:Add(0, 1, 10)
        end
    end

Inherits from: Libraries.Language.Object

Summary

Actions Summary Table

ActionsDescription
Add(integer leftCharacterGlyphIndex, integer rightCharacterGlyphIndex, integer kerningValue)This action adds the kerning value between two characters to the kerning table.
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.
GetHashCode()This action gets the hash code for an object.
GetKerningValue(integer leftCharacterGlyphIndex, integer rightCharacterGlyphIndex)This action returns the kerning value between the two given characters.
HasPair(integer leftCharacterGlyphIndex, integer rightCharacterGlyphIndex)This action checks if the kerning table has a kerning value for the given pair of characters.

Actions Documentation

Add(integer leftCharacterGlyphIndex, integer rightCharacterGlyphIndex, integer kerningValue)

This action adds the kerning value between two characters to the kerning table.

Example Code

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

        class Main is Game
            action Main
                StartGame()
            end
            
            action CreateGame
                KerningTable kerningTable
                kerningTable:Add(0, 1, 10)
            end
        end

Parameters

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.

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.

GetKerningValue(integer leftCharacterGlyphIndex, integer rightCharacterGlyphIndex)

This action returns the kerning value between the two given characters.

Example Code

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

        class Main is Game
            action Main
                StartGame()
            end

            action CreateGame
                KerningTable kerningTable
                output kerningTable:GetKerningValue(0, 1)
            end
        end

Parameters

Return

integer: Returns the kerning value between the two characters.

HasPair(integer leftCharacterGlyphIndex, integer rightCharacterGlyphIndex)

This action checks if the kerning table has a kerning value for the given pair of characters.

Example Code

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

        class Main is Game
            action Main
                StartGame()
            end

            action CreateGame
                KerningTable kerningTable
                output kerningTable:HasPair(0, 1)
            end
        end

Parameters

Return

boolean: Returns true if there is a kerning value in the kerning table for this pair of characters, and false if there is not.