Documentation

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
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_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 = ['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()

$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

$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

http://www.datypic.com/sc/ooxml/e-w_noProof-1.html

$rtl

Right to left languages.

private bool|null $rtl

$size

Font size.

private float|int $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

$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
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
since
0.12.0

getColor()

Get font color.

public getColor() : string
Return values
string

getFallbackFont()

Get html fallback generic font.

public getFallbackFont() : 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

getLineHeight()

Get line height.

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

getName()

Get font name.

public getName() : string
Return values
string

getPosition()

Get position.

public getPosition() : int
Return values
int

getScale()

Get scale.

public getScale() : int
Return values
int

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|null
Return values
string|null

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>

getUnderline()

Get underline.

public getUnderline() : string
Return values
string

getWhiteSpace()

Get html css white-space value.

public getWhiteSpace() : 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|null
Return values
bool|null

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|null
Return values
bool|null

isSmallCaps()

Get small caps.

public isSmallCaps() : bool
Return values
bool

isStrikethrough()

Get strikethrough.

public isStrikethrough() : bool|null
Return values
bool|null

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

setFallbackFont()

Set generic font for fallback for html.

public setFallbackFont(string $value) : self
Parameters
$value : string

generic font name

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|null $value = true ]) : self
Parameters
$value : bool|null = 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, 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
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

setWhiteSpace()

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
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

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

setNonEmptyVal()

Set default for null and empty value.

protected setNonEmptyVal(string|null $value, string $default) : string
Parameters
$value : string|null
$default : string
Return values
string

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

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

        
On this page

Search results