@ascii-kit/font
- API documentation
Classes
Font
Represents a font that can be used to generate ASCII art.
Example
ts
import font1row from '@ascci-art/font-1row'
import { Font } from '@ascii-art/core'
const font = new Font( font1row )
console.log( await font.text( 'Boo!' ) )
Constructors
new Font()
ts
new Font(font: string): Font
Parameters
Parameter | Type |
---|---|
font | string |
Returns
Methods
metadata()
ts
metadata(): Promise<FontMeta>
Gets the metadata for the font.
Returns
Promise
<FontMeta
>
An object containing the metadata: - fig
: The font's layout data. - options
: The default options for the font. - numChars
: The number of characters in the font. - comment
: The font's comment.
text()
ts
text(text: string, options?: Options): Promise<string>
Generate a string of ASCII art from the given text, using the font that this class was constructed with.
Parameters
Parameter | Type | Description |
---|---|---|
text | string | The text to generate ASCII art from. |
options ? | Options | Options to pass to the underlying figlet.text method. |
Returns
Promise
<string
>
A promise that resolves with the generated ASCII art.