Font
extends AbstractStyle
in package
Font style.
Table of Contents
Constants
- 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'
Properties
- $aliases : array<string|int, mixed>
- Aliases.
- $index : null|int
- Index number in Style collection for named style.
- $styleName : string|null
- Style name.
- $allCaps : bool
- All caps.
- $bold : bool
- Bold.
- $color : string
- Font color.
- $doubleStrikethrough : bool
- Double strikethrough.
- $fallbackFont : string
- Generic font as fallback for html.
- $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 : null|Language
- Languages.
- $name : string
- Font name.
- $noProof : bool
- noProof (disables AutoCorrect).
- $paragraph : Paragraph
- Paragraph style.
- $position : int
- Vertically Raised or Lowered Text.
- $rtl : bool|null
- 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.
- $whiteSpace : string
- Preservation of white space in html.
Methods
- __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.
- getFallbackFont() : string
- Get html fallback generic font.
- 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() : null|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|null
- Get style name.
- getStyleType() : string
- Get style type.
- getStyleValues() : array<string|int, mixed>
- Get style values.
- getUnderline() : string
- Get underline.
- getWhiteSpace() : string
- Get html css white-space value.
- isAllCaps() : bool
- Get all caps.
- isAuto() : bool
- Get is automatic style flag.
- isBold() : bool
- Get bold.
- isDoubleStrikethrough() : bool|null
- Get double strikethrough.
- isHidden() : bool
- Get hidden text.
- isItalic() : bool
- Get italic.
- isNoProof() : bool
- Get noProof (disables autocorrect).
- isRTL() : bool|null
- Get rtl.
- isSmallCaps() : bool
- Get small caps.
- isStrikethrough() : bool|null
- 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.
- setFallbackFont() : self
- Set generic font for fallback for html.
- 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.
- setWhiteSpace() : self
- Set html css white-space value. It is expected that only pre-wrap and normal (default) are useful.
- 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|null
$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
$fallbackFont
Generic font as fallback for html.
private
string
$fallbackFont
= ''
generic font name
$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
null|Language
$lang
$name
Font name.
private
string
$name
$noProof
noProof (disables AutoCorrect).
private
bool
$noProof
http://www.datypic.com/sc/ooxml/e-w_noProof-1.html
$paragraph
Paragraph style.
private
Paragraph
$paragraph
$position
Vertically Raised or Lowered Text.
private
int
$position
Signed Half-Point Measurement
Tags
$rtl
Right to left languages.
private
bool|null
$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
$whiteSpace
Preservation of white space in html.
private
string
$whiteSpace
= ''
Value used for css white-space
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
getBgColor()
Get background.
public
getBgColor() : string
Return values
stringgetChildStyleValue()
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
getColor()
Get font color.
public
getColor() : string
Return values
stringgetFallbackFont()
Get html fallback generic font.
public
getFallbackFont() : string
Return values
stringgetFgColor()
Get foreground/highlight color.
public
getFgColor() : string
Return values
stringgetHint()
Get Font Content Type.
public
getHint() : string
Return values
stringgetIndex()
Get index number.
public
getIndex() : null|int
Return values
null|intgetKerning()
Get font kerning.
public
getKerning() : float|int
Return values
float|intgetLang()
Get language.
public
getLang() : null|Language
Return values
null|LanguagegetLineHeight()
Get line height.
public
getLineHeight() : float|int
Return values
float|intgetName()
Get font name.
public
getName() : string
Return values
stringgetParagraph()
Get paragraph style.
public
getParagraph() : Paragraph
Return values
ParagraphgetPosition()
Get position.
public
getPosition() : int
Return values
intgetScale()
Get scale.
public
getScale() : int
Return values
intgetShading()
Get shading.
public
getShading() : Shading
Return values
ShadinggetSize()
Get font size.
public
getSize() : float|int
Return values
float|intgetSpacing()
Get font spacing.
public
getSpacing() : float|int
Return values
float|intgetStyleName()
Get style name.
public
getStyleName() : string|null
Return values
string|nullgetStyleType()
Get style type.
public
getStyleType() : string
Return values
stringgetStyleValues()
Get style values.
public
getStyleValues() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>getUnderline()
Get underline.
public
getUnderline() : string
Return values
stringgetWhiteSpace()
Get html css white-space value.
public
getWhiteSpace() : string
Return values
stringisAllCaps()
Get all caps.
public
isAllCaps() : bool
Return values
boolisAuto()
Get is automatic style flag.
public
isAuto() : bool
Return values
boolisBold()
Get bold.
public
isBold() : bool
Return values
boolisDoubleStrikethrough()
Get double strikethrough.
public
isDoubleStrikethrough() : bool|null
Return values
bool|nullisHidden()
Get hidden text.
public
isHidden() : bool
Return values
boolisItalic()
Get italic.
public
isItalic() : bool
Return values
boolisNoProof()
Get noProof (disables autocorrect).
public
isNoProof() : bool
Return values
boolisRTL()
Get rtl.
public
isRTL() : bool|null
Return values
bool|nullisSmallCaps()
Get small caps.
public
isSmallCaps() : bool
Return values
boolisStrikethrough()
Get strikethrough.
public
isStrikethrough() : bool|null
Return values
bool|nullisSubScript()
Get subscript.
public
isSubScript() : bool
Return values
boolisSuperScript()
Get superscript.
public
isSuperScript() : bool
Return values
boolsetAllCaps()
Set all caps.
public
setAllCaps([bool $value = true ]) : self
Parameters
- $value : bool = true
Return values
selfsetAuto()
Set is automatic style flag.
public
setAuto([bool $value = true ]) : self
Parameters
- $value : bool = true
Return values
selfsetBgColor()
Set background.
public
setBgColor([string $value = null ]) : Table
Parameters
- $value : string = null
Return values
TablesetBold()
Set bold.
public
setBold([bool $value = true ]) : self
Parameters
- $value : bool = true
Return values
selfsetColor()
Set font color.
public
setColor([string $value = null ]) : self
Parameters
- $value : string = null
Return values
selfsetDoubleStrikethrough()
Set double strikethrough.
public
setDoubleStrikethrough([bool $value = true ]) : self
Parameters
- $value : bool = true
Return values
selfsetFallbackFont()
Set generic font for fallback for html.
public
setFallbackFont(string $value) : self
Parameters
- $value : string
-
generic font name
Return values
selfsetFgColor()
Set foreground/highlight color.
public
setFgColor([string $value = null ]) : self
Parameters
- $value : string = null
Return values
selfsetHidden()
Set hidden text.
public
setHidden([bool $value = true ]) : self
Parameters
- $value : bool = true
Return values
selfsetHint()
Set Font Content Type.
public
setHint([string $value = null ]) : self
Parameters
- $value : string = null
Return values
selfsetIndex()
Set index number.
public
setIndex([null|int $value = null ]) : self
Parameters
- $value : null|int = null
Return values
selfsetItalic()
Set italic.
public
setItalic([bool $value = true ]) : self
Parameters
- $value : bool = true
Return values
selfsetKerning()
Set font kerning.
public
setKerning([float|int $value = null ]) : self
Parameters
- $value : float|int = null
Return values
selfsetLang()
Set language.
public
setLang([mixed $value = null ]) : self
Parameters
- $value : mixed = null
Return values
selfsetLineHeight()
Set lineheight.
public
setLineHeight(float|int|string $value) : self
Parameters
- $value : float|int|string
Return values
selfsetName()
Set font name.
public
setName([string $value = null ]) : self
Parameters
- $value : string = null
Return values
selfsetNoProof()
Set noProof (disables autocorrect).
public
setNoProof([bool $value = false ]) : $this
Parameters
- $value : bool = false
Return values
$thissetParagraph()
Set Paragraph.
public
setParagraph([mixed $value = null ]) : self
Parameters
- $value : mixed = null
Return values
selfsetPosition()
Set position.
public
setPosition([int $value = null ]) : self
Parameters
- $value : int = null
Return values
selfsetRTL()
Set rtl.
public
setRTL([bool|null $value = true ]) : self
Parameters
- $value : bool|null = true
Return values
selfsetScale()
Set scale.
public
setScale([int $value = null ]) : self
Parameters
- $value : int = null
Return values
selfsetShading()
Set shading.
public
setShading([mixed $value = null ]) : self
Parameters
- $value : mixed = null
Return values
selfsetSize()
Set font size.
public
setSize([float|int $value = null ]) : self
Parameters
- $value : float|int = null
Return values
selfsetSmallCaps()
Set small caps.
public
setSmallCaps([bool $value = true ]) : self
Parameters
- $value : bool = true
Return values
selfsetSpacing()
Set font spacing.
public
setSpacing([float|int $value = null ]) : self
Parameters
- $value : float|int = null
Return values
selfsetStrikethrough()
Set strikethrough.
public
setStrikethrough([bool $value = true ]) : self
Parameters
- $value : bool = true
Return values
selfsetStyleByArray()
Set style by using associative array.
public
setStyleByArray([array<string|int, mixed> $values = [] ]) : self
Parameters
- $values : array<string|int, mixed> = []
Return values
selfsetStyleName()
Set style name.
public
setStyleName(string $value) : self
Parameters
- $value : string
Return values
selfsetStyleValue()
Set style value template method.
public
setStyleValue(string $key, array<string|int, mixed>|int|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 : array<string|int, mixed>|int|string
Return values
selfsetSubScript()
Set subscript.
public
setSubScript([bool $value = true ]) : self
Parameters
- $value : bool = true
Return values
selfsetSuperScript()
Set superscript.
public
setSuperScript([bool $value = true ]) : self
Parameters
- $value : bool = true
Return values
selfsetUnderline()
Set underline.
public
setUnderline([string $value = self::UNDERLINE_NONE ]) : self
Parameters
- $value : string = self::UNDERLINE_NONE
Return values
selfsetWhiteSpace()
Set html css white-space value. It is expected that only pre-wrap and normal (default) are useful.
public
setWhiteSpace(null|string $value) : self
Parameters
- $value : null|string
-
Should be one of pre-wrap, normal, nowrap, pre, pre-line, initial, inherit
Return values
selfsetBoolVal()
Set bool value.
protected
setBoolVal(bool $value, bool $default) : bool
Parameters
- $value : bool
- $default : bool
Return values
boolsetEnumVal()
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
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|floatsetIntVal()
Set integer value: Convert string that contains only numeric into integer.
protected
setIntVal(null|float|int|string $value[, null|int $default = null ]) : null|int
Parameters
- $value : null|float|int|string
- $default : null|int = null
Return values
null|intsetNonEmptyVal()
Set default for null and empty value.
protected
setNonEmptyVal(string|null $value, string $default) : string
Parameters
- $value : string|null
- $default : string
Return values
stringsetNumericVal()
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|intsetObjectVal()
Set object value.
protected
setObjectVal(mixed $value, string $styleName, mixed &$style) : mixed
Parameters
- $value : mixed
- $styleName : string
- $style : 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