Figgle.Fonts
0.6.1
See the version list below for details.
dotnet add package Figgle.Fonts --version 0.6.1
NuGet\Install-Package Figgle.Fonts -Version 0.6.1
<PackageReference Include="Figgle.Fonts" Version="0.6.1" />
<PackageVersion Include="Figgle.Fonts" Version="0.6.1" />
<PackageReference Include="Figgle.Fonts" />
paket add Figgle.Fonts --version 0.6.1
#r "nuget: Figgle.Fonts, 0.6.1"
#:package Figgle.Fonts@0.6.1
#addin nuget:?package=Figgle.Fonts&version=0.6.1
#tool nuget:?package=Figgle.Fonts&version=0.6.1
_____ _ _
| __|_|___ ___| |___
| __| | . | . | | -_|
|__| |_|_ |_ |_|___|
|___|___|
ASCII banner generation for .NET
Console.WriteLine(
FiggleFonts.Standard.Render("Hello, World!"));
Produces...
_ _ _ _ __ __ _ _ _
| | | | ___| | | ___ \ \ / /__ _ __| | __| | |
| |_| |/ _ \ | |/ _ \ \ \ /\ / / _ \| '__| |/ _` | |
| _ | __/ | | (_) | \ V V / (_) | | | | (_| |_|
|_| |_|\___|_|_|\___( ) \_/\_/ \___/|_| |_|\__,_(_)
|/
Alternatively, use Figgle's source generator to embed just the fonts you want into your assembly, or—if the text to render is known ahead of time—generate output during compilation, so you don't need to ship Figgle binaries with your app. See below for details.
The library bundles 265 FIGlet fonts in the Figgle.Fonts NuGet package. You can add your own if that's not enough!
Installation
Available via NuGet:
Install-Package Figgle
Targets .NET Standard 2.0, so runs pretty much anywhere. If you require .NET Standard 1.3, use package version 0.4.1.
Other samples
Using FiggleFonts.Graffiti:
___ ___ .__ .__ __ __ .__ .___._.
/ | \ ____ | | | | ____ / \ / \___________| | __| _/| |
/ ~ \_/ __ \| | | | / _ \ \ \/\/ / _ \_ __ \ | / __ | | |
\ Y /\ ___/| |_| |_( <_> ) \ ( <_> ) | \/ |__/ /_/ | \|
\___|_ / \___ >____/____/\____/ /\ \__/\ / \____/|__| |____/\____ | __
\/ \/ )/ \/ \/ \/
Using FiggleFonts.ThreePoint:
|_| _ || _ \ / _ _| _||
| |(/_||(_), \/\/ (_)| |(_|.
Using FiggleFonts.Ogre:
_ _ __ __ _ _ _
/\ /\___| | | ___ / / /\ \ \___ _ __| | __| | / \
/ /_/ / _ \ | |/ _ \ \ \/ \/ / _ \| '__| |/ _` |/ /
/ __ / __/ | | (_) | \ /\ / (_) | | | | (_| /\_/
\/ /_/ \___|_|_|\___( ) \/ \/ \___/|_| |_|\__,_\/
|/
Using FiggleFonts.Rectangles:
__
_____ _ _ _ _ _ _ _| |
| | |___| | |___ | | | |___ ___| |_| | |
| | -_| | | . |_ | | | | . | _| | . |__|
|__|__|___|_|_|___| | |_____|___|_| |_|___|__|
|_|
Using FiggleFonts.Slant:
__ __ ____ _ __ __ ____
/ / / /__ / / /___ | | / /___ _____/ /___/ / /
/ /_/ / _ \/ / / __ \ | | /| / / __ \/ ___/ / __ / /
/ __ / __/ / / /_/ / | |/ |/ / /_/ / / / / /_/ /_/
/_/ /_/\___/_/_/\____( ) |__/|__/\____/_/ /_/\__,_(_)
|/
Loading external fonts
Figgle ships with a bunch of fonts (in the FiggleFonts class). If you prefer, you can load your own.
Here's an example that loads a font from disk and renders some text with it:
using var fontStream = System.IO.File.OpenRead("myfont.flf");
var font = FiggleFontParser.Parse(fontStream);
var text = font.Render("Hello World, from My Font");
Using the Source Generator
Figgle has two source generators: one renders static text at compile time, the other embeds the font into your assembly.
Static text rendering
If the text you want Figgle to render is known at compile time, this section is for you.
Instead of having Figgle render text at runtime, you can use Figgle's source generator to do the rendering at compile time. This has two benefits:
- Faster runtime performance, as no Figgle code is executed
- Less memory consumption, as no Figgle code is loaded
- Smaller application footprint, as you don't need to ship Figgle binaries
In your code:
using Figgle;
namespace MyNamespace;
[GenerateFiggleText("HelloWorldString", "blocks", "Hello world")]
internal partial class MyClass
{
}
By adding this attribute to a partial class, Figgle will automatically generate the corresponding member in another part of the partial class, resembling:
namespace MyNamespace;
partial class MyClass
{
public static string HelloWorldString { get; } = "...rendered text here...";
}
If you want to use an external font, include the external font file as an additional file in your csproj:
<ItemGroup>
<AdditionalFiles Include="myfont.flf" />
</ItemGroup>
Then specify the font's file name (excluding the extension) as the font name in the attribute:
[GenerateFiggleText("HelloWorldString", "myfont", "Hello world")]
Alternatively, you can specify a custom font name using the FontName item metadata:
<ItemGroup>
<AdditionalFiles Include="myfont.flf" FontName="MyCustomFontName" />
</ItemGroup>
[GenerateFiggleText("HelloWorldString", "MyCustomFontName", "Hello world")]
Note the font name specified in the GenerateFiggleText attribute is case-insensitive so mycustomfontname works too.
Embedding fonts
If you know the font you want to use to render, but the text to render is dynamic during runtime (e.g. user input), you can use the source generator to embed the font into your assembly.
By embedding only the fonts you want into your assembly, you can avoid having to ship all of built-in figgle fonts with your application, reducing the deploy size and memory usage of your application.
In your code:
using Figgle;
namespace MyNamespace;
[EmbedFiggleFont(memberName: "MyFont", fontName: "blocks")]
internal static partial class MyClass
{
}
This will cause the source generator to generate a static property of type FiggleFont in the MyClass type, which you can use to render text:
using Figgle;
namespace MyNamespace;
internal partial class MyClass
{
public static FiggleFont MyFont { get; }
}
You can then use the font the same way you use a built-in font:
using Figgle;
namespace MyNamespace;
string text = MyClass.MyFont.Render("Hello, World!");
Console.WriteLine(text);
Similar to GenerateFiggleText, external fonts are also supported. Include the external font file as an additional file in your csproj
the same way as before:
<ItemGroup>
<AdditionalFiles Include="myfont.flf" FontName="MyExternalFont" />
</ItemGroup>
Then specify the font's font name as specified in AdditionalFiles
(filename without the extension is also recognized if FontName property is not defined):
[EmbedFiggleFont(memberName: "MyFont", fontName: "MyExternalFont")]
Source generator diagnostics
| Rule ID | Category | Severity | Notes |
|---|---|---|---|
| FGL0001 | Figgle | Error | The specified font name was not found. |
| FGL0002 | Figgle | Error | The attribute specified an invalid member name. |
| FGL0003 | Figgle | Error | The member specified by the attribute has already been declared. |
| FGL0004 | Figgle | Error | The type must be partial. |
| FGL0005 | Figgle | Error | Figgle generation does not support nested types. |
| FGL0006 | Figgle | Error | There were errors when trying to read the external font. |
| FGL0007 | Figgle | Error | Type must static. |
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. 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 was computed. 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 was computed. 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 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| 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. |
-
.NETStandard 2.0
- Figgle (>= 0.6.1)
NuGet packages (5)
Showing the top 5 NuGet packages that depend on Figgle.Fonts:
| Package | Downloads |
|---|---|
|
Delfin.Core.Infrastructure
An Infrastructure Layer library designed for Clean Architecture in .NET applications. This package provides the implementation of cross-cutting concerns such as data access, external service integration, and configuration management, ensuring that the application layers remain decoupled from infrastructure details. |
|
|
ConsoleNexusEngine
A powerful and easy to use engine to create console games |
|
|
IoTSharp
Open-source IoT Platform - Device management, data collection, processing and visualization. |
|
|
Hell0_TDD.Core
A lightweight C# class library built with Test-Driven Development (TDD). Provides an ASCII text renderer using Figgle fonts. Designed as a portfolio project to demonstrate clean commit history, unit testing with xUnit, and the Red → Green → Refactor workflow. |
|
|
HanaFramework.Infrastructure
A modern, production-ready .NET framework built on Clean Architecture principles. |
GitHub repositories (2)
Showing the top 2 popular GitHub repositories that depend on Figgle.Fonts:
| Repository | Stars |
|---|---|
|
dotnetcore/AgileConfig
基于.NET Core开发的轻量级分布式配置中心 / .NET Core lightweight configuration server
|
|
|
IoTSharp/IoTSharp
IoTSharp is an open-source IoT platform for data collection, processing, visualization, and device management.
|