FIGLet 2.0.12
dotnet add package FIGLet --version 2.0.12
NuGet\Install-Package FIGLet -Version 2.0.12
<PackageReference Include="FIGLet" Version="2.0.12" />
<PackageVersion Include="FIGLet" Version="2.0.12" />
<PackageReference Include="FIGLet" />
paket add FIGLet --version 2.0.12
#r "nuget: FIGLet, 2.0.12"
#:package FIGLet@2.0.12
#addin nuget:?package=FIGLet&version=2.0.12
#tool nuget:?package=FIGLet&version=2.0.12
π BYTEFORGE FIGLET SUITE β FIGLET .NET LIBRARY
βββββββ βββ ββββββββββββββββββββββββββββ βββββββ βββββββ βββββββ ββββββββ
ββββββββββββ ββββββββββββββββββββββββββββββββββββββββββββββββββββββ ββββββββ
ββββββββ βββββββ βββ ββββββ ββββββ βββ ββββββββββββββ ββββββββββ
ββββββββ βββββ βββ ββββββ ββββββ βββ ββββββββββββββ βββββββββ
ββββββββ βββ βββ βββββββββββ ββββββββββββ ββββββββββββββββββββ
βββββββ βββ βββ βββββββββββ βββββββ βββ βββ βββββββ ββββββββ
βββββββββββ βββββββ βββ βββββββββββββββββ βββββββββββ βββββββββββββββββββββββ
βββββββββββββββββββ βββ βββββββββββββββββ βββββββββββ βββββββββββββββββββββββ
ββββββ ββββββ βββββββ ββββββ βββ βββββββββββ ββββββ βββ ββββββ
ββββββ ββββββ ββββββ ββββββ βββ βββββββββββ ββββββ βββ ββββββ
βββ ββββββββββββββββββββββββββββ βββ ββββββββββββββββββββ βββ ββββββββ
βββ βββ βββββββ ββββββββββββββββ βββ ββββββββ βββββββ βββ βββ ββββββββ
ByteForge.FIGLet A fast, specβcompliant FIGLet engine for .NET.
π Overview
ByteForge.FIGLet is the C# / .NET implementation of the FIGLet rendering engine at the heart of the ByteForge FIGLet Suite.
It provides a robust and efficient implementation of the FIGLet specification, allowing you to create ASCII art from text using FIGLet fonts. It supports all standard FIGLet features including various smushing rules, layout modes, ANSI color preservation, and Unicode.
This library powers:
- The Visual Studio FIGLet Comment Generator extension
- The FIGPrint CLI
- Any .NET application that needs FIGLet rendering
β¨ Features
- π€ Render FIGLet text using any
.flffont - π Full FIGLet font (
.flf) file parsing and loading - ποΈ Automatic handling of compressed/zipped font files
- π¨ ANSI color support for terminal output
- π Unicode support including surrogate pairs
- π Paragraph formatting support
- βοΈ Supports Full Size, Kerning, and Smushing layout modes
- π§ Implements all official smushing rules
- π¦ Default embedded font included β works out of the box
- π No external dependencies, fast and lightweight
- π§± Multi-target: .NET Framework 4.7.2 through .NET 10.0
Sample Output
_ _ _ _ _ _ _ _ _
| || |___| | |___ \ \ / /__ _ _| |__| | |
| __ / -_) | / _ \_ \ \/\/ / _ \ '_| / _` |_|
|_||_\___|_|_\___( ) \_/\_/\___/_| |_\__,_(_)
|/
π Installation
Install via NuGet:
dotnet add package FIGLet
Or via the NuGet Package Manager UI β search for FIGLet.
π Quick Start
Basic Usage
using ByteForge.FIGLet;
// Load a font from a file (returns null if the file is not found)
var font = FIGFont.FromFile("standard.flf") ?? throw new FileNotFoundException("Font not found");
// Create a renderer
var renderer = new FIGLetRenderer(font);
// Render text
string asciiArt = renderer.Render("Hello, World!");
Console.WriteLine(asciiArt);
Using the Default Font
The library ships with a built-in default font β no file required:
using ByteForge.FIGLet;
var renderer = new FIGLetRenderer(FIGFont.Default);
Console.WriteLine(renderer.Render("Hello, World!"));
Static Rendering
For one-shot rendering without creating a renderer instance:
using ByteForge.FIGLet;
string asciiArt = FIGLetRenderer.Render("Hello, World!");
Console.WriteLine(asciiArt);
βοΈ Layout Modes
The library supports three layout modes:
| Mode | Value | Description |
|---|---|---|
LayoutMode.FullSize |
-1 |
No character compression β each character is rendered at full width |
LayoutMode.Kerning |
0 |
Characters are moved together until they touch but do not overlap |
LayoutMode.Smushing |
1 |
Characters are merged according to the font's smushing rules (default) |
using ByteForge.FIGLet;
var font = FIGFont.Default;
string fullSize = FIGLetRenderer.Render("Text", font, LayoutMode.FullSize);
string kerning = FIGLetRenderer.Render("Text", font, LayoutMode.Kerning);
string smushing = FIGLetRenderer.Render("Text", font, LayoutMode.Smushing);
π§© Smushing Rules
The library implements all official FIGLet smushing rules as defined in the FIGLet specification. The font file determines which rules are active.
| Rule | Flag | Description |
|---|---|---|
| Equal Character | 1 |
Two identical characters smush into one |
| Underscore | 2 |
Underscore is replaced by a character from the hierarchy |
| Hierarchy | 4 |
Characters from "higher" classes replace those from "lower" ones |
| Opposite Pair | 8 |
Matching bracket/parenthesis pairs smush into a vertical bar |
| Big X | 16 |
\ and / smush into X; > and < smush into = |
| Hardblank | 32 |
Two hardblanks smush into one hardblank |
You can inspect a font's active rules at runtime:
using ByteForge.FIGLet;
// FromFile returns null if the file is not found
var font = FIGFont.FromFile("standard.flf") ?? throw new FileNotFoundException("Font not found");
bool hasEqualCharRule = font.HasSmushingRule(SmushingRules.EqualCharacter);
bool hasUnderscoreRule = font.HasSmushingRule(SmushingRules.Underscore);
π Font Support
- Standard
.flffont files - Compressed
.flffiles inside.ziparchives (auto-detected viaFIGFontStream)
π¨ ANSI Color Support
The library preserves ANSI color codes through the rendering process, allowing you to create colorful FIGLet text in terminals:
using ByteForge.FIGLet;
var renderer = new FIGLetRenderer(
FIGFont.Default,
useANSIColors: true
);
string colorfulText = "\x1b[31mRed\x1b[0m \x1b[32mGreen\x1b[0m \x1b[34mBlue\x1b[0m";
Console.WriteLine(renderer.Render(colorfulText));
π Paragraph Mode
When enabled (the default), blank lines in the input produce separate FIGLet renderings spaced by the font's character height:
using ByteForge.FIGLet;
var renderer = new FIGLetRenderer(FIGFont.Default);
string paragraphs = "Paragraph 1\n\nParagraph 2";
Console.WriteLine(renderer.Render(paragraphs));
Output:
___ _ _
| _ \__ _ _ _ __ _ __ _ _ _ __ _ _ __| |_ / |
| _/ _` | '_/ _` / _` | '_/ _` | '_ \ ' \ | |
|_| \__,_|_| \__,_\__, |_| \__,_| .__/_||_| |_|
|___/ |_|
___ _ ___
| _ \__ _ _ _ __ _ __ _ _ _ __ _ _ __| |_ |_ )
| _/ _` | '_/ _` / _` | '_/ _` | '_ \ ' \ / /
|_| \__,_|_| \__,_\__, |_| \__,_| .__/_||_| /___|
|___/ |_|
π Unicode Support
The library fully supports Unicode characters including surrogate pairs. Characters not present in the font are skipped gracefully:
using ByteForge.FIGLet;
var renderer = new FIGLetRenderer(FIGFont.Default);
Console.WriteLine(renderer.Render("Hello π World!"));
Output:
_ _ _ _ __ __ _ _ _
| || |___| | |___ \ \ / /__ _ _| |__| | |
| __ / -_) | / _ \ \ \/\/ / _ \ '_| / _` |_|
|_||_\___|_|_\___/ \_/\_/\___/_| |_\__,_(_)
π API Reference
FIGFont
Handles font loading and storage.
| Member | Description |
|---|---|
FIGFont.Default |
Returns the built-in default font (lazy-loaded, cached) |
FIGFont.FromFile(path) |
Loads a font from a .flf or .zip file |
FIGFont.FromStream(stream) |
Loads a font from a Stream |
FIGFont.FromReader(reader) |
Loads a font from a TextReader |
FIGFont.FromArray(lines) |
Parses a font from a string[] |
.Height |
Character height in rows |
.HardBlank |
The hard-blank character |
.Characters |
Dictionary mapping character code point β glyph rows |
.SmushingRules |
Active smushing rules flags |
.PrintDirection |
0 = left-to-right, 1 = right-to-left |
.HasSmushingRule(rule) |
Tests whether a specific rule is active |
FIGLetRenderer
Core rendering engine.
| Member | Description |
|---|---|
new FIGLetRenderer(font, mode?, separator?, useANSIColors?, paragraphMode?) |
Create an instance |
FIGLetRenderer.Render(text, font?, mode?, separator?, useANSIColors?, paragraphMode?) |
Static one-shot render |
.Render(text) |
Render text using instance settings |
.LayoutMode |
Active LayoutMode |
.LineSeparator |
Line separator string (default: platform line separator) |
.UseANSIColors |
Whether to preserve ANSI color codes through rendering |
.ParagraphMode |
Whether blank lines produce separate FIGLet renders |
LayoutMode
enum LayoutMode
{
FullSize = -1, // No character compression
Kerning = 0, // Minimal spacing
Smushing = 1, // Full character overlap (default)
Default = 1,
}
SmushingRules
[Flags]
enum SmushingRules
{
None = 0,
EqualCharacter = 1,
Underscore = 2,
Hierarchy = 4,
OppositePair = 8,
BigX = 16,
HardBlank = 32,
}
π Implementation Details
FIGFont β Parses
.flffont files; supports loading from files, streams, readers, or string arrays; handles ZIP-compressed font files viaFIGFontStream; manages smushing rule configuration.FIGLetRenderer β Converts input text to FIGLet output; implements character smushing logic; handles different layout modes; processes ANSI color codes in a single pre-pass; supports paragraph formatting and RTL fonts.
LayoutMode β Enumeration controlling how characters are combined during rendering.
SmushingRules β Flags enumeration defining which character-combining rules are active.
β‘ Performance Considerations
- Default font is lazy-loaded once and cached for the application lifetime
- ANSI color codes are handled in a single pre-pass, not during rendering
- Surrogate pairs are supported without performance degradation
- Efficient string building throughout the rendering pipeline
π§ Used By
This library powers:
- Visual Studio FIGLet Comment Generator extension
- FIGPrint CLI tool
- Any .NET application that needs ASCII art banners
π Related Packages
- @byte-forge/figlet β The equivalent TypeScript / Node.js library (npm)
- FIGLet Comment Generator (VS Code) β VS Code extension
- FIGLet Comment Generator (Visual Studio) β Visual Studio 2022+ extension
π€ Contributing
Contributions are welcome! To contribute:
- Fork the repository
- Create a feature branch
- Commit your changes
- Open a Pull Request
π License
This library is licensed under the MIT License β see the LICENSE file for details.
π‘ Credits
- Original FIGLet concept by Frank, Ian & Glenn
- Implementations by Paulo Santos (ByteForge)
- FIGLet specification: figlet.org
Support
If you encounter any issues or have feature requests, please:
- Search existing issues
- Create a new issue if needed
Made with β€οΈ by Paulo Santos
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 is compatible. net5.0-windows was computed. net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 is compatible. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 is compatible. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 is compatible. net48 is compatible. net481 is compatible. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETCoreApp 3.1
- No dependencies.
-
.NETFramework 4.7.2
- No dependencies.
-
.NETFramework 4.8
- No dependencies.
-
.NETFramework 4.8.1
- No dependencies.
-
.NETStandard 2.0
- No dependencies.
-
.NETStandard 2.1
- No dependencies.
-
net10.0
- No dependencies.
-
net5.0
- No dependencies.
-
net6.0
- No dependencies.
-
net7.0
- No dependencies.
-
net8.0
- No dependencies.
-
net9.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.