Constructor
new Format(rac, hAlign, vAlign, angleopt, fontopt, sizeopt)
Creates a new Text.Format
instance.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
rac |
Rac
|
Instance to use for drawing and creating other objects |
||
hAlign |
string
|
The horizontal alignment, left-to-right; one of the values from
|
||
vAlign |
string
|
The vertical alignment, top-to-bottom; one of the values from
|
||
angle |
Rac.Angle
|
<optional> |
rac.Angle.zero |
The angle towards which the text is drawn |
font |
string
|
<optional> |
null |
The font name |
size |
number
|
<optional> |
null |
The font size |
Members
(static) horizontalAlign :object
Supported values for hAlign
which
dermines the left-to-right alignment of the drawn Text
in relation
to its text.point
.
Properties:
Name | Type | Description |
---|---|---|
left |
string
|
aligns |
center |
string
|
aligns |
right |
string
|
aligns |
(static) verticalAlign :object
Supported values for vAlign
which
dermines the top-to-bottom alignment of the drawn Text
in relation
to its text.point
.
Properties:
Name | Type | Description |
---|---|---|
top |
string
|
aligns |
center |
string
|
aligns |
baseline |
string
|
aligns |
bottom |
string
|
aligns |
angle :Rac.Angle
The angle towards which the text is drawn.
An angle of zero
wil draw the text
towards the right of the screen.
(nullable) font :string
The font name of the text to draw.
When set to null
the font defined in
rac.textFormatDefaults.font
is
used instead upon drawing.
hAlign :string
The horizontal alignment, left-to-right, to position a Text
relative to its point
.
Supported values are available through the
horizontalAlign
object.
rac :Rac
Instance of Rac
used for drawing and passed along to any created
object.
(nullable) size :number
The font size of the text to draw.
When set to null
the size defined in
rac.textFormatDefaults.size
is
used instead upon drawing.
vAlign :string
The vertical alignment, top-to-bottom, to position a Text
relative
to its point
.
Supported values are available through the
verticalAlign
object.
Methods
equals(otherFormat) → {boolean}
Returns true
when all members, except rac
, of both formats are
equal, otherwise returns false
.
When otherFormat
is any class other that Rac.Text.Format
, returns
false
.
- See:
Parameters:
Name | Type | Description |
---|---|---|
otherFormat |
Rac.Text.Format
|
A |
reverse() → {Rac.Text.Format}
Returns a new Text.Format
that will draw a text reversed, upside-down,
in generally the same position as this
would draw the same text.
toString(digitsopt) → {string}
Returns a string representation intended for human consumption.
(new Rac.Text.Format(rac, 'left', 'top', 0.5, 'sans', 14)).toString()
// Returns: Text.Format(ha:left va:top a:0.5 f:"sans" s:14)
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.Format}
Returns a new Text.Format
with angle
set to the Angle
derived
from newAngle
.
Parameters:
Name | Type | Description |
---|---|---|
newAngle |
Rac.Angle
|
number
|
The angle for the new |
withFont(newFontnullable) → {Rac.Text.Format}
Returns a new Text.Format
with font
set to newFont
.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
newFont |
string
|
<nullable> |
The font name for the new |
withSize(newSizenullable) → {Rac.Text.Format}
Returns a new Text.Format
with size
set to newSize
.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
newSize |
number
|
<nullable> |
The font size for the new |