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

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.

Parameters

  • integer changeInX: The amount of change on the x-axis.
  • integer changeInY: The amount of change on the y-axis.
  • boolean onCurve: True if the point is on the curve, and false if it falls outside of the curve.
  • boolean endpoint: True if the point is an endpoint, and false if it is not.

Example

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

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

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

Parameters

Example


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

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.

Parameters

  • integer x: The x position of the point.
  • integer y: The y position of the point.

Example


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

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

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

Parameters

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

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.

Parameters

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

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

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.

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)

GetBoundingBox()

This action returns the BoundingBox of the Bezier curve.

Return

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

Example

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

GetCompoundEndpoints()

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

Return

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

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

GetCompoundGlyph()

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

Return

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

Example

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

GetCompoundPoints()

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

Return

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

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

GetContourEndpoints()

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

Return

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

Example

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

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

GetPoints()

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

Return

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

Example

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

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

Parameters

  • integer offsetX: The value to offset the x-coordinates by.
  • integer offsetY: The value to offset the y-coordinates by.

Example

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

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.

Parameters

  • number scale: The value to use when scaling the coordinates.

Example

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

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.

Parameters

  • number xScale: The value to use when scaling the x coordinates.
  • number yScale: The value to use when scaling the y coordinates.

Example

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

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

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

Parameters

Example

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

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

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

Parameters

  • integer xMin: The left-most x-coordinate of the box.
  • integer yMin: The bottom-most y-coordinate of the box.
  • integer xMax: The right-most x-coordinate of the box.
  • integer yMax: The top-most y-coordinate of the box.

Example


    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

SetCompoundGlyph(boolean value)

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

Parameters

  • boolean value: True if this is a compound glyph, and false if it is not.

Example


    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

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.

Parameters

Example

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

SetNumberOfContours(integer numberOfContours)

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

Parameters

  • integer numberOfContours: The number of contours for the Bezier curve.

Example

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

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

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

Parameters

Example

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

ToText()

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

Return

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

Example

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