Class Zend_Text_Figlet

Description

Zend_Text_Figlet is a PHP implementation of FIGlet

  • copyright: Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  • license: New BSD License

Located in /Text/Figlet.php (line 30)


	
			
Class Constant Summary
Variable Summary
Method Summary
 Zend_Text_Figlet __construct ([array|Zend_Config $options = null])
 string render (string $text, [string $encoding = 'UTF-8'])
 Zend_Text_Figlet setFont (string $font)
 Zend_Text_Figlet setHandleParagraphs (boolean $handleParagraphs)
 Zend_Text_Figlet setJustification (integer $justification)
 Zend_Text_Figlet setOutputWidth (integer $outputWidth)
 Zend_Text_Figlet setRightToLeft (integer $rightToLeft)
 Zend_Text_Figlet setSmushMode (integer $smushMode)
 boolean _addChar (string $char)
 void _appendLine ()
 void _clearLine ()
 void _getLetter (string $char)
 array _loadChar (resource $fp)
 void _loadFont (string $fontFile)
 void _putString (string $string)
 string _readMagic (resource $fp)
 void _setUsedSmush ()
 void _skipToEol (resource $fp)
 integer _smushAmount ()
 string _smushem (string $leftChar, string $rightChar)
 void _splitLine ()
 integer _uniOrd (string $c)
Variables
integer $_charHeight (line 117)

Height of the characters

  • access: protected
array $_charList = array() (line 74)

Array containing all characters of the current font

  • access: protected
array $_currentChar = null (line 242)

Current char

  • access: protected
integer $_currentCharWidth = 0 (line 200)

Current character width

  • access: protected
boolean $_fontLoaded = false (line 81)

Indicates if a font was loaded yet

  • access: protected
array $_fontOptions = array() (line 186)

Options of the current font

  • access: protected
integer $_fontSmush = 0 (line 138)

Smush defined by the font

  • access: protected
array $_germanChars = array(196, 214, 220, 228, 246, 252, 223) (line 96)

Latin-1 codes for German letters, respectively:

LATIN CAPITAL LETTER A WITH DIAERESIS = A-umlaut LATIN CAPITAL LETTER O WITH DIAERESIS = O-umlaut LATIN CAPITAL LETTER U WITH DIAERESIS = U-umlaut LATIN SMALL LETTER A WITH DIAERESIS = a-umlaut LATIN SMALL LETTER O WITH DIAERESIS = o-umlaut LATIN SMALL LETTER U WITH DIAERESIS = u-umlaut LATIN SMALL LETTER SHARP S = ess-zed

  • access: protected
boolean $_handleParagraphs = false (line 152)

Wether to handle paragraphs || not

  • access: protected
string $_hardBlank (line 110)

Hard blank character

  • access: protected
string $_inCharLine (line 221)

In character line

  • access: protected
integer $_inCharLineLength = 0 (line 228)

In character line length

  • access: protected
integer $_inCharLineLengthLimit = 0 (line 235)

Maximum in character line length

  • access: protected
integer $_justification = null (line 162)

Justification for the text, according to $_outputWidth

For using font default, this parameter should be null, else one of the values of Zend_Text_Figlet::JUSTIFICATION_*

  • access: protected
integer $_maxLength (line 124)

Max length of any character

  • access: protected
integer $_outlineLength = 0 (line 207)

Current outline length

  • access: protected
integer $_outlineLengthLimit = 0 (line 214)

Maxmimum outline length

  • access: protected
string $_output (line 256)

Current output

  • access: protected
array $_outputLine (line 249)

Current output line

  • access: protected
integer $_outputWidth = 80 (line 103)

Output width, defaults to 80.

  • access: protected
integer $_previousCharWidth = 0 (line 193)

Previous character width

  • access: protected
integer $_rightToLeft = null (line 172)

Direction of text-writing, namely right to left

For using font default, this parameter should be null, else one of the values of Zend_Text_Figlet::DIRECTION_*

  • access: protected
array $_skipOptions = array(
'options',
'config',
)
(line 263)

Option keys to skip when calling setOptions()

  • access: protected
integer $_smushMode = 0 (line 131)

Smush mode

  • access: protected
integer $_smushOverride = 0 (line 179)

Override font file smush layout

  • access: protected
integer $_userSmush = 0 (line 145)

Smush defined by the user

  • access: protected
Methods
Constructor __construct (line 276)

Instantiate the FIGlet with a specific font. If no font is given, the standard font is used. You can also supply multiple options via the $options variable, which can either be an array or an instance of Zend_Config.

  • access: public
Zend_Text_Figlet __construct ([array|Zend_Config $options = null])
render (line 427)

Render a FIGlet text

  • throws: Zend_Text_Figlet_Exception When $text it not properly encoded
  • throws: InvalidArgumentException When $text is not a string
  • access: public
string render (string $text, [string $encoding = 'UTF-8'])
  • string $text: Text to convert to a figlet text
  • string $encoding: Encoding of the input string
setConfig (line 318)

Set options from config object

  • access: public
Zend_Text_Figlet setConfig ( $config)
  • Zend_Config $config: Configuration for Zend_Text_Figlet
setFont (line 329)

Set a font to use

  • access: public
Zend_Text_Figlet setFont (string $font)
  • string $font: Path to the font
setHandleParagraphs (line 341)

Set handling of paragraphs

  • access: public
Zend_Text_Figlet setHandleParagraphs (boolean $handleParagraphs)
  • boolean $handleParagraphs: Wether to handle paragraphs or not
setJustification (line 354)

Set the justification. 0 stands for left aligned, 1 for centered and 2 for right aligned.

  • access: public
Zend_Text_Figlet setJustification (integer $justification)
  • integer $justification: Justification of the output text
setOptions (line 297)

Set options from array

  • access: public
Zend_Text_Figlet setOptions ( $options)
  • array $options: Configuration for Zend_Text_Figlet
setOutputWidth (line 367)

Set the output width

  • access: public
Zend_Text_Figlet setOutputWidth (integer $outputWidth)
  • integer $outputWidth: Output with which should be used for word wrapping and justification
setRightToLeft (line 381)

Set right to left mode. For writing from left to right, use Zend_Text_Figlet::DIRECTION_LEFT_TO_RIGHT. For writing from right to left, use Zend_Text_Figlet::DIRECTION_RIGHT_TO_LEFT.

  • access: public
Zend_Text_Figlet setRightToLeft (integer $rightToLeft)
  • integer $rightToLeft: Right-to-left mode
setSmushMode (line 395)

Set the smush mode.

Use one of the constants of Zend_Text_Figlet::SM_*, you may combine them.

  • access: public
Zend_Text_Figlet setSmushMode (integer $smushMode)
  • integer $smushMode: Smush mode to use for generating text
_addChar (line 658)

Attempts to add the given character onto the end of the current line.

Returns true if this can be done, false otherwise.

  • access: protected
boolean _addChar (string $char)
  • string $char: Character which to add to the output
_appendLine (line 580)

Appends the current line to the output

  • access: protected
void _appendLine ()
_clearLine (line 641)

Clears the current line

  • access: protected
void _clearLine ()
_getLetter (line 716)

Gets the requested character and sets current and previous char width.

  • access: protected
void _getLetter (string $char)
  • string $char: The character from which to get the letter of
_loadChar (line 1184)

Load a single character from the font file

  • access: protected
array _loadChar (resource $fp)
  • resource $fp: File pointer to the font file
_loadFont (line 967)

Load the specified font

  • throws: Zend_Text_Figlet_Exception When font file was not found
  • throws: Zend_Text_Figlet_Exception When GZIP library is required but not found
  • throws: Zend_Text_Figlet_Exception When font file is not readable
  • access: protected
void _loadFont (string $fontFile)
  • string $fontFile: Font file to load
_putString (line 554)

Puts the given string, substituting blanks for hardblanks. If outputWidth

is 1, puts the entire string; otherwise puts at most outputWidth - 1 characters. Puts a newline at the end of the string. The string is left- justified, centered or right-justified (taking outputWidth as the screen width) if justification is 0, 1 or 2 respectively.

  • access: protected
void _putString (string $string)
  • string $string: The string to add to the output
_readMagic (line 1139)

Reads a four-character magic string from a stream

  • access: protected
string _readMagic (resource $fp)
  • resource $fp: File pointer to the font file
_setUsedSmush (line 1122)

Set the used smush mode, according to smush override, user smsush and font smush.

  • access: protected
void _setUsedSmush ()
_skipToEol (line 1156)

Skip a stream to the end of line

  • access: protected
void _skipToEol (resource $fp)
  • resource $fp: File pointer to the font file
_smushAmount (line 733)

Returns the maximum amount that the current character can be smushed into the current line.

  • access: protected
integer _smushAmount ()
_smushem (line 842)

Given two characters, attempts to smush them into one, according to the current smushmode. Returns smushed character or false if no smushing can be done.

Smushmode values are sum of following (all values smush blanks):

1: Smush equal chars (not hardblanks) 2: Smush '_' with any char in hierarchy below 4: hierarchy: "|", "/\", "[]", "{}", "()", "<>" Each class in hier. can be replaced by later class. 8: [ + ] -> |, { + } -> |, ( + ) -> | 16: / + \ -> X, > + < -> X (only in that order) 32: hardblank + hardblank -> hardblank

  • access: protected
string _smushem (string $leftChar, string $rightChar)
  • string $leftChar: Left character to smush
  • string $rightChar: Right character to smush
_splitLine (line 596)

Splits inCharLine at the last word break (bunch of consecutive blanks).

Makes a new line out of the first part and appends it using appendLine(). Makes a new line out of the second part and returns.

  • access: protected
void _splitLine ()
_uniOrd (line 1211)

Unicode compatible ord() method

  • access: protected
integer _uniOrd (string $c)
  • string $c: The char to get the value from
Class Constants
DIRECTION_LEFT_TO_RIGHT = 0 (line 61)

Write directions

DIRECTION_RIGHT_TO_LEFT = 1 (line 62)
FONTFILE_MAGIC_NUMBER = 'flf2' (line 67)

Magic fontfile number

JUSTIFICATION_CENTER = 1 (line 55)
JUSTIFICATION_LEFT = 0 (line 54)

Justifications

JUSTIFICATION_RIGHT = 2 (line 56)
SMO_FORCE = 2 (line 49)
SMO_NO = 0 (line 47)

Smush mode override modes

SMO_YES = 1 (line 48)
SM_BIGX = 0x10 (line 39)
SM_EQUAL = 0x01 (line 35)

Smush2 layout modes

SM_HARDBLANK = 0x20 (line 40)
SM_HIERARCHY = 0x04 (line 37)
SM_KERN = 0x40 (line 41)
SM_LOWLINE = 0x02 (line 36)
SM_PAIR = 0x08 (line 38)
SM_SMUSH = 0x80 (line 42)

Documentation generated on Mon, 21 Jun 2010 15:23:05 -0400 by phpDocumentor 1.4.3