Libraries.Game.Graphics.Fonts.GlyphCoordinateFlag Documentation

The GlyphCoordinateFlag class is used to maintain information about points for a given character's glyph.

Example Code

use Libraries.Game.Graphics.Fonts.all
use Libraries.Game.Game
use Libraries.System.File
use Libraries.Containers.ByteArray
use Libraries.Containers.Support.ByteReader
use Libraries.System.BinaryFileReader

class Main is Game
    action Main
        StartGame()
    end

    action CreateGame
        File file
        ByteArray byteArray = undefined
        ByteReader byteReader = undefined
        FontFileReader reader
        // This is the directory for fonts on Mac
        file:SetWorkingDirectory("/Library/Fonts")
        file:SetPath("Arial.ttf")
        reader:Load(file)
        TrueTypeFileInformation fileInformation = reader:GetFileInformation()
        BinaryFileReader binaryReader
        binaryReader:OpenForRead(file)
        byteArray = binaryReader:ReadBytes()
        byteArray:SetBigEndian(true)
        byteReader = byteArray:GetByteReader()
        // This is assuming the current position of the byteReader is at the
        // right location. By default, it will not be. This will also need
        // to iterate over the total number of points for the glyph outline,
        // and add all of the information to an array of GlyphCoordinateFlags.
        integer flags = byteReader:NextByteAsUnsignedInteger()
        GlyphCoordinateFlag coordinateFlag
        coordinateFlag:SetFlags(flags)
    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)

DebugPrintBooleans()

This action prints to the screen the various boolean values of this class. Used for debugging and making sure the reading and setting of the flags is working correctly.

Example

use Libraries.Game.Graphics.Fonts.all
use Libraries.Game.Game
use Libraries.System.File
use Libraries.Containers.ByteArray
use Libraries.Containers.Support.ByteReader
use Libraries.System.BinaryFileReader

class Main is Game
    action Main
        StartGame()
    end

    action CreateGame
        File file
        ByteArray byteArray = undefined
        ByteReader byteReader = undefined
        FontFileReader reader
        // This is the directory for fonts on Mac
        file:SetWorkingDirectory("/Library/Fonts")
        file:SetPath("Arial.ttf")
        reader:Load(file)
        TrueTypeFileInformation fileInformation = reader:GetFileInformation()
        BinaryFileReader binaryReader
        binaryReader:OpenForRead(file)
        byteArray = binaryReader:ReadBytes()
        byteArray:SetBigEndian(true)
        byteReader = byteArray:GetByteReader()
        // This is assuming the current position of the byteReader is at the
        // right location. By default, it will not be. This will also need
        // to iterate over the total number of points for the glyph outline,
        // and add all of the information to an array of GlyphCoordinateFlags.
        integer flags = byteReader:NextByteAsUnsignedInteger()
        GlyphCoordinateFlag coordinateFlag
        coordinateFlag:SetFlags(flags)
        coordinateFlag:DebugPrintBooleans()
    end
end

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)

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

IsOnCurve()

This action returns whether or not a point is on the curve of a glyph.

Return

boolean: Returns true if the point is on the curve of a glyph, and flase if it is not.

Example

use Libraries.Game.Graphics.Fonts.all
use Libraries.Game.Game
use Libraries.System.File
use Libraries.Containers.ByteArray
use Libraries.Containers.Support.ByteReader
use Libraries.System.BinaryFileReader

class Main is Game
    action Main
        StartGame()
    end

    action CreateGame
        File file
        ByteArray byteArray = undefined
        ByteReader byteReader = undefined
        FontFileReader reader
        // This is the directory for fonts on Mac
        file:SetWorkingDirectory("/Library/Fonts")
        file:SetPath("Arial.ttf")
        reader:Load(file)
        TrueTypeFileInformation fileInformation = reader:GetFileInformation()
        BinaryFileReader binaryReader
        binaryReader:OpenForRead(file)
        byteArray = binaryReader:ReadBytes()
        byteArray:SetBigEndian(true)
        byteReader = byteArray:GetByteReader()
        // This is assuming the current position of the byteReader is at the
        // right location. By default, it will not be. This will also need
        // to iterate over the total number of points for the glyph outline,
        // and add all of the information to an array of GlyphCoordinateFlags.
        integer flags = byteReader:NextByteAsUnsignedInteger()
        GlyphCoordinateFlag coordinateFlag
        coordinateFlag:SetFlags(flags)
        output coordinateFlag:IsOnCurve()
    end
end

RepetitionIsTrue()

This action returns the value of the repetition variable. If it is true, then the flags that were set are to be repeated the next byte number of times for the next points on the glyph. If it is false, then the next point on the glyph has different flags than these flags.

Return

boolean: Returns true if these flags will repeat for the next point(s) and false if they will not.

Example

use Libraries.Game.Graphics.Fonts.all
use Libraries.Game.Game
use Libraries.System.File
use Libraries.Containers.ByteArray
use Libraries.Containers.Support.ByteReader
use Libraries.System.BinaryFileReader

class Main is Game
    action Main
        StartGame()
    end

    action CreateGame
        File file
        ByteArray byteArray = undefined
        ByteReader byteReader = undefined
        FontFileReader reader
        // This is the directory for fonts on Mac
        file:SetWorkingDirectory("/Library/Fonts")
        file:SetPath("Arial.ttf")
        reader:Load(file)
        TrueTypeFileInformation fileInformation = reader:GetFileInformation()
        BinaryFileReader binaryReader
        binaryReader:OpenForRead(file)
        byteArray = binaryReader:ReadBytes()
        byteArray:SetBigEndian(true)
        byteReader = byteArray:GetByteReader()
        // This is assuming the current position of the byteReader is at the
        // right location. By default, it will not be. This will also need
        // to iterate over the total number of points for the glyph outline,
        // and add all of the information to an array of GlyphCoordinateFlags.
        integer flags = byteReader:NextByteAsUnsignedInteger()
        GlyphCoordinateFlag coordinateFlag
        coordinateFlag:SetFlags(flags)
        output coordinateFlag:RepetitionIsTrue()
    end
end

SetFlags(integer flags)

This action sets the flags for a point of the glyph.

Parameters

  • integer flags: The flags for a point of the glyph.

Example

use Libraries.Game.Graphics.Fonts.all
use Libraries.Game.Game
use Libraries.System.File
use Libraries.Containers.ByteArray
use Libraries.Containers.Support.ByteReader
use Libraries.System.BinaryFileReader

class Main is Game
    action Main
        StartGame()
    end

    action CreateGame
        File file
        ByteArray byteArray = undefined
        ByteReader byteReader = undefined
        FontFileReader reader
        // This is the directory for fonts on Mac
        file:SetWorkingDirectory("/Library/Fonts")
        file:SetPath("Arial.ttf")
        reader:Load(file)
        TrueTypeFileInformation fileInformation = reader:GetFileInformation()
        BinaryFileReader binaryReader
        binaryReader:OpenForRead(file)
        byteArray = binaryReader:ReadBytes()
        byteArray:SetBigEndian(true)
        byteReader = byteArray:GetByteReader()
        // This is assuming the current position of the byteReader is at the
        // right location. By default, it will not be. This will also need
        // to iterate over the total number of points for the glyph outline,
        // and add all of the information to an array of GlyphCoordinateFlags.
        integer flags = byteReader:NextByteAsUnsignedInteger()
        GlyphCoordinateFlag coordinateFlag
        coordinateFlag:SetFlags(flags)
    end
end

XCoordinateIsOneByte()

This action returns whether or not the x-coordinate of this point is one byte.

Return

boolean: Returns true if the x-coordinate is one byte, and false if it is two bytes.

Example

use Libraries.Game.Graphics.Fonts.all
use Libraries.Game.Game
use Libraries.System.File
use Libraries.Containers.ByteArray
use Libraries.Containers.Support.ByteReader
use Libraries.System.BinaryFileReader

class Main is Game
    action Main
        StartGame()
    end

    action CreateGame
        File file
        ByteArray byteArray = undefined
        ByteReader byteReader = undefined
        FontFileReader reader
        // This is the directory for fonts on Mac
        file:SetWorkingDirectory("/Library/Fonts")
        file:SetPath("Arial.ttf")
        reader:Load(file)
        TrueTypeFileInformation fileInformation = reader:GetFileInformation()
        BinaryFileReader binaryReader
        binaryReader:OpenForRead(file)
        byteArray = binaryReader:ReadBytes()
        byteArray:SetBigEndian(true)
        byteReader = byteArray:GetByteReader()
        // This is assuming the current position of the byteReader is at the
        // right location. By default, it will not be. This will also need
        // to iterate over the total number of points for the glyph outline,
        // and add all of the information to an array of GlyphCoordinateFlags.
        integer flags = byteReader:NextByteAsUnsignedInteger()
        GlyphCoordinateFlag coordinateFlag
        coordinateFlag:SetFlags(flags)
        output coordinateFlag:XCoordinateIsOneByte()
    end
end

XCoordinateIsSame()

This action returns a value that is based on the xShort variable. If xShort is true, then this action will return the sign of the x-coordinate for this point, where true is positive and false is negative. If xShort is false, then if this is true it means that the current x-coordinate is the same as the previous x-coordinate. If xShort and xSame are false, then it means this x-coordinate represents the change in x.

Return

boolean: The return of this action depends on the value of xShort. See the action documentation for specifics.

Example

use Libraries.Game.Graphics.Fonts.all
use Libraries.Game.Game
use Libraries.System.File
use Libraries.Containers.ByteArray
use Libraries.Containers.Support.ByteReader
use Libraries.System.BinaryFileReader

class Main is Game
    action Main
        StartGame()
    end

    action CreateGame
        File file
        ByteArray byteArray = undefined
        ByteReader byteReader = undefined
        FontFileReader reader
        // This is the directory for fonts on Mac
        file:SetWorkingDirectory("/Library/Fonts")
        file:SetPath("Arial.ttf")
        reader:Load(file)
        TrueTypeFileInformation fileInformation = reader:GetFileInformation()
        BinaryFileReader binaryReader
        binaryReader:OpenForRead(file)
        byteArray = binaryReader:ReadBytes()
        byteArray:SetBigEndian(true)
        byteReader = byteArray:GetByteReader()
        // This is assuming the current position of the byteReader is at the
        // right location. By default, it will not be. This will also need
        // to iterate over the total number of points for the glyph outline,
        // and add all of the information to an array of GlyphCoordinateFlags.
        integer flags = byteReader:NextByteAsUnsignedInteger()
        GlyphCoordinateFlag coordinateFlag
        coordinateFlag:SetFlags(flags)
        output coordinateFlag:XCoordinateIsSame()
    end
end

YCoordinateIsOneByte()

This action returns whether or not the y-coordinate of this point is one byte.

Return

boolean: Returns true if the y-coordinate is one byte, and false if it is two bytes.

Example

use Libraries.Game.Graphics.Fonts.all
use Libraries.Game.Game
use Libraries.System.File
use Libraries.Containers.ByteArray
use Libraries.Containers.Support.ByteReader
use Libraries.System.BinaryFileReader

class Main is Game
    action Main
        StartGame()
    end

    action CreateGame
        File file
        ByteArray byteArray = undefined
        ByteReader byteReader = undefined
        FontFileReader reader
        // This is the directory for fonts on Mac
        file:SetWorkingDirectory("/Library/Fonts")
        file:SetPath("Arial.ttf")
        reader:Load(file)
        TrueTypeFileInformation fileInformation = reader:GetFileInformation()
        BinaryFileReader binaryReader
        binaryReader:OpenForRead(file)
        byteArray = binaryReader:ReadBytes()
        byteArray:SetBigEndian(true)
        byteReader = byteArray:GetByteReader()
        // This is assuming the current position of the byteReader is at the
        // right location. By default, it will not be. This will also need
        // to iterate over the total number of points for the glyph outline,
        // and add all of the information to an array of GlyphCoordinateFlags.
        integer flags = byteReader:NextByteAsUnsignedInteger()
        GlyphCoordinateFlag coordinateFlag
        coordinateFlag:SetFlags(flags)
        output coordinateFlag:YCoordinateIsOneByte()
    end
end

YCoordinateIsSame()

This action returns a value that is based on the yShort variable. If yShort is true, then this action will return the sign of the y-coordinate for this point, where true is positive and false is negative. If yShort is false, then if this is true it means that the current y-coordinate is the same as the previous y-coordinate. If yShort and ySame are false, then it means this y-coordinate represents the change in y.

Return

boolean: The return of this action depends on the value of yShort. See the action documentation for specifics.

Example

use Libraries.Game.Graphics.Fonts.all
use Libraries.Game.Game
use Libraries.System.File
use Libraries.Containers.ByteArray
use Libraries.Containers.Support.ByteReader
use Libraries.System.BinaryFileReader

class Main is Game
    action Main
        StartGame()
    end

    action CreateGame
        File file
        ByteArray byteArray = undefined
        ByteReader byteReader = undefined
        FontFileReader reader
        // This is the directory for fonts on Mac
        file:SetWorkingDirectory("/Library/Fonts")
        file:SetPath("Arial.ttf")
        reader:Load(file)
        TrueTypeFileInformation fileInformation = reader:GetFileInformation()
        BinaryFileReader binaryReader
        binaryReader:OpenForRead(file)
        byteArray = binaryReader:ReadBytes()
        byteArray:SetBigEndian(true)
        byteReader = byteArray:GetByteReader()
        // This is assuming the current position of the byteReader is at the
        // right location. By default, it will not be. This will also need
        // to iterate over the total number of points for the glyph outline,
        // and add all of the information to an array of GlyphCoordinateFlags.
        integer flags = byteReader:NextByteAsUnsignedInteger()
        GlyphCoordinateFlag coordinateFlag
        coordinateFlag:SetFlags(flags)
        output coordinateFlag:YCoordinateIsSame()
    end
end