Libraries.Game.Graphics.Fonts.NameRecord Documentation

The NameRecord class is used to store human-readable information about a font file. Each font file has a "name" table, and this table contains text that describes the file. This includes the platform the font should be used on, the encoding of the text, the language the text is in, and then the text itself. This class is used in the font file reading process and should not typically be used directly. For a detailed explanation of the "name" table, including the variables of the table and how it is structured, see Microsoft's TrueType/OpenType documentation.

Example Code

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

class Main is Game
    action Main
        StartGame()
    end

    action CreateGame
        NameRecord record
        record:SetFileFormat(0)
        record:SetNumberOfNameRecords(2)
        record:SetFontStyleName("Bold")
    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)

GetFileFormat()

This action returns the format of the name table.

Return

integer: Returns the format of the name table.

Example

use Libraries.Game.Graphics.Fonts.all
use Libraries.Game.Game
    
class Main is Game
    action Main
        StartGame()
    end

    action CreateGame
        NameRecord record
        output record:GetFileFormat()
    end
end

GetFontStyleName()

This action returns the name of the style for the font, such as bold.

Return

text: Returns the name of the style for the font.

Example

use Libraries.Game.Graphics.Fonts.all
use Libraries.Game.Game
    
class Main is Game
    action Main
        StartGame()
    end

    action CreateGame
        NameRecord record
        output record:GetFontStyleName()
    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()

GetLanguageID()

This action returns the language ID of the name record.

Return

integer: Returns the language ID of the name record.

Example

use Libraries.Game.Graphics.Fonts.all
use Libraries.Game.Game
    
class Main is Game
    action Main
        StartGame()
    end

    action CreateGame
        NameRecord record
        output record:GetLanguageID()
    end
end

GetNameID()

This action returns the name ID of the name record.

Return

integer: Returns the name ID of the name record.

Example

use Libraries.Game.Graphics.Fonts.all
use Libraries.Game.Game
    
class Main is Game
    action Main
        StartGame()
    end

    action CreateGame
        NameRecord record
        output record:GetNameID()
    end
end

GetNumberOfNameRecords()

This action returns the number of name records in the font file.

Return

integer: Returns the number of name records in the font file.

Example

use Libraries.Game.Graphics.Fonts.all
use Libraries.Game.Game
    
class Main is Game
    action Main
        StartGame()
    end

    action CreateGame
        NameRecord record
        output record:GetNumberOfNameRecords()
    end
end

GetOffsetToWord()

This action returns the offset to the name record from the start of the name records in the name table.

Return

integer: Returns the offset to the name record.

Example

use Libraries.Game.Graphics.Fonts.all
use Libraries.Game.Game
    
class Main is Game
    action Main
        StartGame()
    end

    action CreateGame
        NameRecord record
        output record:GetOffsetToWord()
    end
end

GetPlatFormSpecificID()

This action returns the encoding ID of the name record.

Return

integer: Returns the encoding ID of the name record.

Example

use Libraries.Game.Graphics.Fonts.all
use Libraries.Game.Game
    
class Main is Game
    action Main
        StartGame()
    end

    action CreateGame
        NameRecord record
        output record:GetPlatFormSpecificID()
    end
end

GetPlatformID()

This action returns the platform ID of the name record.

Return

integer: Returns the platform ID of the name record.

Example

use Libraries.Game.Graphics.Fonts.all
use Libraries.Game.Game
    
class Main is Game
    action Main
        StartGame()
    end

    action CreateGame
        NameRecord record
        output record:GetPlatformID()
    end
end

GetStringOffset()

This action returns the offset needed to access the start of the name record portion of the name table.

Return

integer: Returns the offset to the start of the name record portion of the name table.

Example

use Libraries.Game.Graphics.Fonts.all
use Libraries.Game.Game
    
class Main is Game
    action Main
        StartGame()
    end

    action CreateGame
        NameRecord record
        output record:GetStringOffset()
    end
end

GetWordLength()

This action returns the length of the name record.

Return

integer: Returns the length of the name record.

Example

use Libraries.Game.Graphics.Fonts.all
use Libraries.Game.Game
    
class Main is Game
    action Main
        StartGame()
    end

    action CreateGame
        NameRecord record
        output record:GetWordLength()
    end
end

SetFileFormat(integer value)

This action sets the format of the name table.

Parameters

  • integer value: The format of the name table.

Example

use Libraries.Game.Graphics.Fonts.all
use Libraries.Game.Game
    
class Main is Game
    action Main
        StartGame()
    end

    action CreateGame
        NameRecord record
        record:SetFileFormat(1)
    end
end

SetFontStyleName(text name)

This action sets the name of the style for the font, such as bold.

Parameters

  • text name: The name of the style for the font.

Example

use Libraries.Game.Graphics.Fonts.all
use Libraries.Game.Game
    
class Main is Game
    action Main
        StartGame()
    end

    action CreateGame
        NameRecord record
        record:SetFontStyleName("Bold")
    end
end

SetLanguageID(integer id)

This action sets the language ID of the name record.

Parameters

  • integer id: The language ID of the name record.

Example

use Libraries.Game.Graphics.Fonts.all
use Libraries.Game.Game
    
class Main is Game
    action Main
        StartGame()
    end

    action CreateGame
        NameRecord record
        record:SetLanguageID(0)
    end
end

SetNameID(integer id)

This action sets the name ID of the name record.

Parameters

  • integer id: The name ID of the name record.

Example

use Libraries.Game.Graphics.Fonts.all
use Libraries.Game.Game
    
class Main is Game
    action Main
        StartGame()
    end

    action CreateGame
        NameRecord record
        record:SetNameID(2)
    end
end

SetNumberOfNameRecords(integer count)

This action sets the number of name records in the font file.

Parameters

  • integer count: The number of name records in the font file.

Example

use Libraries.Game.Graphics.Fonts.all
use Libraries.Game.Game
    
class Main is Game
    action Main
        StartGame()
    end

    action CreateGame
        NameRecord record
        record:SetNumberOfNameRecords(10)
    end
end

SetOffsetToWord(integer offset)

This action sets the offset to the name record from the start of the name records in the name table.

Parameters

  • integer offset: The offset to the name record.

Example

use Libraries.Game.Graphics.Fonts.all
use Libraries.Game.Game
    
class Main is Game
    action Main
        StartGame()
    end

    action CreateGame
        NameRecord record
        record:SetOffsetToWord(500)
    end
end

SetPlatformID(integer id)

This action sets the platform ID of the name record.

Parameters

  • integer id: The platform ID of the name record.

Example

use Libraries.Game.Graphics.Fonts.all
use Libraries.Game.Game
    
class Main is Game
    action Main
        StartGame()
    end

    action CreateGame
        NameRecord record
        record:SetPlatformID(0)
    end
end

SetPlatformSpecificID(integer id)

This action sets the encoding ID of the name record.

Parameters

  • integer id: The encoding ID of the name record.

Example

use Libraries.Game.Graphics.Fonts.all
use Libraries.Game.Game
    
class Main is Game
    action Main
        StartGame()
    end

    action CreateGame
        NameRecord record
        record:SetPlatformSpecificID(0)
    end
end

SetStringOffset(integer offset)

This action sets the offset needed to access the start of the name record portion of the name table.

Parameters

  • integer offset: The offset to the start of the name record portion of the name table.

Example

use Libraries.Game.Graphics.Fonts.all
use Libraries.Game.Game
    
class Main is Game
    action Main
        StartGame()
    end

    action CreateGame
        NameRecord record
        record:SetStringOffset(500)
    end
end

SetWordLength(integer length)

This action sets the length of the name record.

Parameters

  • integer length: The length of the name record.

Example

use Libraries.Game.Graphics.Fonts.all
use Libraries.Game.Game
    
class Main is Game
    action Main
        StartGame()
    end

    action CreateGame
        NameRecord record
        record:SetWordLength(10)
    end
end