protected function getImage(BasicList $list) { $image = $list->getImage(); if (!$image) { throw new LogicException('Image enumeration type requires not empty attribute "image" of BasicList.'); } return $image; }
public function drawEnumeration(Document $document, BasicList $list, GraphicsContext $gc) { $child = $list->getChild($this->index); $point = $child->getFirstPoint(); $positionTranslation = $list->getPositionTranslation(); list($xTranslation, $yTranslation) = $this->getEnumerationElementTranslations($document, $list); $point = $point->translate($positionTranslation->getX(), $positionTranslation->getY()); $xCoord = $point->getX() - $child->getMarginLeft() + $xTranslation; $subchild = current($child->getChildren()); $yCoord = $point->getY() - $yTranslation - ($subchild ? $subchild->getPaddingTop() : 0) - $child->getPaddingTop(); $this->doDrawEnumeration($document, $list, $gc, $xCoord, $yCoord); $this->incrementIndex(); $this->visualIndex++; }
protected function doDrawEnumeration(Document $document, BasicList $list, GraphicsContext $gc, $xCoord, $yCoord) { $encoding = $list->getEncoding(); $gc->saveGS(); $color = $list->getRecurseAttribute('color'); if ($color) { $gc->setLineColor($color); $gc->setFillColor($color); } $font = $list->getFont($document); $size = $list->getFontSizeRecursively(); if ($font && $size) { $gc->setFont($font, $size); } $gc->drawText($this->enumerationText, $xCoord, $yCoord, $encoding); $gc->restoreGS(); }
public function getWidthOfTheBiggestPosibleEnumerationElement(Document $document, BasicList $list) { return $this->getWidthOfText($list->getType(), $list->getFont($document), $list->getFontSizeRecursively()); }