FIGLet 1.0.1
See the version list below for details.
dotnet add package FIGLet --version 1.0.1
NuGet\Install-Package FIGLet -Version 1.0.1
<PackageReference Include="FIGLet" Version="1.0.1" />
<PackageVersion Include="FIGLet" Version="1.0.1" />
<PackageReference Include="FIGLet" />
paket add FIGLet --version 1.0.1
#r "nuget: FIGLet, 1.0.1"
#addin nuget:?package=FIGLet&version=1.0.1
#tool nuget:?package=FIGLet&version=1.0.1
FIGLet Core Library
A C# implementation of FIGLet (Frank, Ian & Glenn's letters) - a program for making large letters out of ordinary text.
Overview
This library 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 and layout modes.
Features
- Full FIGLet font (.flf) file parsing and loading
- Support for all standard FIGLet smushing rules:
- Equal Character
- Underscore
- Hierarchy
- Opposite Pair
- Big X
- Hard Blank
- Multiple layout modes:
- Full Size (no smushing)
- Kerning (minimal smushing)
- Smushing (full character overlap)
- ANSI color support for terminal output
- Thread-safe design
- Efficient string manipulation
- Comprehensive XML documentation
Usage
// Load a FIGLet font
var font = FIGFont.FromFile("standard.flf");
// Create a renderer
var renderer = new FIGLetRenderer(font);
// Render text
string asciiArt = renderer.Render("Hello World!", LayoutMode.Smushing);
Console.WriteLine(asciiArt);
Sample Output
Below is an example of text rendered using the default settings:
_ _ _ _ _ _ _ _ _
| || |___| | |___ \ \ / /__ _ _| |__| | |
| __ / -_) | / _ \_ \ \/\/ / _ \ '_| / _` |_|
|_||_\___|_|_\___( ) \_/\_/\___/_| |_\__,_(_)
|/
Layout Modes
The library supports three layout modes:
LayoutMode.FullSize
: No character compressionLayoutMode.Kerning
: Basic spacing adjustmentLayoutMode.Smushing
: Full character combining (default)
// Example with different layout modes
string fullSize = renderer.Render("Text", LayoutMode.FullSize);
string kerning = renderer.Render("Text", LayoutMode.Kerning);
string smushing = renderer.Render("Text", LayoutMode.Smushing);
ANSI Color Support
The library now supports ANSI color codes for terminal output, allowing you to create colorful FIGLet text:
// Create a renderer with ANSI color support enabled
var colorRenderer = new FIGLetRenderer(font, useANSIColors: true);
// Render text with ANSI colors
string colorfulText = "\u001b[31mRed\u001b[0m \u001b[32mGreen\u001b[0m \u001b[34mBlue\u001b[0m";
string colorfulAsciiArt = colorRenderer.Render(colorfulText);
Console.WriteLine(colorfulAsciiArt);
You can also enable color support when using the static rendering methods:
string colorfulAsciiArt = FIGLetRenderer.Render(colorfulText, font, LayoutMode.Smushing, useANSIColors: true);
Smushing Rules
The library implements all standard FIGLet smushing rules as defined in the FIGLet specification:
// Check if a specific smushing rule is enabled
bool hasEqualCharRule = font.HasSmushingRule(SmushingRules.EqualCharacter);
bool hasUnderscoreRule = font.HasSmushingRule(SmushingRules.Underscore);
Implementation Details
The library consists of four main components:
FIGFont
: Handles font loading and storage- Parses .flf font files
- Stores character data and font metadata
- Manages smushing rules configuration
FIGLetRenderer
: Core rendering engine- Converts input text to FIGLet output
- Implements character smushing logic
- Handles different layout modes
- Processes ANSI color codes
LayoutMode
: Enumeration defining rendering modes- Controls how characters are combined
SmushingRules
: Flags enumeration for smushing rules- Defines available character combining rules
Performance Considerations
- Uses
StringBuilder
for efficient string manipulation - Lazy initialization where appropriate
- Immutable design for thread safety
- Efficient regular expressions for whitespace handling
- Optimized character smushing calculations
- Intelligent ANSI color code handling
Requirements
- .NET 8.0 or higher
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Credits
- Original FIGLet concept by Frank, Ian & Glenn
- FIGLet specifications: http://www.org/
- Implementation 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 was computed. 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 was computed. 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.
-
net5.0
- No dependencies.
-
net6.0
- No dependencies.
-
net7.0
- No dependencies.
-
net8.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.