Font extends AbstractStyle
Font style.
Table of Contents
- FGCOLOR_BLACK = 'black'
- FGCOLOR_BLUE = 'blue'
- FGCOLOR_CYAN = 'cyan'
- FGCOLOR_DARKBLUE = 'darkBlue'
- FGCOLOR_DARKCYAN = 'darkCyan'
- FGCOLOR_DARKGRAY = 'darkGray'
- FGCOLOR_DARKGREEN = 'darkGreen'
- FGCOLOR_DARKMAGENTA = 'darkMagenta'
- FGCOLOR_DARKRED = 'darkRed'
- FGCOLOR_DARKYELLOW = 'darkYellow'
- FGCOLOR_LIGHTGRAY = 'lightGray'
- FGCOLOR_LIGHTGREEN = 'green'
- FGCOLOR_MAGENTA = 'magenta'
- FGCOLOR_RED = 'red'
- FGCOLOR_YELLOW = 'yellow'
- Foreground colors.
- UNDERLINE_DASH = 'dash'
- UNDERLINE_DASHHEAVY = 'dashHeavy'
- UNDERLINE_DASHLONG = 'dashLong'
- UNDERLINE_DASHLONGHEAVY = 'dashLongHeavy'
- UNDERLINE_DOTDASH = 'dotDash'
- UNDERLINE_DOTDASHHEAVY = 'dotDashHeavy'
- UNDERLINE_DOTDOTDASH = 'dotDotDash'
- UNDERLINE_DOTDOTDASHHEAVY = 'dotDotDashHeavy'
- UNDERLINE_DOTTED = 'dotted'
- UNDERLINE_DOTTEDHEAVY = 'dottedHeavy'
- UNDERLINE_DOUBLE = 'dbl'
- UNDERLINE_HEAVY = 'heavy'
- UNDERLINE_NONE = 'none'
- Underline types.
- UNDERLINE_SINGLE = 'single'
- UNDERLINE_WAVY = 'wavy'
- UNDERLINE_WAVYDOUBLE = 'wavyDbl'
- UNDERLINE_WAVYHEAVY = 'wavyHeavy'
- UNDERLINE_WORDS = 'words'
- $aliases : array<string|int, mixed>
- Aliases.
- $index : null|int
- Index number in Style collection for named style.
- $styleName : string
- Style name.
- $allCaps : bool
- All caps.
- $bold : bool
- Bold.
- $color : string
- Font color.
- $doubleStrikethrough : bool
- Double strikethrough.
- $fgColor : string
- Foreground/highlight.
- $hidden : bool
- Hidden text.
- $hint : string
- Font Content Type.
- $isAuto : bool
- Is this an automatic style? (Used primarily in OpenDocument driver).
- $italic : bool
- Italic.
- $kerning : float|int
- Font kerning: halfpoint.
- $lang : Language
- Languages.
- $name : string
- Font name.
- $noProof : bool
- noProof (disables AutoCorrect).
- $paragraph : Paragraph
- Paragraph style.
- $position : int
- Vertically Raised or Lowered Text.
- $rtl : bool
- Right to left languages.
- $scale : int
- Expanded/compressed text: 0-600 (percent).
- $shading : Shading
- Shading.
- $size : float|int
- Font size.
- $smallCaps : bool
- Small caps.
- $spacing : float|int
- Character spacing adjustment: twip.
- $strikethrough : bool
- Strikethrough.
- $subScript : bool
- Subscript.
- $superScript : bool
- Superscript.
- $type : string
- Font style type.
- $underline : string
- Undeline.
- __construct() : mixed
- Create new font style.
- getBgColor() : string
- Get background.
- getChildStyleValue() : mixed
- Return style value of child style object, e.g. `left` from `Indentation` child style of `Paragraph`.
- getColor() : string
- Get font color.
- getFgColor() : string
- Get foreground/highlight color.
- getHint() : string
- Get Font Content Type.
- getIndex() : null|int
- Get index number.
- getKerning() : float|int
- Get font kerning.
- getLang() : Language
- Get language.
- getLineHeight() : float|int
- Get line height.
- getName() : string
- Get font name.
- getParagraph() : Paragraph
- Get paragraph style.
- getPosition() : int
- Get position.
- getScale() : int
- Get scale.
- getShading() : Shading
- Get shading.
- getSize() : float|int
- Get font size.
- getSpacing() : float|int
- Get font spacing.
- getStyleName() : string
- Get style name.
- getStyleType() : string
- Get style type.
- getStyleValues() : array<string|int, mixed>
- Get style values.
- getUnderline() : string
- Get underline.
- isAllCaps() : bool
- Get all caps.
- isAuto() : bool
- Get is automatic style flag.
- isBold() : bool
- Get bold.
- isDoubleStrikethrough() : bool
- Get double strikethrough.
- isHidden() : bool
- Get hidden text.
- isItalic() : bool
- Get italic.
- isNoProof() : bool
- Get noProof (disables autocorrect).
- isRTL() : bool
- Get rtl.
- isSmallCaps() : bool
- Get small caps.
- isStrikethrough() : bool
- Get strikethrough.
- isSubScript() : bool
- Get subscript.
- isSuperScript() : bool
- Get superscript.
- setAllCaps() : self
- Set all caps.
- setAuto() : self
- Set is automatic style flag.
- setBgColor() : Table
- Set background.
- setBold() : self
- Set bold.
- setColor() : self
- Set font color.
- setDoubleStrikethrough() : self
- Set double strikethrough.
- setFgColor() : self
- Set foreground/highlight color.
- setHidden() : self
- Set hidden text.
- setHint() : self
- Set Font Content Type.
- setIndex() : self
- Set index number.
- setItalic() : self
- Set italic.
- setKerning() : self
- Set font kerning.
- setLang() : self
- Set language.
- setLineHeight() : self
- Set lineheight.
- setName() : self
- Set font name.
- setNoProof() : $this
- Set noProof (disables autocorrect).
- setParagraph() : self
- Set Paragraph.
- setPosition() : self
- Set position.
- setRTL() : self
- Set rtl.
- setScale() : self
- Set scale.
- setShading() : self
- Set shading.
- setSize() : self
- Set font size.
- setSmallCaps() : self
- Set small caps.
- setSpacing() : self
- Set font spacing.
- setStrikethrough() : self
- Set strikethrough.
- setStyleByArray() : self
- Set style by using associative array.
- setStyleName() : self
- Set style name.
- setStyleValue() : self
- Set style value template method.
- setSubScript() : self
- Set subscript.
- setSuperScript() : self
- Set superscript.
- setUnderline() : self
- Set underline.
- setBoolVal() : bool
- Set bool value.
- setEnumVal() : mixed
- Set enum value.
- setFloatVal() : null|float
- Set float value: Convert string that contains only numeric into float.
- setIntVal() : null|int
- Set integer value: Convert string that contains only numeric into integer.
- setNonEmptyVal() : string
- Set default for null and empty value.
- setNumericVal() : null|float|int
- Set numeric value.
- setObjectVal() : mixed
- Set object value.
- setPairedVal() : self
- Set $property value and set $pairProperty = false when $value = true.
Constants
FGCOLOR_BLACK
public
mixed
FGCOLOR_BLACK
= 'black'
FGCOLOR_BLUE
public
mixed
FGCOLOR_BLUE
= 'blue'
FGCOLOR_CYAN
public
mixed
FGCOLOR_CYAN
= 'cyan'
FGCOLOR_DARKBLUE
public
mixed
FGCOLOR_DARKBLUE
= 'darkBlue'
FGCOLOR_DARKCYAN
public
mixed
FGCOLOR_DARKCYAN
= 'darkCyan'
FGCOLOR_DARKGRAY
public
mixed
FGCOLOR_DARKGRAY
= 'darkGray'
FGCOLOR_DARKGREEN
public
mixed
FGCOLOR_DARKGREEN
= 'darkGreen'
FGCOLOR_DARKMAGENTA
public
mixed
FGCOLOR_DARKMAGENTA
= 'darkMagenta'
FGCOLOR_DARKRED
public
mixed
FGCOLOR_DARKRED
= 'darkRed'
FGCOLOR_DARKYELLOW
public
mixed
FGCOLOR_DARKYELLOW
= 'darkYellow'
FGCOLOR_LIGHTGRAY
public
mixed
FGCOLOR_LIGHTGRAY
= 'lightGray'
FGCOLOR_LIGHTGREEN
public
mixed
FGCOLOR_LIGHTGREEN
= 'green'
FGCOLOR_MAGENTA
public
mixed
FGCOLOR_MAGENTA
= 'magenta'
FGCOLOR_RED
public
mixed
FGCOLOR_RED
= 'red'
FGCOLOR_YELLOW
Foreground colors.
public
mixed
FGCOLOR_YELLOW
= 'yellow'
Tags
UNDERLINE_DASH
public
mixed
UNDERLINE_DASH
= 'dash'
UNDERLINE_DASHHEAVY
public
mixed
UNDERLINE_DASHHEAVY
= 'dashHeavy'
UNDERLINE_DASHLONG
public
mixed
UNDERLINE_DASHLONG
= 'dashLong'
UNDERLINE_DASHLONGHEAVY
public
mixed
UNDERLINE_DASHLONGHEAVY
= 'dashLongHeavy'
UNDERLINE_DOTDASH
public
mixed
UNDERLINE_DOTDASH
= 'dotDash'
UNDERLINE_DOTDASHHEAVY
public
mixed
UNDERLINE_DOTDASHHEAVY
= 'dotDashHeavy'
UNDERLINE_DOTDOTDASH
public
mixed
UNDERLINE_DOTDOTDASH
= 'dotDotDash'
UNDERLINE_DOTDOTDASHHEAVY
public
mixed
UNDERLINE_DOTDOTDASHHEAVY
= 'dotDotDashHeavy'
UNDERLINE_DOTTED
public
mixed
UNDERLINE_DOTTED
= 'dotted'
UNDERLINE_DOTTEDHEAVY
public
mixed
UNDERLINE_DOTTEDHEAVY
= 'dottedHeavy'
UNDERLINE_DOUBLE
public
mixed
UNDERLINE_DOUBLE
= 'dbl'
UNDERLINE_HEAVY
public
mixed
UNDERLINE_HEAVY
= 'heavy'
UNDERLINE_NONE
Underline types.
public
mixed
UNDERLINE_NONE
= 'none'
Tags
UNDERLINE_SINGLE
public
mixed
UNDERLINE_SINGLE
= 'single'
UNDERLINE_WAVY
public
mixed
UNDERLINE_WAVY
= 'wavy'
UNDERLINE_WAVYDOUBLE
public
mixed
UNDERLINE_WAVYDOUBLE
= 'wavyDbl'
UNDERLINE_WAVYHEAVY
public
mixed
UNDERLINE_WAVYHEAVY
= 'wavyHeavy'
UNDERLINE_WORDS
public
mixed
UNDERLINE_WORDS
= 'words'
Properties
$aliases
Aliases.
protected
array<string|int, mixed>
$aliases
= ['line-height' => 'lineHeight', 'letter-spacing' => 'spacing']
$index
Index number in Style collection for named style.
protected
null|int
$index
This number starts from one and defined in Style::setStyleValues()
$styleName
Style name.
protected
string
$styleName
$allCaps
All caps.
private
bool
$allCaps
Tags
$bold
Bold.
private
bool
$bold
$color
Font color.
private
string
$color
$doubleStrikethrough
Double strikethrough.
private
bool
$doubleStrikethrough
$fgColor
Foreground/highlight.
private
string
$fgColor
$hidden
Hidden text.
private
bool
$hidden
Tags
$hint
Font Content Type.
private
string
$hint
$isAuto
Is this an automatic style? (Used primarily in OpenDocument driver).
private
bool
$isAuto
= false
Tags
$italic
Italic.
private
bool
$italic
$kerning
Font kerning: halfpoint.
private
float|int
$kerning
Tags
$lang
Languages.
private
Language
$lang
$name
Font name.
private
string
$name
$noProof
noProof (disables AutoCorrect).
private
bool
$noProof
$paragraph
Paragraph style.
private
Paragraph
$paragraph
$position
Vertically Raised or Lowered Text.
private
int
$position
Tags
$rtl
Right to left languages.
private
bool
$rtl
$scale
Expanded/compressed text: 0-600 (percent).
private
int
$scale
Tags
$shading
Shading.
private
Shading
$shading
$size
Font size.
private
float|int
$size
$smallCaps
Small caps.
private
bool
$smallCaps
Tags
$spacing
Character spacing adjustment: twip.
private
float|int
$spacing
Tags
$strikethrough
Strikethrough.
private
bool
$strikethrough
$subScript
Subscript.
private
bool
$subScript
= false
$superScript
Superscript.
private
bool
$superScript
= false
$type
Font style type.
private
string
$type
$underline
Undeline.
private
string
$underline
= self::UNDERLINE_NONE
Methods
__construct()
Create new font style.
public
__construct([string $type = 'text' ][, array<string|int, mixed>|AbstractStyle|string $paragraph = null ]) : mixed
Parameters
- $type : string = 'text'
-
Type of font
- $paragraph : array<string|int, mixed>|AbstractStyle|string = null
-
Paragraph styles definition
Return values
mixed —getBgColor()
Get background.
public
getBgColor() : string
Return values
string —getChildStyleValue()
Return style value of child style object, e.g. `left` from `Indentation` child style of `Paragraph`.
public
getChildStyleValue(AbstractStyle $substyleObject, string $substyleProperty) : mixed
Parameters
- $substyleObject : AbstractStyle
- $substyleProperty : string
Tags
Return values
mixed —getColor()
Get font color.
public
getColor() : string
Return values
string —getFgColor()
Get foreground/highlight color.
public
getFgColor() : string
Return values
string —getHint()
Get Font Content Type.
public
getHint() : string
Return values
string —getIndex()
Get index number.
public
getIndex() : null|int
Return values
null|int —getKerning()
Get font kerning.
public
getKerning() : float|int
Return values
float|int —getLang()
Get language.
public
getLang() : Language
Return values
Language —getLineHeight()
Get line height.
public
getLineHeight() : float|int
Return values
float|int —getName()
Get font name.
public
getName() : string
Return values
string —getParagraph()
Get paragraph style.
public
getParagraph() : Paragraph
Return values
Paragraph —getPosition()
Get position.
public
getPosition() : int
Return values
int —getScale()
Get scale.
public
getScale() : int
Return values
int —getShading()
Get shading.
public
getShading() : Shading
Return values
Shading —getSize()
Get font size.
public
getSize() : float|int
Return values
float|int —getSpacing()
Get font spacing.
public
getSpacing() : float|int
Return values
float|int —getStyleName()
Get style name.
public
getStyleName() : string
Return values
string —getStyleType()
Get style type.
public
getStyleType() : string
Return values
string —getStyleValues()
Get style values.
public
getStyleValues() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —getUnderline()
Get underline.
public
getUnderline() : string
Return values
string —isAllCaps()
Get all caps.
public
isAllCaps() : bool
Return values
bool —isAuto()
Get is automatic style flag.
public
isAuto() : bool
Return values
bool —isBold()
Get bold.
public
isBold() : bool
Return values
bool —isDoubleStrikethrough()
Get double strikethrough.
public
isDoubleStrikethrough() : bool
Return values
bool —isHidden()
Get hidden text.
public
isHidden() : bool
Return values
bool —isItalic()
Get italic.
public
isItalic() : bool
Return values
bool —isNoProof()
Get noProof (disables autocorrect).
public
isNoProof() : bool
Return values
bool —isRTL()
Get rtl.
public
isRTL() : bool
Return values
bool —isSmallCaps()
Get small caps.
public
isSmallCaps() : bool
Return values
bool —isStrikethrough()
Get strikethrough.
public
isStrikethrough() : bool
Return values
bool —isSubScript()
Get subscript.
public
isSubScript() : bool
Return values
bool —isSuperScript()
Get superscript.
public
isSuperScript() : bool
Return values
bool —setAllCaps()
Set all caps.
public
setAllCaps([bool $value = true ]) : self
Parameters
- $value : bool = true
Return values
self —setAuto()
Set is automatic style flag.
public
setAuto([bool $value = true ]) : self
Parameters
- $value : bool = true
Return values
self —setBgColor()
Set background.
public
setBgColor([string $value = null ]) : Table
Parameters
- $value : string = null
Return values
Table —setBold()
Set bold.
public
setBold([bool $value = true ]) : self
Parameters
- $value : bool = true
Return values
self —setColor()
Set font color.
public
setColor([string $value = null ]) : self
Parameters
- $value : string = null
Return values
self —setDoubleStrikethrough()
Set double strikethrough.
public
setDoubleStrikethrough([bool $value = true ]) : self
Parameters
- $value : bool = true
Return values
self —setFgColor()
Set foreground/highlight color.
public
setFgColor([string $value = null ]) : self
Parameters
- $value : string = null
Return values
self —setHidden()
Set hidden text.
public
setHidden([bool $value = true ]) : self
Parameters
- $value : bool = true
Return values
self —setHint()
Set Font Content Type.
public
setHint([string $value = null ]) : self
Parameters
- $value : string = null
Return values
self —setIndex()
Set index number.
public
setIndex([null|int $value = null ]) : self
Parameters
- $value : null|int = null
Return values
self —setItalic()
Set italic.
public
setItalic([bool $value = true ]) : self
Parameters
- $value : bool = true
Return values
self —setKerning()
Set font kerning.
public
setKerning([float|int $value = null ]) : self
Parameters
- $value : float|int = null
Return values
self —setLang()
Set language.
public
setLang([mixed $value = null ]) : self
Parameters
- $value : mixed = null
Return values
self —setLineHeight()
Set lineheight.
public
setLineHeight(float|int|string $value) : self
Parameters
- $value : float|int|string
Return values
self —setName()
Set font name.
public
setName([string $value = null ]) : self
Parameters
- $value : string = null
Return values
self —setNoProof()
Set noProof (disables autocorrect).
public
setNoProof([bool $value = false ]) : $this
Parameters
- $value : bool = false
Return values
$this —setParagraph()
Set Paragraph.
public
setParagraph([mixed $value = null ]) : self
Parameters
- $value : mixed = null
Return values
self —setPosition()
Set position.
public
setPosition([int $value = null ]) : self
Parameters
- $value : int = null
Return values
self —setRTL()
Set rtl.
public
setRTL([bool $value = true ]) : self
Parameters
- $value : bool = true
Return values
self —setScale()
Set scale.
public
setScale([int $value = null ]) : self
Parameters
- $value : int = null
Return values
self —setShading()
Set shading.
public
setShading([mixed $value = null ]) : self
Parameters
- $value : mixed = null
Return values
self —setSize()
Set font size.
public
setSize([float|int $value = null ]) : self
Parameters
- $value : float|int = null
Return values
self —setSmallCaps()
Set small caps.
public
setSmallCaps([bool $value = true ]) : self
Parameters
- $value : bool = true
Return values
self —setSpacing()
Set font spacing.
public
setSpacing([float|int $value = null ]) : self
Parameters
- $value : float|int = null
Return values
self —setStrikethrough()
Set strikethrough.
public
setStrikethrough([bool $value = true ]) : self
Parameters
- $value : bool = true
Return values
self —setStyleByArray()
Set style by using associative array.
public
setStyleByArray([array<string|int, mixed> $values = [] ]) : self
Parameters
- $values : array<string|int, mixed> = []
Return values
self —setStyleName()
Set style name.
public
setStyleName(string $value) : self
Parameters
- $value : string
Return values
self —setStyleValue()
Set style value template method.
public
setStyleValue(string $key, string $value) : self
Some child classes have their own specific overrides. Backward compability check for versions < 0.10.0 which use underscore prefix for their private properties. Check if the set method is exists. Throws an exception?
Parameters
- $key : string
- $value : string
Return values
self —setSubScript()
Set subscript.
public
setSubScript([bool $value = true ]) : self
Parameters
- $value : bool = true
Return values
self —setSuperScript()
Set superscript.
public
setSuperScript([bool $value = true ]) : self
Parameters
- $value : bool = true
Return values
self —setUnderline()
Set underline.
public
setUnderline([string $value = self::UNDERLINE_NONE ]) : self
Parameters
- $value : string = self::UNDERLINE_NONE
Return values
self —setBoolVal()
Set bool value.
protected
setBoolVal(bool $value, bool $default) : bool
Parameters
- $value : bool
- $default : bool
Return values
bool —setEnumVal()
Set enum value.
protected
setEnumVal([mixed $value = null ][, array<string|int, mixed> $enum = [] ][, mixed $default = null ]) : mixed
Parameters
- $value : mixed = null
- $enum : array<string|int, mixed> = []
- $default : mixed = null
Return values
mixed —setFloatVal()
Set float value: Convert string that contains only numeric into float.
protected
setFloatVal(mixed $value[, null|float $default = null ]) : null|float
Parameters
- $value : mixed
- $default : null|float = null
Return values
null|float —setIntVal()
Set integer value: Convert string that contains only numeric into integer.
protected
setIntVal(null|int $value[, null|int $default = null ]) : null|int
Parameters
- $value : null|int
- $default : null|int = null
Return values
null|int —setNonEmptyVal()
Set default for null and empty value.
protected
setNonEmptyVal(string $value, string $default) : string
Parameters
- $value : string
-
(was: mixed)
- $default : string
-
(was: mixed)
Return values
string —(was: mixed)
setNumericVal()
Set numeric value.
protected
setNumericVal(mixed $value[, null|float|int $default = null ]) : null|float|int
Parameters
- $value : mixed
- $default : null|float|int = null
Return values
null|float|int —setObjectVal()
Set object value.
protected
setObjectVal(mixed $value, string $styleName, mixed &$style) : mixed
Parameters
- $value : mixed
- $styleName : string
- $style : mixed
Return values
mixed —setPairedVal()
Set $property value and set $pairProperty = false when $value = true.
protected
setPairedVal(bool &$property, bool &$pairProperty, bool $value) : self
Parameters
- $property : bool
- $pairProperty : bool
- $value : bool