Libraries.Game.Graphics.Fonts.KerningValuesList Documentation

The KerningValuesList class maintains a hash table which maps a right-hand character to a kerning value. This hash table is mapped to a given left-hand character in the KerningTable class.

Example Code

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

class Main is Game
    action Main
        StartGame()
    end 

    action CreateGame
        KerningValuesList values
        // Gets the kerning value of the glyph at glyph table index 0
        output values:GetKerningValue(0)
    end
end

Inherits from: Libraries.Language.Object

Actions Documentation

Add(integer rightCharacterGlyphIndex, integer kerningValue)

This action adds the kerning value of the right-hand character to the hash table.

Parameters

  • integer rightCharacterGlyphIndex: The glyph table index of the right-hand character of the pair.
  • integer kerningValue: The kerning value of the character pair.

Example

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

class Main is Game
    action Main
        StartGame()
    end

    action CreateGame
        KerningValuesList values
        // Adds a kerning value of 10 to the glyph at glyph table index 0
        // to the hash table.
        values:Add(0, 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 rightCharacterGlyphIndex)

This action returns the kerning value for the character at the given glyph table index.

Parameters

  • integer rightCharacterGlyphIndex: The glyph table index of the right-hand character of the pair.

Return

integer: Returns the kerning value for the characters.

Example

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

class Main is Game
    action Main
        StartGame()
    end

    action CreateGame
        KerningValuesList values
        output values:GetKerningValue(0)
    end
end

HasKey(integer rightCharacterGlyphIndex)

This action checks if the kerning value table contains a kerning value for the given right-hand character.

Parameters

  • integer rightCharacterGlyphIndex: The glyph table index of the right-hand character of the pair.

Return

boolean: Returns true if there is a kerning value for the given character, 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
        KerningValuesList values
        output values:HasKey(0)
    end
end