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

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.

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)

GetCharacterMapFormat()

This action returns the format that the character map table is in.

Return

integer: Returns the format that the character map table is in.

Example

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

GetCharacterMapTablePosition()

This action returns the offset needed to access the character map table.

Return

integer: Returns the offset needed to access the character map table.

Example

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

GetEntrySelector()

This action returns the index of the current entry in the table being read from.

Return

integer: Returns the index of the current entry in the table.

Example

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

GetFontDirectionHint()

This action returns the direction to adjust pixels when performing hinting.

Return

integer: Returns the direction to adjust pixels when performing hinting.

Example

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

GetGlyphDataLocationTablePosition()

This action returns the offset needed to access the glyph data table.

Return

integer: Returns the offset needed to access the glyph data table.

Example

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

GetGlyphOutlineTablePosition()

This action returns the offset needed to access the glyph outline table.

Return

integer: Returns the offset needed to access the glyph outline table.

Example

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

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

GetHorizontalHeaderTablePosition()

This action returns the offset needed to access the horizontal header table.

Return

integer: Returns the offset needed to access the horizontal header table.

Example

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

GetIndexToLocationTableFormat()

This action returns the format of the indecies used to access the location table.

Return

integer: Returns the format of the indecies used to access the location table.

Example

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

GetKerningSubtablePosition()

This action returns the offset needed to access the kerning table.

Return

integer: Returns the offset needed to access the kerning table.

Example

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

GetKerningValuesTablePosition()

This action returns the offset needed to access the kerning values table.

Return

integer: Returns the offset needed to access the kerning values table.

Example

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

GetLineGap()

This action returns the line gap value to use when creating space between two lines of text.

Return

integer: Returns the line gap value to use when creating space between two lines of text.

Example

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

GetLowestRecommendedPixelsPerEm()

This action returns the lowest recommended pixels per EM of the font.

Return

integer: Returns the lowest recommended pixels per EM of the font.

Example

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

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.

Return

integer: Returns the maximum ascent of the font, in pixels.

Example

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

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.

Return

integer: Returns the maximum descent of the font, in pixels.

Example

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

GetNameRecords()

This action returns the array of NameRecords for the font.

Return

Libraries.Containers.Array: Returns the array of NameRecords for the font.

Example

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

GetNumberOfTables()

This action returns the number of tables for the font.

Return

integer: Returns the number of tables for the font.

Example

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

GetRangeShift()

This action returns the value that each index of the table needs to be increased by to get the next index.

Return

integer: Returns the value to adjust the index by.

Example

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

GetScalerType()

This action returns the scaler type for the font.

Return

integer: Returns the scaler type for the font.

Example

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

GetSearchRange()

This action returns the maximum index range for reading a table of the font.

Return

integer: Returns the maximum index range for reading a table of the font.

Example

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

GetUnitsPerEm()

This action returns the units per EM of the font.

Return

integer: Returns the units per EM of the font.

Example

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

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.

Return

Libraries.Game.Graphics.Fonts.Signed16BitFontUnit: Returns the rightmost x-coordinate position of the font.

Example

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

GetXMinimum()

This action returns the leftmost x-coordinate position of the font; no glyph in the font should be father left than this point.

Return

Libraries.Game.Graphics.Fonts.Signed16BitFontUnit: Returns the leftmost x-coordinate position of the font.

Example

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

GetYMaximum()

This action returns the uppermost y-coordinate position of the font; no glyph in the font should be above this point.

Return

Libraries.Game.Graphics.Fonts.Signed16BitFontUnit: Returns the uppermost y-coordinate position of the font.

Example

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

GetYMinimum()

This action returns the lowermost y-coordinate position of the font; no glyph in the font should be below this point.

Return

Libraries.Game.Graphics.Fonts.Signed16BitFontUnit: Returns the lowermost y-coordinate position of the font.

Example

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

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.

Parameters

Example

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