Libraries.Game.Graphics.Fonts.TrueTypeCollectionData Documentation
The TrueTypeCollectionData class maintains all of the relevant information needed to access individual fonts within TrueTypeCollection (.ttc) font files. This is primarily indecies to the various font tables (head, glyf, and so on) for the fonts, but also some global font file information. Since .ttc files store multiple fonts in the file, maintaining this information allows us to swap between different styles, such as bold and italic, by just changing the corresponding TrueTypeFileInformation values to those stored here. This avoids having to reread the font file when changing styles.
Example Code
use Libraries.Game.Game
use Libraries.Game.Graphics.Fonts.all
class Main is Game
action Main
StartGame()
end
action CreateGame
TrueTypeFileInformation fileInformation
TrueTypeCollectionData data
data:SetAllTrueTypeInformation(fileInformation)
end
end
Inherits from: Libraries.Language.Object
Summary
Actions Summary Table
Actions | Description |
---|---|
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. |
GetCharacterMapFormat() | This action returns the format that the character map table is in. |
GetCharacterMapTablePosition() | This action returns the offset needed to access the character map table. |
GetEntrySelector() | This action returns the index of the current entry in the table being read from. |
GetFontDirectionHint() | This action returns the direction to adjust pixels when performing hinting. |
GetGlyphDataLocationTablePosition() | This action returns the offset needed to access the glyph data table. |
GetGlyphOutlineTablePosition() | This action returns the offset needed to access the glyph outline table. |
GetHashCode() | This action gets the hash code for an object. |
GetHorizontalHeaderTablePosition() | This action returns the offset needed to access the horizontal header table. |
GetIndexToLocationTableFormat() | This action returns the format of the indecies used to access the location table. |
GetKerningSubtablePosition() | This action returns the offset needed to access the kerning table. |
GetKerningValuesTablePosition() | This action returns the offset needed to access the kerning values table. |
GetLineGap() | This action returns the line gap value to use when creating space between two lines of text. |
GetLowestRecommendedPixelsPerEm() | This action returns the lowest recommended pixels per EM of the font. |
GetMaximumAscent() | This action returns the maximum ascent, the distance from the baseline of the font to the highest point of the tallest glyph of the font, of the font, in pixels. |
GetMaximumDescent() | This action returns the maximum descent, the distance from the baseline of the font to the lowest point of the lowest glyph of the font, of the font, in pixels. |
GetNameRecords() | This action returns the array of NameRecords for the font. |
GetNumberOfTables() | This action returns the number of tables for the font. |
GetRangeShift() | This action returns the value that each index of the table needs to be increased by to get the next index. |
GetScalerType() | This action returns the scaler type for the font. |
GetSearchRange() | This action returns the maximum index range for reading a table of the font. |
GetUnitsPerEm() | This action returns the units per EM of the font. |
GetXMaximum() | This action returns the rightmost x-coordinate position of the font; no glyph in the font should be farther to the right than this point. |
GetXMinimum() | This action returns the leftmost x-coordinate position of the font; no glyph in the font should be father left than this point. |
GetYMaximum() | This action returns the uppermost y-coordinate position of the font; no glyph in the font should be above this point. |
GetYMinimum() | This action returns the lowermost y-coordinate position of the font; no glyph in the font should be below this point. |
SetAllTrueTypeInformation(Libraries.Game.Graphics.Fonts.TrueTypeFileInformation information) | This action sets all of the font information using a TrueTypeFileInformation 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.
Example Code
Object o
Object t
integer result = o:Compare(t) //1 (larger), 0 (equal), or -1 (smaller)
Parameters
- Libraries.Language.Object: The object to compare to.
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
- Libraries.Language.Object: The to be compared.
Return
boolean: True if the hash codes are equal and false if they are not equal.
GetCharacterMapFormat()
This action returns the format that the character map table is in.
Example Code
use Libraries.Game.Game
use Libraries.Game.Graphics.Fonts.all
class Main is Game
action Main
StartGame()
end
action CreateGame
TrueTypeCollectionData data
output data:GetCharacterMapFormat()
end
end
Return
integer: Returns the format that the character map table is in.
GetCharacterMapTablePosition()
This action returns the offset needed to access the character map table.
Example Code
use Libraries.Game.Game
use Libraries.Game.Graphics.Fonts.all
class Main is Game
action Main
StartGame()
end
action CreateGame
TrueTypeCollectionData data
output data:GetCharacterMapTablPosition()
end
end
Return
integer: Returns the offset needed to access the character map table.
GetEntrySelector()
This action returns the index of the current entry in the table being read from.
Example Code
use Libraries.Game.Game
use Libraries.Game.Graphics.Fonts.all
class Main is Game
action Main
StartGame()
end
action CreateGame
TrueTypeCollectionData data
output data:GetEntrySelector()
end
end
Return
integer: Returns the index of the current entry in the table.
GetFontDirectionHint()
This action returns the direction to adjust pixels when performing hinting.
Example Code
use Libraries.Game.Graphics.Fonts.all
use Libraries.Game.Game
class Main is Game
action Main
StartGame()
end
action CreateGame
TrueTypeCollectionData information
output information:GetFontDirectionHint()
end
end
Return
integer: Returns the direction to adjust pixels when performing hinting.
GetGlyphDataLocationTablePosition()
This action returns the offset needed to access the glyph data table.
Example Code
use Libraries.Game.Game
use Libraries.Game.Graphics.Fonts.all
class Main is Game
action Main
StartGame()
end
action CreateGame
TrueTypeCollectionData data
output data:GetGlyphDataLocationTablePosition()
end
end
Return
integer: Returns the offset needed to access the glyph data table.
GetGlyphOutlineTablePosition()
This action returns the offset needed to access the glyph outline table.
Example Code
use Libraries.Game.Game
use Libraries.Game.Graphics.Fonts.all
class Main is Game
action Main
StartGame()
end
action CreateGame
TrueTypeCollectionData data
output data:GetGlyphOutlineTablePosition()
end
end
Return
integer: Returns the offset needed to access the glyph outline table.
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.
GetHorizontalHeaderTablePosition()
This action returns the offset needed to access the horizontal header table.
Example Code
use Libraries.Game.Game
use Libraries.Game.Graphics.Fonts.all
class Main is Game
action Main
StartGame()
end
action CreateGame
TrueTypeCollectionData data
output data:GetHorizontalHeaderTablePosition()
end
end
Return
integer: Returns the offset needed to access the horizontal header table.
GetIndexToLocationTableFormat()
This action returns the format of the indecies used to access the location table.
Example Code
use Libraries.Game.Graphics.Fonts.all
use Libraries.Game.Game
class Main is Game
action Main
StartGame()
end
action CreateGame
TrueTypeCollectionData information
output information:GetIndexToLocationTableFormat()
end
end
Return
integer: Returns the format of the indecies used to access the location table.
GetKerningSubtablePosition()
This action returns the offset needed to access the kerning table.
Example Code
use Libraries.Game.Game
use Libraries.Game.Graphics.Fonts.all
class Main is Game
action Main
StartGame()
end
action CreateGame
TrueTypeCollectionData data
output data:GetKerningSubtablePosition()
end
end
Return
integer: Returns the offset needed to access the kerning table.
GetKerningValuesTablePosition()
This action returns the offset needed to access the kerning values table.
Example Code
use Libraries.Game.Game
use Libraries.Game.Graphics.Fonts.all
class Main is Game
action Main
StartGame()
end
action CreateGame
TrueTypeCollectionData data
output data:GetKerningValuesTablePosition()
end
end
Return
integer: Returns the offset needed to access the kerning values table.
GetLineGap()
This action returns the line gap value to use when creating space between two lines of text.
Example Code
use Libraries.Game.Graphics.Fonts.all
use Libraries.Game.Game
class Main is Game
action Main
StartGame()
end
action CreateGame
TrueTypeCollectionData information
information:GetLineGap()
end
end
Return
integer: Returns the line gap value to use when creating space between two lines of text.
GetLowestRecommendedPixelsPerEm()
This action returns the lowest recommended pixels per EM of the font.
Example Code
use Libraries.Game.Graphics.Fonts.all
use Libraries.Game.Game
class Main is Game
action Main
StartGame()
end
action CreateGame
TrueTypeCollectionData information
output information:GetLowestRecommendedPixelsPerEm()
end
end
Return
integer: Returns the lowest recommended pixels per EM of the font.
GetMaximumAscent()
This action returns the maximum ascent, the distance from the baseline of the font to the highest point of the tallest glyph of the font, of the font, in pixels.
Example Code
use Libraries.Game.Graphics.Fonts.all
use Libraries.Game.Game
class Main is Game
action Main
StartGame()
end
action CreateGame
TrueTypeCollectionData information
output information:GetMaximumAscent()
end
end
Return
integer: Returns the maximum ascent of the font, in pixels.
GetMaximumDescent()
This action returns the maximum descent, the distance from the baseline of the font to the lowest point of the lowest glyph of the font, of the font, in pixels.
Example Code
use Libraries.Game.Graphics.Fonts.all
use Libraries.Game.Game
class Main is Game
action Main
StartGame()
end
action CreateGame
TrueTypeCollectionData information
output information:GetMaximumDescent()
end
end
Return
integer: Returns the maximum descent of the font, in pixels.
GetNameRecords()
This action returns the array of NameRecords for the font.
Example Code
use Libraries.Game.Game
use Libraries.Game.Graphics.Fonts.all
use Libraries.Containers.Array
class Main is Game
action Main
StartGame()
end
action CreateGame
TrueTypeCollectionData data
Array<NameRecord> records = data:GetNameRecords()
end
end
Return
Libraries.Containers.Array: Returns the array of NameRecords for the font.
GetNumberOfTables()
This action returns the number of tables for the font.
Example Code
use Libraries.Game.Game
use Libraries.Game.Graphics.Fonts.all
class Main is Game
action Main
StartGame()
end
action CreateGame
TrueTypeCollectionData data
output data:GetNumberOfTables()
end
end
Return
integer: Returns the number of tables for the font.
GetRangeShift()
This action returns the value that each index of the table needs to be increased by to get the next index.
Example Code
use Libraries.Game.Game
use Libraries.Game.Graphics.Fonts.all
class Main is Game
action Main
StartGame()
end
action CreateGame
TrueTypeCollectionData data
output data:GetRangeShift()
end
end
Return
integer: Returns the value to adjust the index by.
GetScalerType()
This action returns the scaler type for the font.
Example Code
use Libraries.Game.Game
use Libraries.Game.Graphics.Fonts.all
class Main is Game
action Main
StartGame()
end
action CreateGame
TrueTypeCollectionData data
output data:GetScalerType()
end
end
Return
integer: Returns the scaler type for the font.
GetSearchRange()
This action returns the maximum index range for reading a table of the font.
Example Code
use Libraries.Game.Game
use Libraries.Game.Graphics.Fonts.all
class Main is Game
action Main
StartGame()
end
action CreateGame
TrueTypeCollectionData data
output data:GetSearchRange()
end
end
Return
integer: Returns the maximum index range for reading a table of the font.
GetUnitsPerEm()
This action returns the units per EM of the font.
Example Code
use Libraries.Game.Game
use Libraries.Game.Graphics.Fonts.all
class Main is Game
action Main
StartGame()
end
action CreateGame
TrueTypeCollectionData data
output data:GetUnitsPerEm()
end
end
Return
integer: Returns the units per EM of the font.
GetXMaximum()
This action returns the rightmost x-coordinate position of the font; no glyph in the font should be farther to the right than this point.
Example Code
use Libraries.Game.Graphics.Fonts.all
use Libraries.Game.Game
class Main is Game
action Main
StartGame()
end
action CreateGame
TrueTypeCollectionData information
Signed16BitFontUnit fontUnit
fontUnit = information:GetXMaximum()
end
end
Return
Libraries.Game.Graphics.Fonts.Signed16BitFontUnit: Returns the rightmost x-coordinate position of the font.
GetXMinimum()
This action returns the leftmost x-coordinate position of the font; no glyph in the font should be father left than this point.
Example Code
use Libraries.Game.Graphics.Fonts.all
use Libraries.Game.Game
class Main is Game
action Main
StartGame()
end
action CreateGame
TrueTypeCollectionData information
Signed16BitFontUnit fontUnit
fontUnit = information:GetXMinimum()
end
end
Return
Libraries.Game.Graphics.Fonts.Signed16BitFontUnit: Returns the leftmost x-coordinate position of the font.
GetYMaximum()
This action returns the uppermost y-coordinate position of the font; no glyph in the font should be above this point.
Example Code
use Libraries.Game.Graphics.Fonts.all
use Libraries.Game.Game
class Main is Game
action Main
StartGame()
end
action CreateGame
TrueTypeCollectionData information
Signed16BitFontUnit fontUnit
fontUnit = information:GetYMaximum()
end
end
Return
Libraries.Game.Graphics.Fonts.Signed16BitFontUnit: Returns the uppermost y-coordinate position of the font.
GetYMinimum()
This action returns the lowermost y-coordinate position of the font; no glyph in the font should be below this point.
Example Code
use Libraries.Game.Graphics.Fonts.all
use Libraries.Game.Game
class Main is Game
action Main
StartGame()
end
action CreateGame
TrueTypeCollectionData information
Signed16BitFontUnit fontUnit
fontUnit = information:GetYMinimum()
end
end
Return
Libraries.Game.Graphics.Fonts.Signed16BitFontUnit: Returns the lowermost y-coordinate position of the font.
SetAllTrueTypeInformation(Libraries.Game.Graphics.Fonts.TrueTypeFileInformation information)
This action sets all of the font information using a TrueTypeFileInformation object. This is primarily used when dealing with TrueTypeCollection (.ttc) format font files and you need to swap between different styles for the font. Rather than reloading and rereading the font, we store all of the appropriate information for each font style and just swap out the values as they are needed.
Example Code
use Libraries.Game.Graphics.Fonts.all
use Libraries.Game.Game
class Main is Game
action Main
StartGame()
end
action CreateGame
TrueTypeFileInformation information
TrueTypeCollectionData data
data:SetAllTrueTypeInformation(information)
end
end
Parameters
- Libraries.Game.Graphics.Fonts.TrueTypeFileInformation: The TrueTypeFileInformation to use for copying values into this font data.