Zend\Text\Figlet\Figlet
Zend\Text\Figlet is a PHP implementation of FIGlet
Synopsis
class Figlet
{
- // constants
- const SM_EQUAL = 0x01;
- const SM_LOWLINE = 0x02;
- const SM_HIERARCHY = 0x04;
- const SM_PAIR = 0x08;
- const SM_BIGX = 0x10;
- const SM_HARDBLANK = 0x20;
- const SM_KERN = 0x40;
- const SM_SMUSH = 0x80;
- const SMO_NO = 0;
- const SMO_YES = 1;
- const SMO_FORCE = 2;
- const JUSTIFICATION_LEFT = 0;
- const JUSTIFICATION_CENTER = 1;
- const JUSTIFICATION_RIGHT = 2;
- const DIRECTION_LEFT_TO_RIGHT = 0;
- const DIRECTION_RIGHT_TO_LEFT = 1;
- const FONTFILE_MAGIC_NUMBER = 'flf2';
- // members
- protected array $charList;
- protected bool $fontLoaded;
- protected array $germanChars;
- protected integer $outputWidth;
- protected string $hardBlank;
- protected int $charHeight;
- protected int $maxLength;
- protected integer $smushMode;
- protected integer $fontSmush;
- protected integer $userSmush;
- protected bool $handleParagraphs;
- protected int $justification;
- protected int $rightToLeft;
- protected integer $smushOverride;
- protected array $fontOptions;
- protected integer $previousCharWidth;
- protected integer $currentCharWidth;
- protected integer $outlineLength;
- protected integer $outlineLengthLimit;
- protected string $inCharLine;
- protected integer $inCharLineLength;
- protected integer $inCharLineLengthLimit;
- protected array $currentChar;
- protected array $outputLine;
- protected string $output;
- protected array $skipOptions;
- // methods
- public void __construct()
- public Figlet setOptions()
- public Figlet setFont()
- public Figlet setHandleParagraphs()
- public Figlet setJustification()
- public Figlet setOutputWidth()
- public Figlet setRightToLeft()
- public Figlet setSmushMode()
- public string render()
- protected void _putString()
- protected void _appendLine()
- protected void _splitLine()
- protected void _clearLine()
- protected bool _addChar()
- protected void _getLetter()
- protected int _smushAmount()
- protected string _smushem()
- protected void _loadFont()
- protected void _setUsedSmush()
- protected string _readMagic()
- protected void _skipToEol()
- protected array _loadChar()
- protected int _uniOrd()
Constants
Name | Value |
---|---|
SM_EQUAL | 0x01 |
SM_LOWLINE | 0x02 |
SM_HIERARCHY | 0x04 |
SM_PAIR | 0x08 |
SM_BIGX | 0x10 |
SM_HARDBLANK | 0x20 |
SM_KERN | 0x40 |
SM_SMUSH | 0x80 |
SMO_NO | 0 |
SMO_YES | 1 |
SMO_FORCE | 2 |
JUSTIFICATION_LEFT | 0 |
JUSTIFICATION_CENTER | 1 |
JUSTIFICATION_RIGHT | 2 |
DIRECTION_LEFT_TO_RIGHT | 0 |
DIRECTION_RIGHT_TO_LEFT | 1 |
FONTFILE_MAGIC_NUMBER | 'flf2' |
Members
protected
- $charHeight
—
int
Height of the characters - $charList
—
array
Array containing all characters of the current font - $currentChar
—
array
Current char - $currentCharWidth
—
int
Current character width - $fontLoaded
—
Zend\Text\Figlet\bool
Indicates if a font was loaded yet - $fontOptions
—
array
Options of the current font - $fontSmush
—
int
Smush defined by the font - $germanChars
—
array
Latin-1 codes for German letters, respectively: - $handleParagraphs
—
Zend\Text\Figlet\bool
Whether to handle paragraphs || not - $hardBlank
—
string
Hard blank character - $inCharLine
—
string
In character line - $inCharLineLength
—
int
In character line length - $inCharLineLengthLimit
—
int
Maximum in character line length - $justification
—
int
Justification for the text, according to $outputWidth - $maxLength
—
int
Max length of any character - $outlineLength
—
int
Current outline length - $outlineLengthLimit
—
int
Maximum outline length - $output
—
string
Current output - $outputLine
—
array
Current output line - $outputWidth
—
int
Output width, defaults to 80. - $previousCharWidth
—
int
Previous character width - $rightToLeft
—
int
Direction of text-writing, namely right to left - $skipOptions
—
array
Option keys to skip when calling setOptions() - $smushMode
—
int
Smush mode - $smushOverride
—
int
Override font file smush layout - $userSmush
—
int
Smush defined by the user
Methods
protected
- _addChar() — Attempts to add the given character onto the end of the current line.
- _appendLine() — Appends the current line to the output
- _clearLine() — Clears the current line
- _getLetter() — Gets the requested character and sets current and previous char width.
- _loadChar() — Load a single character from the font file
- _loadFont() — Load the specified font
- _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.
- _readMagic() — Reads a four-character magic string from a stream
- _setUsedSmush() — Set the used smush mode, according to smush override, user smush and font smush.
- _skipToEol() — Skip a stream to the end of line
- _smushAmount() — Returns the maximum amount that the current character can be smushed into the current line.
- _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.
- _splitLine() — Splits inCharLine at the last word break (bunch of consecutive blanks).
- _uniOrd() — Unicode compatible ord() method
public
- __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\Config.
- render() — Render a FIGlet text
- setFont() — Set a font to use
- setHandleParagraphs() — Set handling of paragraphs
- setJustification() — Set the justification. 0 stands for left aligned, 1 for centered and 2 for right aligned.
- setOptions() — Set options from array
- setOutputWidth() — Set the output width
- setRightToLeft() — 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.
- setSmushMode() — Set the smush mode.