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

Actions Documentation

Add(integer leftCharacterGlyphIndex, integer rightCharacterGlyphIndex, integer kerningValue)

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

Parameters

  • integer leftCharacterGlyphIndex: The glyph table index of the left-side character of the pair.
  • integer rightCharacterGlyphIndex: The glyph table index of the right-side character of the pair.
  • integer kerningValue: The kerning value between the two characters.

Example

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

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)

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

GetKerningValue(integer leftCharacterGlyphIndex, integer rightCharacterGlyphIndex)

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

Parameters

  • integer leftCharacterGlyphIndex: The glyph table index of the left-side character of the pair.
  • integer rightCharacterGlyphIndex: The glyph table index of the right-side character of the pair.

Return

integer: Returns the kerning value between the two characters.

Example

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

HasPair(integer leftCharacterGlyphIndex, integer rightCharacterGlyphIndex)

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

Parameters

  • integer leftCharacterGlyphIndex: The glyph table index of the left-side character of the pair.
  • integer rightCharacterGlyphIndex: The glyph table index of the right-side character of the pair.

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.

Example

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