Text in svg defines a text based on a given text and coordinate. SvgDreams library has a class for defining a text.
$textObj = new Text("text_1");
   $textObj->setCoordinates(20, 20);
   $textObj->setTextFont(20, 300, "middle");
   $textObj->addText("Sample text for the example");

Sample text in SVG is below. You can check the codes in shapes_text_0.php.
Sample text rotating by given angles is below. You can check the codes in shapes_text_1.php.


public function addText($text)
Adds a text to the SVG shape.
$text: The text of the SVG element.
public function setCoordinate($x, $y)
Sets the coordinate of the SVG shape. Equal to setting $this->x and $this->y values.
$x, $y: x and y coordinates of the element.
public function setRotation($rotationAngles)
Rotates the characters of a text with given values in the angle.
$rotationAngles: Array of angles of each character of the string.
public function setTextFont($fontSize, $textLength, $textAnchor)
Sets font size and text length.
$fontSize: Font size of the text.
$textLength: Text length of the text.
$textAnchor: Anchor of the text, middle by default.
function __construct($itemId)
Constructor of Text class needs an id for the text element. We suggest you to define a unique ID.

All rights reserved. See license