SetaPDF_Core_Text Helper class for writing and handling text

File: /SetaPDF v2/Core/Text.php

Class hierarchy

Summary

Constants

ALIGN_CENTER

public const string SetaPDF_Core_Text::ALIGN_CENTER = 'center'

Alignment constant

ALIGN_JUSTIFY

public const string SetaPDF_Core_Text::ALIGN_JUSTIFY = 'justify'

Alignment constant

ALIGN_JUSTIFY_ALL

public const string SetaPDF_Core_Text::ALIGN_JUSTIFY_ALL = 'justify-all'

Alignment constant

ALIGN_LEFT

public const string SetaPDF_Core_Text::ALIGN_LEFT = 'left'

Alignment constant

ALIGN_RIGHT

public 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 &$manualLineBreaks = array ( ) ]]]]]]
): 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
 
$manualLineBreaks : array
 
Return Values

An array of UTF-16BE encoded strings

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