Rac. Text

String, position and format to draw a text.

An instance of this object contains the string and a Point used to determine the location of the drawn text. The Text.Format object determines the font, size, orientation angle, and the alignment relative to point to draw the text.

Constructor

new Text(rac, point, string, format)

Creates a new Text instance.

Parameters:
Name Type Description
rac Rac

Instance to use for drawing and creating other objects

point Rac.Point

The location for the drawn text

string string

The string to draw

format Rac.Text.Format

The format for the drawn text

Classes

Format

Members

format :Rac.Text.Format

The alignment, angle, font, and size to use to draw the text.

point :Rac.Point

The location where the text will be drawn.

The text will be drawn relative to this point based on the alignment and angle configuration of format.

rac :Rac

Instance of Rac used for drawing and passed along to any created object.

string :string

The string to draw.

Methods

equals(otherText) → {boolean}

Returns true when the string and point of both texts are equal; otherwise returns false.

When otherText is any class other that Rac.Text, returns false.

points are compared using point.equals.

The format objects are ignored in this comparison.

See:
Parameters:
Name Type Description
otherText Rac.Text

A Text to compare

toString(digitsopt) → {string}

Returns a string representation intended for human consumption.

Parameters:
Name Type Attributes Default Description
digits number <optional>
null

The number of digits to print after the decimal point, when ommited all digits are printed

withAngle(newAngle) → {Rac.Text}

Returns a new Text and Format with format.angle set to the Angle derived from newAngle.

Parameters:
Name Type Description
newAngle Rac.Angle | number

The angle for the new Text and Text.Format

withFont(newFontnullable) → {Rac.Text}

Returns a new Text and Format with format.font set to newFont.

Parameters:
Name Type Attributes Description
newFont string <nullable>

The font name for the new Text and Text.Format; can be set to null.

withSize(newSizenullable) → {Rac.Text}

Returns a new Text and Format with format.size set to newSize.

Parameters:
Name Type Attributes Description
newSize number <nullable>

The font size for the new Text and Text.Format; can be set to null.