name = 'Calibri'; $this->size = 10; $this->characterSpacing = 0; $this->bold = false; $this->italic = false; $this->superScript = false; $this->subScript = false; $this->underline = self::UNDERLINE_NONE; $this->strikethrough = false; $this->color = new Color(Color::COLOR_BLACK); } /** * Get Name * * @return string */ public function getName() { return $this->name; } /** * Set Name * * @param string $pValue * @return \PhpOffice\PhpPresentation\Style\Font */ public function setName($pValue = 'Calibri') { if ($pValue == '') { $pValue = 'Calibri'; } $this->name = $pValue; return $this; } /** * Get Character Spacing * * @return double */ public function getCharacterSpacing() { return $this->characterSpacing; } /** * Set Character Spacing * Value in pt * @param float|int $pValue * @return \PhpOffice\PhpPresentation\Style\Font */ public function setCharacterSpacing($pValue = 0) { if ($pValue == '') { $pValue = 0; } $this->characterSpacing = $pValue * 100; return $this; } /** * Get Size * * @return double */ public function getSize() { return $this->size; } /** * Set Size * * @param float|int $pValue * @return \PhpOffice\PhpPresentation\Style\Font */ public function setSize($pValue = 10) { if ($pValue == '') { $pValue = 10; } $this->size = $pValue; return $this; } /** * Get Bold * * @return boolean */ public function isBold() { return $this->bold; } /** * Set Bold * * @param boolean $pValue * @return \PhpOffice\PhpPresentation\Style\Font */ public function setBold($pValue = false) { if ($pValue == '') { $pValue = false; } $this->bold = $pValue; return $this; } /** * Get Italic * * @return boolean */ public function isItalic() { return $this->italic; } /** * Set Italic * * @param boolean $pValue * @return \PhpOffice\PhpPresentation\Style\Font */ public function setItalic($pValue = false) { if ($pValue == '') { $pValue = false; } $this->italic = $pValue; return $this; } /** * Get SuperScript * * @return boolean */ public function isSuperScript() { return $this->superScript; } /** * Set SuperScript * * @param boolean $pValue * @return \PhpOffice\PhpPresentation\Style\Font */ public function setSuperScript($pValue = false) { if ($pValue == '') { $pValue = false; } $this->superScript = $pValue; // Set SubScript at false only if SuperScript is true if ($pValue === true) { $this->subScript = false; } return $this; } /** * Get SubScript * * @return boolean */ public function isSubScript() { return $this->subScript; } /** * Set SubScript * * @param boolean $pValue * @return \PhpOffice\PhpPresentation\Style\Font */ public function setSubScript($pValue = false) { if ($pValue == '') { $pValue = false; } $this->subScript = $pValue; // Set SuperScript at false only if SubScript is true if ($pValue === true) { $this->superScript = false; } return $this; } /** * Get Underline * * @return string */ public function getUnderline() { return $this->underline; } /** * Set Underline * * @param string $pValue \PhpOffice\PhpPresentation\Style\Font underline type * @return \PhpOffice\PhpPresentation\Style\Font */ public function setUnderline($pValue = self::UNDERLINE_NONE) { if ($pValue == '') { $pValue = self::UNDERLINE_NONE; } $this->underline = $pValue; return $this; } /** * Get Strikethrough * * @return boolean */ public function isStrikethrough() { return $this->strikethrough; } /** * Set Strikethrough * * @param boolean $pValue * @return \PhpOffice\PhpPresentation\Style\Font */ public function setStrikethrough($pValue = false) { if ($pValue == '') { $pValue = false; } $this->strikethrough = $pValue; return $this; } /** * Get Color * * @return \PhpOffice\PhpPresentation\Style\Color|\PhpOffice\PhpPresentation\Style\SchemeColor */ public function getColor() { return $this->color; } /** * Set Color * * @param \PhpOffice\PhpPresentation\Style\Color|\PhpOffice\PhpPresentation\Style\SchemeColor $pValue * @throws \Exception * @return \PhpOffice\PhpPresentation\Style\Font */ public function setColor($pValue = null) { if (!$pValue instanceof Color) { throw new \Exception('$pValue must be an instance of \PhpOffice\PhpPresentation\Style\Color'); } $this->color = $pValue; return $this; } /** * Get hash code * * @return string Hash code */ public function getHashCode() { return md5($this->name . $this->size . ($this->bold ? 't' : 'f') . ($this->italic ? 't' : 'f') . ($this->superScript ? 't' : 'f') . ($this->subScript ? 't' : 'f') . $this->underline . ($this->strikethrough ? 't' : 'f') . $this->color->getHashCode() . __CLASS__); } /** * Get hash index * * Note that this index may vary during script execution! Only reliable moment is * while doing a write of a workbook and when changes are not allowed. * * @return string Hash index */ public function getHashIndex() { return $this->hashIndex; } /** * Set hash index * * Note that this index may vary during script execution! Only reliable moment is * while doing a write of a workbook and when changes are not allowed. * * @param string $value Hash index */ public function setHashIndex($value) { $this->hashIndex = $value; } }