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

Summary

Actions Summary Table

ActionsDescription
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.
GetFileFormat()This action returns the format of the name table.
GetFontStyleName()This action returns the name of the style for the font, such as bold.
GetHashCode()This action gets the hash code for an object.
GetLanguageID()This action returns the language ID of the name record.
GetNameID()This action returns the name ID of the name record.
GetNumberOfNameRecords()This action returns the number of name records in the font file.
GetOffsetToWord()This action returns the offset to the name record from the start of the name records in the name table.
GetPlatFormSpecificID()This action returns the encoding ID of the name record.
GetPlatformID()This action returns the platform ID of the name record.
GetStringOffset()This action returns the offset needed to access the start of the name record portion of the name table.
GetWordLength()This action returns the length of the name record.
SetFileFormat(integer value)This action sets the format of the name table.
SetFontStyleName(text name)This action sets the name of the style for the font, such as bold.
SetLanguageID(integer id)This action sets the language ID of the name record.
SetNameID(integer id)This action sets the name ID of the name record.
SetNumberOfNameRecords(integer count)This action sets the number of name records in the font file.
SetOffsetToWord(integer offset)This action sets the offset to the name record from the start of the name records in the name table.
SetPlatformID(integer id)This action sets the platform ID of the name record.
SetPlatformSpecificID(integer id)This action sets the encoding ID of the name record.
SetStringOffset(integer offset)This action sets the offset needed to access the start of the name record portion of the name table.
SetWordLength(integer length)This action sets the length of the name record.

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

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

Return

boolean: True if the hash codes are equal and false if they are not equal.

GetFileFormat()

This action returns the format of the name table.

Example Code

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

Return

integer: Returns the format of the name table.

GetFontStyleName()

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

Example Code

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

Return

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

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.

GetLanguageID()

This action returns the language ID of the name record.

Example Code

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

Return

integer: Returns the language ID of the name record.

GetNameID()

This action returns the name ID of the name record.

Example Code

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

Return

integer: Returns the name ID of the name record.

GetNumberOfNameRecords()

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

Example Code

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

Return

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

GetOffsetToWord()

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

Example Code

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

Return

integer: Returns the offset to the name record.

GetPlatFormSpecificID()

This action returns the encoding ID of the name record.

Example Code

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

Return

integer: Returns the encoding ID of the name record.

GetPlatformID()

This action returns the platform ID of the name record.

Example Code

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

Return

integer: Returns the platform ID of the name record.

GetStringOffset()

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

Example Code

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

Return

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

GetWordLength()

This action returns the length of the name record.

Example Code

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

Return

integer: Returns the length of the name record.

SetFileFormat(integer value)

This action sets the format of the name table.

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

Parameters

SetFontStyleName(text name)

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

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:SetFontStyleName("Bold")
            end
        end

Parameters

SetLanguageID(integer id)

This action sets the language ID of the name record.

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:SetLanguageID(0)
            end
        end

Parameters

SetNameID(integer id)

This action sets the name ID of the name record.

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:SetNameID(2)
            end
        end

Parameters

SetNumberOfNameRecords(integer count)

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

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:SetNumberOfNameRecords(10)
            end
        end

Parameters

SetOffsetToWord(integer offset)

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

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:SetOffsetToWord(500)
            end
        end

Parameters

SetPlatformID(integer id)

This action sets the platform ID of the name record.

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:SetPlatformID(0)
            end
        end

Parameters

SetPlatformSpecificID(integer id)

This action sets the encoding ID of the name record.

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:SetPlatformSpecificID(0)
            end
        end

Parameters

SetStringOffset(integer offset)

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

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:SetStringOffset(500)
            end
        end

Parameters

SetWordLength(integer length)

This action sets the length of the name record.

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:SetWordLength(10)
            end
        end

Parameters