645. Class

645.1. Zend\Text\Figlet\Figlet

ZendTextFiglet is a PHP implementation of FIGlet

645.1.1. Methods

645.1.1.1. __construct

__construct()

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.

Parameters:array|Traversable – Options for the output

645.1.1.2. setOptions

setOptions()

Set options from array

Parameters:array – Configuration for Figlet
Return type:Figlet

645.1.1.3. setFont

setFont()

Set a font to use

Parameters:string – Path to the font
Return type:Figlet

645.1.1.4. setHandleParagraphs

setHandleParagraphs()

Set handling of paragraphs

Parameters:bool – Whether to handle paragraphs or not
Return type:Figlet

645.1.1.5. setJustification

setJustification()

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

Parameters:integer – Justification of the output text
Return type:Figlet

645.1.1.6. setOutputWidth

setOutputWidth()

Set the output width

Parameters:integer – Output with which should be used for word wrapping and justification
Return type:Figlet

645.1.1.7. setRightToLeft

setRightToLeft()

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

Parameters:integer – Right-to-left mode
Return type:Figlet

645.1.1.8. setSmushMode

setSmushMode()

Set the smush mode.

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

Parameters:integer – Smush mode to use for generating text
Return type:Figlet

645.1.1.9. render

render()

Render a FIGlet text

Parameters:
  • string – Text to convert to a figlet text
  • string – Encoding of the input string
Throws ExceptionInvalidArgumentException:
 

When $text is not a string

Throws ExceptionUnexpectedValueException:
 

When $text it not properly encoded

Return type:

string

645.1.1.10. _putString

_putString()

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.

Parameters:string – The string to add to the output
Return type:void

645.1.1.11. _appendLine

_appendLine()

Appends the current line to the output

Return type:void

645.1.1.12. _splitLine

_splitLine()

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.

Return type:void

645.1.1.13. _clearLine

_clearLine()

Clears the current line

Return type:void

645.1.1.14. _addChar

_addChar()

Attempts to add the given character onto the end of the current line. Returns true if this can be done, false otherwise.

Parameters:string – Character which to add to the output
Return type:bool

645.1.1.15. _getLetter

_getLetter()

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

Parameters:string – The character from which to get the letter of
Return type:void

645.1.1.16. _smushAmount

_smushAmount()

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

Return type:integer

645.1.1.17. _smushem

_smushem()

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

Parameters:
  • string – Left character to smush
  • string – Right character to smush
Return type:

string

645.1.1.18. _loadFont

_loadFont()

Load the specified font

Parameters:string – Font file to load
Throws ExceptionRuntimeException:
 When font file was not found
Throws ExceptionRuntimeException:
 When GZIP library is required but not found
Throws ExceptionRuntimeException:
 When font file is not readable
Throws ExceptionUnexpectedValueException:
 When font file is not a FIGlet 2 font file
Return type:void

645.1.1.19. _setUsedSmush

_setUsedSmush()

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

Return type:void

645.1.1.20. _readMagic

_readMagic()

Reads a four-character magic string from a stream

Parameters:resource – File pointer to the font file
Return type:string

645.1.1.21. _skipToEol

_skipToEol()

Skip a stream to the end of line

Parameters:resource – File pointer to the font file
Return type:void

645.1.1.22. _loadChar

_loadChar()

Load a single character from the font file

Parameters:resource – File pointer to the font file
Return type:array

645.1.1.23. _uniOrd

_uniOrd()

Unicode compatible ord() method

Parameters:string – The char to get the value from
Return type:integer

645.1.2. Constants

645.1.2.1. SM_EQUAL

Smush2 layout modes

645.1.2.2. SM_LOWLINE

645.1.2.3. SM_HIERARCHY

645.1.2.4. SM_PAIR

645.1.2.5. SM_BIGX

645.1.2.6. SM_HARDBLANK

645.1.2.7. SM_KERN

645.1.2.8. SM_SMUSH

645.1.2.9. SMO_NO

Smush mode override modes

645.1.2.10. SMO_YES

645.1.2.11. SMO_FORCE

645.1.2.12. JUSTIFICATION_LEFT

Justifications

645.1.2.13. JUSTIFICATION_CENTER

645.1.2.14. JUSTIFICATION_RIGHT

645.1.2.15. DIRECTION_LEFT_TO_RIGHT

Write directions

645.1.2.16. DIRECTION_RIGHT_TO_LEFT

645.1.2.17. FONTFILE_MAGIC_NUMBER

Magic fontfile number