/**
  * @param AbstractText $text
  *
  * @return AbstractText
  */
 private function addAndInitText(AbstractText $text)
 {
     $text->getFillStyle()->update($this->defaultTextFillStyle);
     $text->getStrokeStyle()->update($this->defaultTextStrokeStyle);
     $text->getFontStyle()->update($this->defaultTextFontStyle);
     $this->add($text);
     return $text;
 }
Пример #2
0
 /**
  * @param SimpleXMLElement $element
  * @param AbstractText $text
  */
 private function addTextStyle(SimpleXMLElement $element, AbstractText $text)
 {
     $this->addFontStyle($element, $text->getFontStyle());
     $this->addFillStyle($element, $text->getFillStyle());
     $this->addStrokeStyle($element, $text->getStrokeStyle());
     if ($text->getOpacity() < 1) {
         $element->addAttribute("opacity", $text->getOpacity());
     }
 }
Пример #3
0
 /**
  * @param ZendPage $page
  * @param string $text
  * @param float $x
  * @param float $y
  * @param AbstractText $format
  */
 private function drawFormattedText(ZendPage $page, $text, $x, $y, AbstractText $format)
 {
     $fillStyle = $format->getFillStyle();
     $strokeStyle = $format->getStrokeStyle();
     $opacity = $format->getOpacity();
     if (!$fillStyle->isVisible()) {
         $this->setLineStyle($page, $strokeStyle, $opacity);
         $this->drawRawText($page, $text, $x, $y, self::TEXT_DRAW_STROKE);
     } elseif (!$strokeStyle->isVisible()) {
         $this->setFillStyle($page, $fillStyle, $opacity);
         $this->drawRawText($page, $text, $x, $y, self::TEXT_DRAW_FILL);
     } elseif ($fillStyle->getOpacity() !== 1.0 || $strokeStyle->getOpacity() !== 1.0) {
         // separate fill and stroke to emulate correct alpha behavior
         $this->setFillStyle($page, $fillStyle, $opacity);
         $this->drawRawText($page, $text, $x, $y, self::TEXT_DRAW_FILL);
         $this->setLineStyle($page, $strokeStyle, $opacity);
         $this->drawRawText($page, $text, $x, $y, self::TEXT_DRAW_STROKE);
     } else {
         $this->setLineStyle($page, $strokeStyle);
         $this->setFillStyle($page, $fillStyle);
         $page->setAlpha($opacity);
         $this->drawRawText($page, $text, $x, $y, self::TEXT_DRAW_FILL_AND_STROKE);
     }
 }
Пример #4
0
 /**
  * @param string $text
  * @param Path $path
  */
 public function __construct($text, Path $path)
 {
     parent::__construct($text);
     $this->path = $path;
 }