Documentation

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_DOTHASH  = 'dotDash'
UNDERLINE_DOTHASHHEAVY  = 'dotDashHeavy'
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  : int|null
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  : int|float
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  : int|float
Font size
$smallCaps  : bool
Small caps
$spacing  : int|float
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
getBold()  : mixed
Get bold
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()  : int|null
Get index number
getItalic()  : mixed
Get italic
getKerning()  : int|float
Get font kerning
getLang()  : Language
Get language
getLineHeight()  : int|float
Get line height
getName()  : string
Get font name
getParagraph()  : Paragraph
Get paragraph style
getParagraphStyle()  : mixed
Get paragraph style
getPosition()  : int
Get position
getScale()  : int
Get scale
getShading()  : Shading
Get shading
getSize()  : int|float
Get font size
getSpacing()  : int|float
Get font spacing
getStrikethrough()  : mixed
Get strikethrough
getStyleName()  : string
Get style name
getStyleType()  : string
Get style type
getStyleValues()  : array<string|int, mixed>
Get style values
getSubScript()  : mixed
Get subscript
getSuperScript()  : mixed
Get superscript
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
setArrayStyle()  : self
Set style using associative array
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()  : float|null
Set float value: Convert string that contains only numeric into float
setIntVal()  : int|null
Set integer value: Convert string that contains only numeric into integer
setNonEmptyVal()  : string
Set default for null and empty value
setNumericVal()  : int|float|null
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
const

string

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_DOTHASH

public mixed UNDERLINE_DOTHASH = 'dotDash'
Tags
deprecated

use UNDERLINE_DOTHASH instead, TODO remove in version 1.0

UNDERLINE_DOTHASHHEAVY

public mixed UNDERLINE_DOTHASHHEAVY = 'dotDashHeavy'
Tags
deprecated

use UNDERLINE_DOTDASHHEAVY instead, TODO remove in version 1.0

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
const

string

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 = array('line-height' => 'lineHeight', 'letter-spacing' => 'spacing')

$index

Index number in Style collection for named style

protected int|null $index

This number starts from one and defined in Style::setStyleValues()

$bold

Bold

private bool $bold

$color

Font color

private string $color

$doubleStrikethrough

Double strikethrough

private bool $doubleStrikethrough

$fgColor

Foreground/highlight

private string $fgColor

$hint

Font Content Type

private string $hint

$isAuto

Is this an automatic style? (Used primarily in OpenDocument driver)

private bool $isAuto = false
Tags
since
0.11.0

$italic

Italic

private bool $italic

$name

Font name

private string $name

$noProof

noProof (disables AutoCorrect)

private bool $noProof

$rtl

Right to left languages

private bool $rtl

$size

Font size

private int|float $size

$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>|string|AbstractStyle $paragraph = null ]) : mixed
Parameters
$type : string = 'text'

Type of font

$paragraph : array<string|int, mixed>|string|AbstractStyle = null

Paragraph styles definition

Return values
mixed

getBgColor()

Get background

public getBgColor() : string
Return values
string

getBold()

Get bold

public getBold() : mixed
Tags
deprecated
0.10.0
codeCoverageIgnore
Return values
mixed

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
since
0.12.0
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() : int|null
Return values
int|null

getItalic()

Get italic

public getItalic() : mixed
Tags
deprecated
0.10.0
codeCoverageIgnore
Return values
mixed

getKerning()

Get font kerning

public getKerning() : int|float
Return values
int|float

getLineHeight()

Get line height

public getLineHeight() : int|float
Return values
int|float

getName()

Get font name

public getName() : string
Return values
string

getParagraphStyle()

Get paragraph style

public getParagraphStyle() : mixed
Tags
deprecated
0.11.0
codeCoverageIgnore
Return values
mixed

getPosition()

Get position

public getPosition() : int
Return values
int

getScale()

Get scale

public getScale() : int
Return values
int

getSize()

Get font size

public getSize() : int|float
Return values
int|float

getSpacing()

Get font spacing

public getSpacing() : int|float
Return values
int|float

getStrikethrough()

Get strikethrough

public getStrikethrough() : mixed
Tags
deprecated
0.10.0
codeCoverageIgnore
Return values
mixed

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
since
0.12.0
Return values
array<string|int, mixed>

getSubScript()

Get subscript

public getSubScript() : mixed
Tags
deprecated
0.10.0
codeCoverageIgnore
Return values
mixed

getSuperScript()

Get superscript

public getSuperScript() : mixed
Tags
deprecated
0.10.0
codeCoverageIgnore
Return values
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

setArrayStyle()

Set style using associative array

public setArrayStyle([array<string|int, mixed> $style = array() ]) : self
Parameters
$style : array<string|int, mixed> = array()
Tags
deprecated
0.11.0
codeCoverageIgnore
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([int|null $value = null ]) : self
Parameters
$value : int|null = 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([int|float $value = null ]) : self
Parameters
$value : int|float = 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(int|float|string $value) : self
Parameters
$value : int|float|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([int|float $value = null ]) : self
Parameters
$value : int|float = 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([int|float $value = null ]) : self
Parameters
$value : int|float = 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 = array() ]) : self
Parameters
$values : array<string|int, mixed> = array()
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 = array() ][, mixed $default = null ]) : mixed
Parameters
$value : mixed = null
$enum : array<string|int, mixed> = array()
$default : mixed = null
Tags
throws
InvalidArgumentException
Return values
mixed

setFloatVal()

Set float value: Convert string that contains only numeric into float

protected setFloatVal(mixed $value[, float|null $default = null ]) : float|null
Parameters
$value : mixed
$default : float|null = null
Return values
float|null

setIntVal()

Set integer value: Convert string that contains only numeric into integer

protected setIntVal(int|null $value[, int|null $default = null ]) : int|null
Parameters
$value : int|null
$default : int|null = null
Return values
int|null

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[, int|float|null $default = null ]) : int|float|null
Parameters
$value : mixed
$default : int|float|null = null
Return values
int|float|null

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
Return values
self

Search results