Libraries.Game.Graphics.Fonts.BezierCurveGlyphPoints Documentation

The BezierCurveGlyphPoints class is used to store the Bezier point information for a given character, as well as to create virtual points needed when scaling the glyph to a given size. Most users will never use this class directly.

Example Code

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

    class Main is Game
        FontFileReader fileReader
            
        action Main
            StartGame()
        end

        action CreateGame
            BezierCurveGlyphPoints glyphOutline = fileReader:GetCharacterGlyphPoints("a")
        end
    end

Inherits from: Libraries.Language.Object

Summary

Actions Summary Table

ActionsDescription
AddNewPointRelativeToLast(integer changeInX, integer changeInY, boolean onCurve, boolean endpoint)This action adds the absolute coordinate position of the next point relative to the last point that was read from the file.
AddPoint(Libraries.Game.Graphics.Fonts.CoordinateVector point)This action adds a CoordinateVector set of points to the Bezier curve point array.
AddPoint(integer x, integer y)This action adds a point to the Bezier curve's point array by creating a CoordinateVector, setting its values and then adding it to the array.
AddToCompoundEndpoints(Libraries.Containers.Array<integer> endPoints)This action adds an array of endpoints for a compound glyph component to the BezierCurveGlyphPoints.
AddToCompoundPoints(Libraries.Containers.Array<Libraries.Game.Graphics.Fonts.CoordinateVector> coordinatePoints)This action adds an array of coordinate points for a compound glyph component to the BezierCurveGlyphPoints.
AddVirtualPoints()This action adds virtual points between the actual points of a Bezier curve.
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.
GetBoundingBox()This action returns the BoundingBox of the Bezier curve.
GetCompoundEndpoints()This action returns an array of all the endpoint arrays in a compound glyph.
GetCompoundGlyph()This action returns whether or not the BezierCurveGlyphPoints is a simple glyph.
GetCompoundPoints()This action returns an array of all the coordinate point arrays in a compound glyph.
GetContourEndpoints()This action returns the array containing the number of points on the ith contour of the glyph.
GetHashCode()This action gets the hash code for an object.
GetPoints()This action returns the array containing the points that make up the Bezier curve.
OffsetXY(integer offsetX, integer offsetY)This action offsets the BezierCurveGlyphPoints coordinate points by the given offset values.
ScalePoints(number scale)This action scales the coordinate position points of the BezierCurveGlyphPoints by the given value.
ScaleXAndYDifferently(number xScale, number yScale)This action scales the coordinate position points of the BezierCurveGlyphPoints by the given values.
SetBoundingBox(Libraries.Game.Graphics.Fonts.FontBoundingBox boundingbox)This action sets the BoundingBox of the Bezier curve to an already defined bounding box.
SetBoundingBox(integer xMin, integer yMin, integer xMax, integer yMax)This action sets the BoundingBox of the Bezier curve to the dimensions specified.
SetCompoundGlyph(boolean value)This action sets whether or not the BezierCurveGlyphPoints is a simple glyph.
SetContourEndpoints(Libraries.Containers.Array<integer> endpoints)This action sets the number of points that are on each contour of the glyph.
SetNumberOfContours(integer numberOfContours)This action sets the number of contours for the Bezier curve.
SetPoints(Libraries.Containers.Array<Libraries.Game.Graphics.Fonts.CoordinateVector> points)This action sets the array of coordinate points for this Bezier curve.
ToText()This actions prints to the screen the number of contours and the number of points for the Bezier curve.

Actions Documentation

AddNewPointRelativeToLast(integer changeInX, integer changeInY, boolean onCurve, boolean endpoint)

This action adds the absolute coordinate position of the next point relative to the last point that was read from the file.

Example Code

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

        class Main is Game
            FontFileReader fileReader
            
            action Main
                StartGame()
            end

            action CreateGame
                BezierCurveGlyphPoints glyphOutline = fileReader:GetCharacterGlyphPoints("a")
                glyphOutline:AddNewPointRelativeToLast(1, 1, true, false)
            end
        end

Parameters

AddPoint(Libraries.Game.Graphics.Fonts.CoordinateVector point)

This action adds a CoordinateVector set of points to the Bezier curve point array.

Example Code

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

            action CreateGame
                BezierCurveGlyphPoints glyphOutline
                CoordinateVector vector
                vector:SetX(1)
                vector:SetY(1)
                glyphOutline:AddPoint(vector)
            end
        end

Parameters

AddPoint(integer x, integer y)

This action adds a point to the Bezier curve's point array by creating a CoordinateVector, setting its values and then adding it to the array.

Example Code

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

        class Main is Game
            action Main
                StartGame()
            end

            action CreateGame
                BezierCurveGlyphPoints glyphOutline
                glyphOutline:AddPoint(1, 1)
            end
        end

Parameters

AddToCompoundEndpoints(Libraries.Containers.Array<integer> endPoints)

This action adds an array of endpoints for a compound glyph component to the BezierCurveGlyphPoints.

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
                BezierCurveGlyphPoints points
                Array<integer> endpoints
                points:AddToCompoundEndpoints(endpoints)
            end
        end

Parameters

AddToCompoundPoints(Libraries.Containers.Array<Libraries.Game.Graphics.Fonts.CoordinateVector> coordinatePoints)

This action adds an array of coordinate points for a compound glyph component to the BezierCurveGlyphPoints.

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
                BezierCurveGlyphPoints points
                Array<CoordinateVector> coordinatePoints
                points:AddToCompoundPoints(coordinatePoints)
            end
        end

Parameters

AddVirtualPoints()

This action adds virtual points between the actual points of a Bezier curve. Virtual points are points between actual points and are useful in calculating lines when creating the outlines of characters. Note that this function must be called every time actual points are added.

Example Code

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

        class Main is Game
            FontFileReader fileReader
       
            action Main
                StartGame()
            end

            action CreateGame
                BezierCurveGlyphPoints glyphOutline = fileReader:GetCharacterGlyphPoints("a")
                glyphOutline:AddVirtualPoints()
            end
        end

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.

GetBoundingBox()

This action returns the BoundingBox of the Bezier curve.

Example Code

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

        class Main is Game
            action Main
                StartGame()
            end

            action CreateGame
                BezierCurveGlyphPoints glyphOutline
                FontBoundingBox box = glyphOutline:GetBoundingBox()
            end
        end

Return

Libraries.Game.Graphics.Fonts.FontBoundingBox: Returns the bounding box of the Bezier curve.

GetCompoundEndpoints()

This action returns an array of all the endpoint arrays in a compound glyph.

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
                BezierCurveGlyphPoints points
                Array<Array<integer>> endpoints = points:GetCompoundEndpoints()
            end
        end

Return

Libraries.Containers.Array: Returns an array of all the endpoint arrays in a compound glyph.

GetCompoundGlyph()

This action returns whether or not the BezierCurveGlyphPoints is a simple glyph.

Example Code

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

        class Main is Game
            action Main
                StartGame()
            end

            action CreateGame
                BezierCurveGlyphPoints points
                output points:GetCompoundGlyph()
            end
        end

Return

boolean: Returns true if this is a compound glyph, and false if it is not.

GetCompoundPoints()

This action returns an array of all the coordinate point arrays in a compound glyph.

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
                BezierCurveGlyphPoints points
                Array<Array<CoordinateVector>> coordinatePoints = points:GetCompoundPoints()
            end
        end

Return

Libraries.Containers.Array: Returns an array of all the coordinate point arrays in a compound glyph.

GetContourEndpoints()

This action returns the array containing the number of points on the ith contour of the glyph.

Example Code

use Libraries.Game.Graphics.Fonts.all
        use Libraries.Game.Game
        use Libraries.Containers.Array

        class Main is Game
            action Main
                StartGame()
            end

            action CreateGame
                BezierCurveGlyphPoints glyphOutline
                Array<integer> count = glyphOutline:GetContourEndpoints()
            end
        end

Return

Libraries.Containers.Array: Returns the array containing the number of points on every contour of the glyph.

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.

GetPoints()

This action returns the array containing the points that make up the Bezier curve.

Example Code

use Libraries.Game.Graphics.Fonts.all
        use Libraries.Game.Game
        use Libraries.Containers.Array

        class Main is Game
            action Main
                StartGame()
            end

            action CreateGame
                BezierCurveGlyphPoints glyphOutline
                Array<CoordinateVector> points = glyphOutline:GetPoints()
            end
        end

Return

Libraries.Containers.Array: Returns the array containing the coordinates of every point on the Bezier curve.

OffsetXY(integer offsetX, integer offsetY)

This action offsets the BezierCurveGlyphPoints coordinate points by the given offset values. These values are in a real, unscaled coordinate system and should be used on points that are also in a real, unscaled coordinate system (before the points have been scaled to a font size, for example).

Example Code

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

        class Main is Game
            action Main
                StartGame()
            end

            action CreateGame
                BezierCurveGlyphPoints points
                points:OffsetXY(10, 20)
            end
        end

Parameters

ScalePoints(number scale)

This action scales the coordinate position points of the BezierCurveGlyphPoints by the given value. This scale is applied to both x and y positions. For example, if the scale is 2.0, it will set all points to twice their current values, doubling the size of the character.

Example Code

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

            action CreateGame
                BezierCurveGlyphPoints points
                points:ScalePoints(2.0)
            end
        end

Parameters

ScaleXAndYDifferently(number xScale, number yScale)

This action scales the coordinate position points of the BezierCurveGlyphPoints by the given values. There is an x scale and a y scale that are applied to the x and y values accordingly. For example, if the values are 2.0 and 1.0, then the glyph will be twice as wide but remain at the same height.

Example Code

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

            action CreateGame
                BezierCurveGlyphPoints points
                points:ScaleXAndYDifferently(2.0, 1.0)
            end
        end

Parameters

SetBoundingBox(Libraries.Game.Graphics.Fonts.FontBoundingBox boundingbox)

This action sets the BoundingBox of the Bezier curve to an already defined bounding box.

Example Code

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

        class Main is Game
            action Main
                StartGame()
            end

            action CreateGame
                BezierCurveGlyphPoints glyphOutline
                FontBoundingBox boundingBox
                glyphOutline:SetBoundingBox(boundingBox)
            end
        end

Parameters

SetBoundingBox(integer xMin, integer yMin, integer xMax, integer yMax)

This action sets the BoundingBox of the Bezier curve to the dimensions specified.

Example Code

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

        class Main is Game
            action Main
                StartGame()
            end 
                
            action CreateGame
                BezierCurveGlyphPoints glyphOutline
                glyphOutline:SetBoundingBox(0, 0, 100, 100)
            end
        end

Parameters

SetCompoundGlyph(boolean value)

This action sets whether or not the BezierCurveGlyphPoints is a simple glyph.

Example Code

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

        class Main is Game
            action Main
                StartGame()
            end

            action CreateGame
                BezierCurveGlyphPoints points
                points:SetCompoundGlyph(true)
            end
        end

Parameters

SetContourEndpoints(Libraries.Containers.Array<integer> endpoints)

This action sets the number of points that are on each contour of the glyph. Note that these are not the coordinates for each point, only how many points there are.

Example Code

use Libraries.Game.Graphics.Fonts.all
        use Libraries.Game.Game
        use Libraries.Containers.Array

        class Main is Game
            action Main
                StartGame()
            end

            action CreateGame
                BezierCurveGlyphPoints glyphOutline
                Array<integer> count
                count:Add(1)
                glyphOutline:SetContourEndpoints(count)
            end
        end

Parameters

SetNumberOfContours(integer numberOfContours)

This action sets the number of contours for the Bezier curve.

Example Code

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

        class Main is Game
            action Main
                StartGame()
            end

            action CreateGame
                BezierCurveGlyphPoints glyphOutline
                glyphOutline:SetNumberOfContours(1)
            end
        end

Parameters

SetPoints(Libraries.Containers.Array<Libraries.Game.Graphics.Fonts.CoordinateVector> points)

This action sets the array of coordinate points for this Bezier curve.

Example Code

use Libraries.Game.Graphics.Fonts.all
        use Libraries.Game.Game
        use Libraries.Containers.Array

        class Main is Game
            action Main
                StartGame()
            end

            action CreateGame
                BezierCurveGlyphPoints glyphOutline
                Array<CoordinateVector> points
                CoordinateVector vector
                vector:SetX(1)
                vector:SetY(1)
                points:Add(vector)
                glyphOutline:SetPoints(points)
            end
        end

Parameters

ToText()

This actions prints to the screen the number of contours and the number of points for the Bezier curve.

Example Code

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

        class Main is Game
            action Main
                StartGame()
            end 

            action CreateGame
                BezierCurveGlyphPoints glyphOutline
                output glyphOutline:ToText()
            end
        end

Return

text: Returns a string of characters containing the number of contours and the number of points for the Bezier curve.