SetaPDF_Core_Text Helper class for writing and handling text

File: /SetaPDF v2/Core/Text.php

Class hierarchy

Summary

Constants

ALIGN_CENTER

const string SetaPDF_Core_Text::ALIGN_CENTER = 'center'

Alignment constant

ALIGN_JUSTIFY

const string SetaPDF_Core_Text::ALIGN_JUSTIFY = 'justify'

Alignment constant

ALIGN_LEFT

const string SetaPDF_Core_Text::ALIGN_LEFT = 'left'

Alignment constant

ALIGN_RIGHT

const string SetaPDF_Core_Text::ALIGN_RIGHT = 'right'

Alignment constant


Static Properties

$possibleDelimiter

static public array SetaPDF_Core_Text::$possibleDelimiter = array(...)

Delimiter characters to recognize text blocks

Value 0 means that the character prefer breaking after that character e.g. ! or ?

Value 1 means that the character prefer breaking before that character e.g. + or :

$possibleGlueCharacters

static public array SetaPDF_Core_Text::$possibleGlueCharacters = array(...)

Characters that can ignore the delimiters and 'glues' multiple textblocks together


Static Methods

getLines()

public static SetaPDF_Core_Text::getLines (
string $text [, float $width = null [, SetaPDF_Core_Font_Glyph_Collection_CollectionInterface $font = null [, float $fontSize = null [, int $charSpacing = 0 [, int $wordSpacing = 0 ]]]]]
): array

Splits a UTF-16BE encoded string into lines based on a specific font and width.

Parameters
$text : string

The text encoded in UTF-16BE

$width : float
 
$font : SetaPDF_Core_Font_Glyph_Collection_CollectionInterface
 
$fontSize : float
 
$charSpacing : int
 
$wordSpacing : int
 
Return Values

An array of UTF-16BE encoded strings

Exceptions

Throws InvalidArgumentException

normalizeLineBreaks()

public static SetaPDF_Core_Text::normalizeLineBreaks (
string $text
): string

Normalizes line breaks in an UTF-16BE encoded string.

\r\n to \n \r to \n

Parameters
$text : string