getStyle(); if (!$style instanceof \PhpOffice\PhpWord\Style\Font) { return; } $content = ''; $content .= '\cf' . $this->colorIndex; $content .= '\f' . $this->nameIndex; $content .= $this->getValueIf($style->isBold(), '\b'); $content .= $this->getValueIf($style->isItalic(), '\i'); $content .= $this->getValueIf($style->getSize(), '\fs' . ($style->getSize() * 2)); return $content; } /** * Write end style * * @return string */ public function writeEnd() { $style = $this->getStyle(); if (!$style instanceof \PhpOffice\PhpWord\Style\Font) { return; } $content = ''; $content .= '\cf0'; $content .= '\f0'; $content .= $this->getValueIf($style->isBold(), '\b0'); $content .= $this->getValueIf($style->isItalic(), '\i0'); $content .= $this->getValueIf($style->getSize(), '\fs' . (PhpWord::DEFAULT_FONT_SIZE * 2)); return $content; } /** * Set font name index * * @param int $value */ public function setNameIndex($value = 0) { $this->nameIndex = $value; } /** * Set font color index * * @param int $value */ public function setColorIndex($value = 0) { $this->colorIndex = $value; } }