Example #1
0
 /**
  * @param float            $size fontsize in pt
  * @param float            $angle in degree
  * @param int              $x
  * @param int              $y
  * @param \DarkLuk42\Color $color
  * @param string           $font path of the ttf file
  * @param string           $text
  *
  * @return \DarkLuk42\Image the image with the text
  */
 public static function createText($size, $angle, $x, $y, Color $color, $font, $text)
 {
     $bb = self::getTextBoundingBox($size, $angle, $font, $text);
     $image = new self($bb->getWidth(), $bb->getHeight());
     imagettftext($image->image, $size, $angle, $x - $bb->getLeft(), $y - $bb->getTop(), $image->getColorIndex($color), $font, $text);
     $bb->setLeft($x);
     $bb->setTop($y);
     return $image;
 }