Class: I2CE TextCell (4.1.6)
This article describes the class I2CE_TextCell .
- Child Classes:
- Location: Part of the module textlayout in the package TextLayout Tools 4.1.6-release
- Source: Defined in the file lib/I2CE_TextCell.php on line 21
- Author: Carl Leitner <litlfred@ibiblio.org>
A word-wrapping text cell class. Uses the i2ce_hyphen class.
Variables
$font_metric
protected @var I2CE_FontMetrics $font_metric the font we are using
- Defined in textlayout/lib/I2CE_TextCell.php on line 25
- Type: protected $font_metric
$encoding
protected @var I2CE_Encoding $encoding the encoding we are using
- Defined in textlayout/lib/I2CE_TextCell.php on line 30
- Type: protected $encoding
$space_char
The space character in this encoding
- Defined in textlayout/lib/I2CE_TextCell.php on line 35
- Type: protected string $space_char
$hyphen_char
The hyphen character in this encoding
- Defined in textlayout/lib/I2CE_TextCell.php on line 39
- Type: protected string $hyphen_char
$width
protected @var mixed $width the width of the cell (float or int)
- Defined in textlayout/lib/I2CE_TextCell.php on line 68
- Type: protected $width
$hyphen
protected @var I2CE_Hyphen $hyphen a hyphenation dictionary
- Defined in textlayout/lib/I2CE_TextCell.php on line 90
- Type: protected $hyphen
Methods
Greedy()
Word-wrap a paragraph using simple truncation. Assume no \n Removes all \r All white spaces are squased to a single space
- Defined in textlayout/lib/I2CE_TextCell.php on line 350
- Signature: protected function Greedy($paragraph,$text_lines)
- Parameters:
- $paragraph
- array $text_lines
the array to store the text lines. It starts appending on the last element of the array
Knuth()
- Defined in textlayout/lib/I2CE_TextCell.php on line 633
- Signature: protected function Knuth($paragraph,$text_lines)
- Parameters:
- $paragraph
- &$text_lines
Truncate()
Word-wrap a paragraph using simple truncation. Assume no \n Removes all \r All white spaces are squased to a single space
- Defined in textlayout/lib/I2CE_TextCell.php on line 268
- Signature: protected function Truncate($paragraph,$text_lines)
- Parameters:
__construct()
Construct a text cell object
- Defined in textlayout/lib/I2CE_TextCell.php on line 127
- Signature: public function __construct($font_metric,$hyphen,$encoding,$algorithm)
- Parameters:
- I2CE_FontMetric $font_metric
- I2CE_Hyphen $hyphen
default is null- Default Value: null
- &$encoding
- int $algorithm
the word wrapping algorithm: default = 'Greedy' @param I2CE_Encoding encoding -- the encoding we want to use- Default Value: 'Greedy'
getEncoding()
- Defined in textlayout/lib/I2CE_TextCell.php on line 45
- Signature: public function getEncoding($encoding)
- Parameters:
- $encoding
getFontMetric()
Get the font metrics to be used in calculating word-wrapping
- Defined in textlayout/lib/I2CE_TextCell.php on line 61
- Signature: public &function getFontMetric()
- Returns (By Reference): I2ce_FontMetric
$font_metric if null we are word-wrapping on characters
getHyphenDictionary()
Get the hyphenation dictionary to use
- Defined in textlayout/lib/I2CE_TextCell.php on line 105
- Signature: public function getHyphenDictionary()
- Returns: I2CE_Hyphen
$hyphen The hyphenation dictionary
getLineBreaks()
Function to get the line breaks in a paragraph for the text to fit in the current collumn @param string $paragraph The text we want to fit in the text column
- Defined in textlayout/lib/I2CE_TextCell.php on line 203
- Signature: public function getLineBreaks($text)
- Parameters:
- $text
- Returns: array
eof strings -- the rows of text
getParagraphs()
Function to split up a text based on newlines, or the characters corresponding to unicode codepoints:
- 0x2080 -- Line separator 0x2029 -- Paragraph separatory
Note: This works quickest if $text is ASCII friendly, then UTF-8, then in an arbitrary encoding
- Defined in textlayout/lib/I2CE_TextCell.php on line 152
- Signature: public function getParagraphs($text)
- Parameters:
- $text
- Returns: array
of (possibly multibyte) strings the paragraphs
getWidth()
Gets the column's width @param int/float $width
- Defined in textlayout/lib/I2CE_TextCell.php on line 82
- Signature: public function getWidth()
getWords()
- Defined in textlayout/lib/I2CE_TextCell.php on line 239
- Signature: public function getWords($paragraph)
- Parameters:
- $paragraph
setEncoding()
- Defined in textlayout/lib/I2CE_TextCell.php on line 41
- Signature: public function setEncoding($encoding)
- Parameters:
- $encoding
setFontMetric()
Set the font metrics to be used in calculating word-wrapping
- Defined in textlayout/lib/I2CE_TextCell.php on line 53
- Signature: public function setFontMetric($font_metric)
- Parameters:
- I2CE_FontMetric $font_metric
if null we are word-wrapping on characters
- I2CE_FontMetric $font_metric
setHyphenationDictionary()
Set the hyphenation dictionary to use
- Defined in textlayout/lib/I2CE_TextCell.php on line 97
- Signature: public function setHyphenationDictionary($hyphen)
- Parameters:
- I2CE_Hyphen $hyphen
The hyphenation dictionary If null, no hyphenation is used
- I2CE_Hyphen $hyphen
setWidth()
Set the column's width
- Defined in textlayout/lib/I2CE_TextCell.php on line 74
- Signature: public function setWidth($width)
- Parameters:
- $width
- Returns: numeric
$width
setWordWrapAlgorithm()
Set the algorithm to use for word wrapping
- Defined in textlayout/lib/I2CE_TextCell.php on line 116
- Signature: public function setWordWrapAlgorithm($algorithm)
- Parameters:
- int $algorithm Values are:
- 'Truncate'
- 'Greedy'
- 'Knuth'
- int $algorithm Values are: