/**
  */
 public function testVisibility()
 {
     $style = new FontStyle();
     $this->assertTrue($style->isVisible());
     $style->setSize(0);
     $this->assertFalse($style->isVisible());
     $style->setSize(1);
     $this->assertTrue($style->isVisible());
 }
 /**
  * @param string|FontStyle $fontStyle
  *
  * @return ZendAbstractFont
  * @throws \Exception
  */
 protected function getZendFont(FontStyle $fontStyle)
 {
     if (!isset($this->fontMap[$fontStyle->getName()][$fontStyle->getStyle()])) {
         throw new InvalidArgumentException('unsupported font: ' . $fontStyle->getName() . '/' . $fontStyle->getStyle());
     }
     return ZendFont::fontWithName($this->fontMap[$fontStyle->getName()][$fontStyle->getStyle()]);
 }
 /**
  * @param SimpleXMLElement $element
  * @param FontStyle $fontStyle
  */
 private function addFontStyle(SimpleXMLElement $element, FontStyle $fontStyle)
 {
     $element->addAttribute("font-family", $fontStyle->getName() . ', sans-serif');
     $element->addAttribute("font-size", $fontStyle->getSize());
     switch ($fontStyle->getStyle()) {
         case FontStyle::FONT_STYLE_BOLD:
             $element->addAttribute("font-weight", 'bold');
             break;
         case FontStyle::FONT_STYLE_ITALIC:
             $element->addAttribute("font-style", 'italic');
             break;
         case FontStyle::FONT_STYLE_BOLD_ITALIC:
             $element->addAttribute("font-weight", 'bold');
             $element->addAttribute("font-style", 'italic');
             break;
     }
     switch ($fontStyle->getHAlign()) {
         case FontStyle::HORIZONTAL_ALIGN_LEFT:
             $element->addAttribute("text-anchor", "start");
             break;
         case FontStyle::HORIZONTAL_ALIGN_MIDDLE:
             $element->addAttribute("text-anchor", "middle");
             break;
         case FontStyle::HORIZONTAL_ALIGN_RIGHT:
             $element->addAttribute("text-anchor", "end");
             break;
     }
     switch ($fontStyle->getVAlign()) {
         case FontStyle::VERTICAL_ALIGN_TOP:
             $element->addAttribute("alignment-baseline", "text-before-edge");
             break;
         case FontStyle::VERTICAL_ALIGN_CENTRAL:
             $element->addAttribute("alignment-baseline", "central");
             break;
         case FontStyle::VERTICAL_ALIGN_BASE:
             $element->addAttribute("alignment-baseline", "alphabetic");
             break;
         case FontStyle::VERTICAL_ALIGN_BOTTOM:
             $element->addAttribute("alignment-baseline", "text-after-edge");
             break;
     }
 }