setasign\SetaPDF2\Core\Canvas\GraphicState

Text A class representing a text graphic state.

File: /SetaPDF v2/Core/Canvas/GraphicState/Text.php
Old class name (alias): \SetaPDF_Core_Canvas_GraphicState_Text

Class hierarchy

Summary

Constants

CHARACTER_SPACING

public const string Text::CHARACTER_SPACING = 'characterSpacing'

Data name constant

FONT

public const string Text::FONT = 'font'

Data name constant

FONT_SIZE

public const string Text::FONT_SIZE = 'fontSize'

Data name constant

LEADING

public const string Text::LEADING = 'leading'

Data name constant

LINE_MATRIX

public const string Text::LINE_MATRIX = 'lineMatrix'

Data name constant

RENDERING_MODE

public const string Text::RENDERING_MODE = 'renderingMode'

Data name constant

RISE

public const string Text::RISE = 'rise'

Data name constant

SCALING

public const string Text::SCALING = 'scaling'

Data name constant

TEXT_MATRIX

public const string Text::TEXT_MATRIX = 'textMatrix'

Data name constant

WORD_SPACING

public const string Text::WORD_SPACING = 'wordSpacing'

Data name constant


Properties

$_graphicState

The main graphic state from which this text graphic state is inherited/created from.


Methods

__construct()

The constructor.

Parameters
$graphicState : \SetaPDF_Core_Canvas_GraphicState
 

_getFontBBoxVector()

Get a font bounding box vector.

Parameters
$index : int
 
Exceptions

Throws \setasign\SetaPDF2\Core\Exception

_getValue()

protected Text::_getValue (
string $name,
mixed $default
): mixed

Get a value by walking through the graphic stack.

Parameters
$name : string
 
$default : mixed
 

_setValue()

protected Text::_setValue (
string $name,
mixed $value
): void

Sets a value in the current graphic stack.

Parameters
$name : string
 
$value : mixed
 

begin()

public Text::begin (
void
): $this

Begins a text object in the graphic state.

cleanUp()

WARNING: This method is marked as deprecated!

Unused

public Text::cleanUp (
void
): void

Release cycled references.

end()

public Text::end (
void
): $this

Ends a text object in the graphic state.

getBottomUserSpace()

Get the bottom bearing line value in user space coordinate system.

Exceptions

Throws \setasign\SetaPDF2\Core\Exception

getCharacterSpacing()

public Text::getCharacterSpacing (
void
): int|float

Gets the current character spacing value.

getFont()

Gets the current font instance.

getFontSize()

public Text::getFontSize (
void
): float|false

Gets the current font size.

getLeading()

public Text::getLeading (
void
): mixed

Gets the current leading value.

getLineMatrix()

Gets the current line transformation matrix.

getRenderingMode()

public Text::getRenderingMode (
void
): int

Get the current rendering mode value.

getRise()

public Text::getRise (
void
): float|int

Gets the current text rise value.

getScaling()

public Text::getScaling (
void
): mixed

Gets the current scaling value.

getTextMatrix()

Gets the current text transformation matrix.

getTopUserSpace()

Get the top bearing line value in user space coordinate system.

Exceptions

Throws \setasign\SetaPDF2\Core\Exception

getWordSpacing()

public Text::getWordSpacing (
void
): int|float

Gets the current word spacing value.

moveToNextLine()

public Text::moveToNextLine (
float $x,
float $y,
bool $setLeading = false
): $this

Move to the next line.

The "'" operator.

Parameters
$x : float
 
$y : float
 
$setLeading : bool
 

moveToNextLineAndShowText()

public Text::moveToNextLineAndShowText (
string $text,
?float $wordSpacing = null,
?float $charSpacing = null
): $this

Moves to the start of the next line and shows a text string.

Parameters
$text : string
 
$wordSpacing : ?float
 
$charSpacing : ?float
 
Exceptions

Throws \setasign\SetaPDF2\Core\Exception

moveToStartOfNextLine()

Move to the start of the next line.

The "T*" operator.

setCharacterSpacing()

public Text::setCharacterSpacing (
float $characterSpacing
): $this

Sets the current character spacing value.

Parameters
$characterSpacing : float
 

setFont()

public Text::setFont (): $this

Sets the current font and size.

Parameters
$font : \SetaPDF_Core_Font_FontInterface
 
$size : float
 

setLeading()

public Text::setLeading (
float $leading
): $this

Sets the current leading value.

Parameters
$leading : float
 

setLineMatrix()

public Text::setLineMatrix (
float|\SetaPDF_Core_Geometry_Matrix $aOrMatrix,
?float $b = null,
?float $c = null,
?float $d = null,
?float $e = null,
?float $f = null
): $this

Sets the current line matrix.

Parameters
$aOrMatrix : float|\SetaPDF_Core_Geometry_Matrix
 
$b : ?float
 
$c : ?float
 
$d : ?float
 
$e : ?float
 
$f : ?float
 

setRenderingMode()

public Text::setRenderingMode (
int $renderingMode
): $this

Sets the current rendering mode.

Parameters
$renderingMode : int
 

setRise()

public Text::setRise (
float $rise
): $this

Sets the text rise value.

Parameters
$rise : float
 

setScaling()

public Text::setScaling (
float $scaling
): $this

Sets the current scaling value.

Parameters
$scaling : float
 

setTextMatrix()

public Text::setTextMatrix (
float|\SetaPDF_Core_Geometry_Matrix $aOrMatrix,
?float $b = null,
?float $c = null,
?float $d = null,
?float $e = null,
?float $f = null
): $this

Sets the current text matrix.

Parameters
$aOrMatrix : float|\SetaPDF_Core_Geometry_Matrix
 
$b : ?float
 
$c : ?float
 
$d : ?float
 
$e : ?float
 
$f : ?float
 

setWordSpacing()

public Text::setWordSpacing (
float $wordSpacing
): $this

Sets the current word spacing value.

Parameters
$wordSpacing : float
 

showText()

Shows a text string.

Parameters
$text : string
 
Exceptions

Throws \setasign\SetaPDF2\Core\Exception

showTextStrings()

public Text::showTextStrings (
string|string[] $textStrings
): void

Shows text strings.

Parameters
$textStrings : string|string[]
 
Exceptions

Throws \setasign\SetaPDF2\Core\Exception

toTextSpace()

Converts a vectors values to the text space coordinate system.

Parameters
$vector : ?\SetaPDF_Core_Geometry_Vector
 

toUserSpace()

Converts a vectors values to the user space coordinate system.

Parameters
$vector : ?\SetaPDF_Core_Geometry_Vector