Text extends DrawObject
Representation of a text inside a object layer.
This class represents a text inside an object layer.
Tags
Table of Contents
- $bold : bool
- Whether the font is bold (1) or not (0). (defaults to 0).
- $color : string
- Color of the text in #AARRGGBB or #RRGGBB format (defaults to #000000).
- $fontFamily : string
- The font family used (defaults to “sans-serif”).
- $gid : int|null
- A reference to a tile.
- $hAlign : string
- Horizontal alignment of the text within the object (left, center, right or justify, defaults to left) (since Tiled 1.2.1).
- $height : float
- The height of the object in pixels.
- $id : int|null
- Unique ID of the object.
- $italic : bool
- Whether the font is italic (1) or not (0). (defaults to 0).
- $kerning : bool
- Whether kerning should be used while rendering the text (1) or not (0). (defaults to 1).
- $name : string|null
- The name of the object.
- $pixelSize : int
- The size of the font in pixels (not using points, because other sizes in the TMX format are also using pixels) (defaults to 16).
- $propertyBag : PropertyBag|null
- $rotation : string
- The rotation of the object in degrees clockwise around (x, y).
- $strikeOut : bool
- Whether a line should be drawn through the text (1) or not (0). (defaults to 0).
- $text : string
- Contains the actual text as character data.
- $type : string|null
- The type of the object.
- $underline : bool
- Whether a line should be drawn below the text (1) or not (0). (defaults to 0).
- $vAlign : string
- Vertical alignment of the text within the object (top , center or bottom, defaults to top).
- $visible : bool
- Whether the object is shown (1) or hidden (0).
- $width : float
- The width of the object in pixels.
- $wrap : bool
- Whether word wrapping is enabled (1) or disabled (0). (defaults to 0).
- $x : float
- The x coordinate of the object in pixels.
- $y : float
- The y coordinate of the object in pixels.
- getColor() : string
- getFontFamily() : string
- getGid() : int|null
- getHAlign() : string
- getHeight() : float
- getId() : int|null
- getName() : string|null
- getPixelSize() : int
- getPropertyBag() : PropertyBag|null
- getRotation() : string
- getText() : string
- getType() : string|null
- getVAlign() : string
- getWidth() : float
- getX() : float
- getY() : float
- isBold() : bool
- isItalic() : bool
- isKerning() : bool
- isStrikeOut() : bool
- isUnderline() : bool
- isVisible() : bool
- isWrap() : bool
- setBold() : Text
- setColor() : Text
- setFontFamily() : Text
- setGid() : DrawObject
- setHAlign() : Text
- setHeight() : DrawObject
- setId() : DrawObject
- setItalic() : Text
- setKerning() : Text
- setName() : DrawObject
- setPixelSize() : Text
- setPropertyBag() : self
- setRotation() : DrawObject
- setStrikeOut() : Text
- setText() : Text
- setType() : DrawObject
- setUnderline() : Text
- setVAlign() : Text
- setVisible() : DrawObject
- setWidth() : DrawObject
- setWrap() : Text
- setX() : DrawObject
- setY() : DrawObject
Properties
$bold
Whether the font is bold (1) or not (0). (defaults to 0).
private
bool
$bold
= false
Tags
$color
Color of the text in #AARRGGBB or #RRGGBB format (defaults to #000000).
private
string
$color
= '#000000'
Tags
$fontFamily
The font family used (defaults to “sans-serif”).
private
string
$fontFamily
= 'sans-serif'
Tags
$gid
A reference to a tile.
private
int|null
$gid
= null
Tags
$hAlign
Horizontal alignment of the text within the object (left, center, right or justify, defaults to left) (since Tiled 1.2.1).
private
string
$hAlign
= 'left'
Tags
$height
The height of the object in pixels.
private
float
$height
= 0.0
Tags
$id
Unique ID of the object.
private
int|null
$id
= null
Tags
$italic
Whether the font is italic (1) or not (0). (defaults to 0).
private
bool
$italic
= false
Tags
$kerning
Whether kerning should be used while rendering the text (1) or not (0). (defaults to 1).
private
bool
$kerning
= true
Tags
$name
The name of the object.
private
string|null
$name
= null
Tags
$pixelSize
The size of the font in pixels (not using points, because other sizes in the TMX format are also using pixels) (defaults to 16).
private
int
$pixelSize
= 16
Tags
$propertyBag
private
PropertyBag|null
$propertyBag
= null
Tags
$rotation
The rotation of the object in degrees clockwise around (x, y).
private
string
$rotation
= '0'
Tags
$strikeOut
Whether a line should be drawn through the text (1) or not (0). (defaults to 0).
private
bool
$strikeOut
= false
Tags
$text
Contains the actual text as character data.
private
string
$text
= ''
Tags
$type
The type of the object.
private
string|null
$type
= null
Tags
$underline
Whether a line should be drawn below the text (1) or not (0). (defaults to 0).
private
bool
$underline
= false
Tags
$vAlign
Vertical alignment of the text within the object (top , center or bottom, defaults to top).
private
string
$vAlign
= 'top'
Tags
$visible
Whether the object is shown (1) or hidden (0).
private
bool
$visible
= true
Tags
$width
The width of the object in pixels.
private
float
$width
= 0.0
Tags
$wrap
Whether word wrapping is enabled (1) or disabled (0). (defaults to 0).
private
bool
$wrap
= false
Tags
$x
The x coordinate of the object in pixels.
private
float
$x
= 0.0
Tags
$y
The y coordinate of the object in pixels.
private
float
$y
= 0.0
Tags
Methods
getColor()
public
getColor() : string
Tags
Return values
string —getFontFamily()
public
getFontFamily() : string
Tags
Return values
string —getGid()
public
getGid() : int|null
Return values
int|null —getHAlign()
public
getHAlign() : string
Tags
Return values
string —getHeight()
public
getHeight() : float
Return values
float —getId()
public
getId() : int|null
Return values
int|null —getName()
public
getName() : string|null
Return values
string|null —getPixelSize()
public
getPixelSize() : int
Tags
Return values
int —getPropertyBag()
public
getPropertyBag() : PropertyBag|null
Return values
PropertyBag|null —getRotation()
public
getRotation() : string
Return values
string —getText()
public
getText() : string
Tags
Return values
string —getType()
public
getType() : string|null
Return values
string|null —getVAlign()
public
getVAlign() : string
Tags
Return values
string —getWidth()
public
getWidth() : float
Return values
float —getX()
public
getX() : float
Return values
float —getY()
public
getY() : float
Return values
float —isBold()
public
isBold() : bool
Tags
Return values
bool —isItalic()
public
isItalic() : bool
Tags
Return values
bool —isKerning()
public
isKerning() : bool
Tags
Return values
bool —isStrikeOut()
public
isStrikeOut() : bool
Tags
Return values
bool —isUnderline()
public
isUnderline() : bool
Tags
Return values
bool —isVisible()
public
isVisible() : bool
Return values
bool —isWrap()
public
isWrap() : bool
Tags
Return values
bool —setBold()
public
setBold(bool $bold) : Text
Parameters
- $bold : bool
Tags
Return values
Text —setColor()
public
setColor(string $color) : Text
Parameters
- $color : string
Tags
Return values
Text —setFontFamily()
public
setFontFamily(string $fontFamily) : Text
Parameters
- $fontFamily : string
Tags
Return values
Text —setGid()
public
setGid(int|null $gid) : DrawObject
Parameters
- $gid : int|null
Return values
DrawObject —setHAlign()
public
setHAlign(string $hAlign) : Text
Parameters
- $hAlign : string
Tags
Return values
Text —setHeight()
public
setHeight(float $height) : DrawObject
Parameters
- $height : float
Return values
DrawObject —setId()
public
setId(int|null $id) : DrawObject
Parameters
- $id : int|null
Return values
DrawObject —setItalic()
public
setItalic(bool $italic) : Text
Parameters
- $italic : bool
Tags
Return values
Text —setKerning()
public
setKerning(bool $kerning) : Text
Parameters
- $kerning : bool
Tags
Return values
Text —setName()
public
setName(string|null $name) : DrawObject
Parameters
- $name : string|null
Return values
DrawObject —setPixelSize()
public
setPixelSize(int $pixelSize) : Text
Parameters
- $pixelSize : int
Tags
Return values
Text —setPropertyBag()
public
setPropertyBag(PropertyBag|null $propertyBag) : self
Parameters
- $propertyBag : PropertyBag|null
Return values
self —setRotation()
public
setRotation(string $rotation) : DrawObject
Parameters
- $rotation : string
Return values
DrawObject —setStrikeOut()
public
setStrikeOut(bool $strikeOut) : Text
Parameters
- $strikeOut : bool
Tags
Return values
Text —setText()
public
setText(string $text) : Text
Parameters
- $text : string
Tags
Return values
Text —setType()
public
setType(string|null $type) : DrawObject
Parameters
- $type : string|null
Return values
DrawObject —setUnderline()
public
setUnderline(bool $underline) : Text
Parameters
- $underline : bool
Tags
Return values
Text —setVAlign()
public
setVAlign(string $vAlign) : Text
Parameters
- $vAlign : string
Tags
Return values
Text —setVisible()
public
setVisible(bool $visible) : DrawObject
Parameters
- $visible : bool
Return values
DrawObject —setWidth()
public
setWidth(float $width) : DrawObject
Parameters
- $width : float
Return values
DrawObject —setWrap()
public
setWrap(bool $wrap) : Text
Parameters
- $wrap : bool
Tags
Return values
Text —setX()
public
setX(float $x) : DrawObject
Parameters
- $x : float
Return values
DrawObject —setY()
public
setY(float $y) : DrawObject
Parameters
- $y : float