KerningTable
Package: Libraries.Game.Graphics.Fonts · Inherits from: Libraries.Language.Object
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
Actions
Add(integer leftCharacterGlyphIndex, integer rightCharacterGlyphIndex, integer kerningValue)
This action adds the kerning value between two characters to the kerning table.
Parameters
leftCharacterGlyphIndexinteger: The glyph table index of the left-side character of the pair.rightCharacterGlyphIndexinteger: The glyph table index of the right-side character of the pair.kerningValueinteger: 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
GetKerningValue(integer leftCharacterGlyphIndex, integer rightCharacterGlyphIndex)
This action returns the kerning value between the two given characters.
Parameters
leftCharacterGlyphIndexinteger: The glyph table index of the left-side character of the pair.rightCharacterGlyphIndexinteger: The glyph table index of the right-side character of the pair.
Returns
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
leftCharacterGlyphIndexinteger: The glyph table index of the left-side character of the pair.rightCharacterGlyphIndexinteger: The glyph table index of the right-side character of the pair.
Returns
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