API Documentation

Text/Figlet.php

Classes 
category
Zend
copyright
Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
license
http://framework.zend.com/license/new-bsd New BSD License
package
Zend_Text_Figlet
version
$Id: Figlet.php 20096 2010-01-06 02:05:09Z bkarwin $
Classes
Zend_Text_Figlet

Description

Zend Framework

LICENSE

This source file is subject to the new BSD license that is bundled with this package in the file LICENSE.txt. It is also available through the world-wide-web at this URL: http://framework.zend.com/license/new-bsd If you did not receive a copy of the license and are unable to obtain it through the world-wide-web, please send an email to license@zend.com so we can send you a copy immediately.

Zend_Text_Figlet

category
Zend
copyright
Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
license
http://framework.zend.com/license/new-bsd New BSD License
package
Zend_Text_Figlet
Constants
SM_EQUAL
SM_LOWLINE
SM_HIERARCHY
SM_PAIR
SM_BIGX
SM_HARDBLANK
SM_KERN
SM_SMUSH
SMO_NO
SMO_YES
SMO_FORCE
JUSTIFICATION_LEFT
JUSTIFICATION_CENTER
JUSTIFICATION_RIGHT
DIRECTION_LEFT_TO_RIGHT
DIRECTION_RIGHT_TO_LEFT
FONTFILE_MAGIC_NUMBER
Properties
$_charList
$_fontLoaded
$_germanChars
$_outputWidth
$_hardBlank
$_charHeight
$_maxLength
$_smushMode
$_fontSmush
$_userSmush
$_handleParagraphs
$_justification
$_rightToLeft
$_smushOverride
$_fontOptions
$_previousCharWidth
$_currentCharWidth
$_outlineLength
$_outlineLengthLimit
$_inCharLine
$_inCharLineLength
$_inCharLineLengthLimit
$_currentChar
$_outputLine
$_output
$_skipOptions
Methods
__construct
setOptions
setConfig
setFont
setHandleParagraphs
setJustification
setOutputWidth
setRightToLeft
setSmushMode
render
_putString
_appendLine
_splitLine
_clearLine
_addChar
_getLetter
_smushAmount
_smushem
_loadFont
_setUsedSmush
_readMagic
_skipToEol
_loadChar
_uniOrd

Description

Zend_Text_Figlet is a PHP implementation of FIGlet

Constants

SM_EQUAL

 SM_EQUAL = '0x01'

Smush2 layout modes

Details

value
0x01

SM_LOWLINE

 SM_LOWLINE = '0x02'

Details

value
0x02

SM_HIERARCHY

 SM_HIERARCHY = '0x04'

Details

value
0x04

SM_PAIR

 SM_PAIR = '0x08'

Details

value
0x08

SM_BIGX

 SM_BIGX = '0x10'

Details

value
0x10

SM_HARDBLANK

 SM_HARDBLANK = '0x20'

Details

value
0x20

SM_KERN

 SM_KERN = '0x40'

Details

value
0x40

SM_SMUSH

 SM_SMUSH = '0x80'

Details

value
0x80

SMO_NO

 SMO_NO = '0'

Smush mode override modes

Details

value
0

SMO_YES

 SMO_YES = '1'

Details

value
1

SMO_FORCE

 SMO_FORCE = '2'

Details

value
2

JUSTIFICATION_LEFT

 JUSTIFICATION_LEFT = '0'

Justifications

Details

value
0

JUSTIFICATION_CENTER

 JUSTIFICATION_CENTER = '1'

Details

value
1

JUSTIFICATION_RIGHT

 JUSTIFICATION_RIGHT = '2'

Details

value
2

DIRECTION_LEFT_TO_RIGHT

 DIRECTION_LEFT_TO_RIGHT = '0'

Write directions

Details

value
0

DIRECTION_RIGHT_TO_LEFT

 DIRECTION_RIGHT_TO_LEFT = '1'

Details

value
1

FONTFILE_MAGIC_NUMBER

 FONTFILE_MAGIC_NUMBER = 'flf2'

Magic fontfile number

Details

value
flf2

Properties

$_charHeight

integer $_charHeight = ''

Height of the characters

Details

$_charHeight
integer
visibility
protected
default
final
false
static
false

$_charList

array $_charList = 'array'

Array containing all characters of the current font

Details

$_charList
array
visibility
protected
default
array
final
false
static
false

$_currentChar

array $_currentChar = 'null'

Current char

Details

$_currentChar
array
visibility
protected
default
null
final
false
static
false

$_currentCharWidth

integer $_currentCharWidth = '0'

Current character width

Details

$_currentCharWidth
integer
visibility
protected
default
0
final
false
static
false

$_fontLoaded

boolean $_fontLoaded = 'false'

Indicates if a font was loaded yet

Details

$_fontLoaded
boolean
visibility
protected
default
false
final
false
static
false

$_fontOptions

array $_fontOptions = 'array'

Options of the current font

Details

$_fontOptions
array
visibility
protected
default
array
final
false
static
false

$_fontSmush

integer $_fontSmush = '0'

Smush defined by the font

Details

$_fontSmush
integer
visibility
protected
default
0
final
false
static
false

$_germanChars

array $_germanChars = 'array'

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

Details

$_germanChars
array
visibility
protected
default
array
final
false
static
false

$_handleParagraphs

boolean $_handleParagraphs = 'false'

Wether to handle paragraphs || not

Details

$_handleParagraphs
boolean
visibility
protected
default
false
final
false
static
false

$_hardBlank

string $_hardBlank = ''

Hard blank character

Details

$_hardBlank
string
visibility
protected
default
final
false
static
false

$_inCharLine

string $_inCharLine = ''

In character line

Details

$_inCharLine
string
visibility
protected
default
final
false
static
false

$_inCharLineLength

integer $_inCharLineLength = '0'

In character line length

Details

$_inCharLineLength
integer
visibility
protected
default
0
final
false
static
false

$_inCharLineLengthLimit

integer $_inCharLineLengthLimit = '0'

Maximum in character line length

Details

$_inCharLineLengthLimit
integer
visibility
protected
default
0
final
false
static
false

$_justification

integer $_justification = 'null'

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_*

Details

$_justification
integer
visibility
protected
default
null
final
false
static
false

$_maxLength

integer $_maxLength = ''

Max length of any character

Details

$_maxLength
integer
visibility
protected
default
final
false
static
false

$_outlineLength

integer $_outlineLength = '0'

Current outline length

Details

$_outlineLength
integer
visibility
protected
default
0
final
false
static
false

$_outlineLengthLimit

integer $_outlineLengthLimit = '0'

Maxmimum outline length

Details

$_outlineLengthLimit
integer
visibility
protected
default
0
final
false
static
false

$_output

string $_output = ''

Current output

Details

$_output
string
visibility
protected
default
final
false
static
false

$_outputLine

array $_outputLine = ''

Current output line

Details

$_outputLine
array
visibility
protected
default
final
false
static
false

$_outputWidth

integer $_outputWidth = '80'

Output width, defaults to 80.

Details

$_outputWidth
integer
visibility
protected
default
80
final
false
static
false

$_previousCharWidth

integer $_previousCharWidth = '0'

Previous character width

Details

$_previousCharWidth
integer
visibility
protected
default
0
final
false
static
false

$_rightToLeft

integer $_rightToLeft = 'null'

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_*

Details

$_rightToLeft
integer
visibility
protected
default
null
final
false
static
false

$_skipOptions

array $_skipOptions = 'array'

Option keys to skip when calling setOptions()

Details

$_skipOptions
array
visibility
protected
default
array
final
false
static
false

$_smushMode

integer $_smushMode = '0'

Smush mode

Details

$_smushMode
integer
visibility
protected
default
0
final
false
static
false

$_smushOverride

integer $_smushOverride = '0'

Override font file smush layout

Details

$_smushOverride
integer
visibility
protected
default
0
final
false
static
false

$_userSmush

integer $_userSmush = '0'

Smush defined by the user

Details

$_userSmush
integer
visibility
protected
default
0
final
false
static
false

Methods

__construct

__construct( array|Zend_Config $options = null ) :

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.

Arguments
$options
arrayZend_Config
Options for the output
Details
visibility
public
final
false
static
false

_addChar

_addChar( string $char ) : boolean

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

Returns true if this can be done, false otherwise.

Arguments
$char
string
Character which to add to the output
Output
boolean
Details
visibility
protected
final
false
static
false

_appendLine

_appendLine( ) : void

Appends the current line to the output

Details
visibility
protected
final
false
static
false

_clearLine

_clearLine( ) : void

Clears the current line

Details
visibility
protected
final
false
static
false

_getLetter

_getLetter( string $char ) : void

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

Arguments
$char
string
The character from which to get the letter of
Details
visibility
protected
final
false
static
false

_loadChar

_loadChar( resource $fp ) : array

Load a single character from the font file

Arguments
$fp
resource
File pointer to the font file
Output
array
Details
visibility
protected
final
false
static
false

_loadFont

_loadFont( string $fontFile ) : void

Load the specified font

Arguments
$fontFile
string
Font file to load
Details
visibility
protected
final
false
static
false
throws
When font file was not found
throws
When GZIP library is required but not found
throws
When font file is not readable

_putString

_putString( string $string ) : void

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.

Arguments
$string
string
The string to add to the output
Details
visibility
protected
final
false
static
false

_readMagic

_readMagic( resource $fp ) : string

Reads a four-character magic string from a stream

Arguments
$fp
resource
File pointer to the font file
Output
string
Details
visibility
protected
final
false
static
false

_setUsedSmush

_setUsedSmush( ) : void

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

Details
visibility
protected
final
false
static
false

_skipToEol

_skipToEol( resource $fp ) : void

Skip a stream to the end of line

Arguments
$fp
resource
File pointer to the font file
Details
visibility
protected
final
false
static
false

_smushAmount

_smushAmount( ) : integer

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

Output
integer
Details
visibility
protected
final
false
static
false

_smushem

_smushem( string $leftChar, string $rightChar ) : string

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

Arguments
$leftChar
string
Left character to smush
$rightChar
string
Right character to smush
Output
string
Details
visibility
protected
final
false
static
false

_splitLine

_splitLine( ) : void

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.

Details
visibility
protected
final
false
static
false

_uniOrd

_uniOrd( string $c ) : integer

Unicode compatible ord() method

Arguments
$c
string
The char to get the value from
Output
integer
Details
visibility
protected
final
false
static
false

render

render( string $text, string $encoding = UTF-8 ) : string

Render a FIGlet text

Arguments
$text
string
Text to convert to a figlet text
$encoding
string
Encoding of the input string
Output
string
Details
visibility
public
final
false
static
false
throws
When $text is not a string
throws
When $text it not properly encoded

setConfig

setConfig( Zend_Config $config ) : Zend_Text_Figlet

Set options from config object

Arguments
$config
Zend_Config
Configuration for Zend_Text_Figlet
Details
visibility
public
final
false
static
false

setFont

setFont( string $font ) : Zend_Text_Figlet

Set a font to use

Arguments
$font
string
Path to the font
Details
visibility
public
final
false
static
false

setHandleParagraphs

setHandleParagraphs( boolean $handleParagraphs ) : Zend_Text_Figlet

Set handling of paragraphs

Arguments
$handleParagraphs
boolean
Wether to handle paragraphs or not
Details
visibility
public
final
false
static
false

setJustification

setJustification( integer $justification ) : Zend_Text_Figlet

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

Arguments
$justification
integer
Justification of the output text
Details
visibility
public
final
false
static
false

setOptions

setOptions( array $options ) : Zend_Text_Figlet

Set options from array

Arguments
$options
array
Configuration for Zend_Text_Figlet
Details
visibility
public
final
false
static
false

setOutputWidth

setOutputWidth( integer $outputWidth ) : Zend_Text_Figlet

Set the output width

Arguments
$outputWidth
integer
Output with which should be used for word wrapping and justification
Details
visibility
public
final
false
static
false

setRightToLeft

setRightToLeft( integer $rightToLeft ) : Zend_Text_Figlet

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.

Arguments
$rightToLeft
integer
Right-to-left mode
Details
visibility
public
final
false
static
false

setSmushMode

setSmushMode( integer $smushMode ) : Zend_Text_Figlet

Set the smush mode.

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

Arguments
$smushMode
integer
Smush mode to use for generating text
Details
visibility
public
final
false
static
false
Documentation was generated by DocBlox.