NeoKolors.Tui.Fonts.Assets
2026.4.0-preview.4
dotnet add package NeoKolors.Tui.Fonts.Assets --version 2026.4.0-preview.4
NuGet\Install-Package NeoKolors.Tui.Fonts.Assets -Version 2026.4.0-preview.4
<PackageReference Include="NeoKolors.Tui.Fonts.Assets" Version="2026.4.0-preview.4" />
<PackageVersion Include="NeoKolors.Tui.Fonts.Assets" Version="2026.4.0-preview.4" />
<PackageReference Include="NeoKolors.Tui.Fonts.Assets" />
paket add NeoKolors.Tui.Fonts.Assets --version 2026.4.0-preview.4
#r "nuget: NeoKolors.Tui.Fonts.Assets, 2026.4.0-preview.4"
#:package NeoKolors.Tui.Fonts.Assets@2026.4.0-preview.4
#addin nuget:?package=NeoKolors.Tui.Fonts.Assets&version=2026.4.0-preview.4&prerelease
#tool nuget:?package=NeoKolors.Tui.Fonts.Assets&version=2026.4.0-preview.4&prerelease
NeoKolors.Tui.Fonts.Assets
NeoKolors.Tui.Fonts.Assets contains the default font definitions and a packaging mechanism for the
NeoKolors TUI
framework. It provides pre-compiled, out-of-the-box fonts embedded directly into the compiled
library and exposes an
easy mechanism to load and register them.
Built-in Fonts
The package includes three default NKFont designs:
- Bytesized: A clean, compact pixel-art styled font ideal for dense information layouts.
- Future: A modern, wide stylized font featuring high-tech and futuristic geometry.
- Dummy: A fallback/skeleton font representation used primarily for testing, debugging, and baseline verification.
Additionally, four built-in FIGlet (.flf) fonts with accompanying metadata are embedded:
- Standard: Classic FIGlet font designed by Glenn Chappell & Ian Chai.
- Shadow: 3D shadowed font designed by Glenn Chappell.
- Slant: Slanted FIGlet font designed by Glenn Chappell.
- Block: Heavy block FIGlet font designed by Glenn Chappell.
FIGlet font metadata is configured via embedded manifest.xml (located under Figlet/) or per-font
sidecar files (<FontName>.meta.xml).
Architecture & Built-in Compilation
Instead of checking in large pre-compiled binary resources, this project structures fonts in human-readable XML format during development.
Font Directory Structure
Each font under the project directory (e.g., Bytesized/) consists of:
manifest.nkfont: Links the config file and the map file.Config.xml: Configures variables like letter spacing, word spacing, ligatures, leading, baseline, and alignment markers.Map.xml: Maps character symbols/ligatures to specific.nkgglyph files..nkgFiles: Plain-text files containing ASCII art representations of character glyph layouts and their alignment points.
MSBuild Compilation Pipeline
On building the project, a custom MSBuild Target (CompileBuiltinFonts) executes before
PrepareResources:
- It dynamically loads the referenced
NeoKolors.Tui.Fonts.dllin-memory (avoiding file locks during development). - It invokes
CompileFontsTask, passing the configured fonts and output options. - For each font, the task validates timestamps against source files (skipping recompilation if
up-to-date), deserializes XML definitions, and compiles them into binary Protobuf (
.nkf) assets. - Output
.nkffiles are emitted into the configured output folder (default:nkf/). - Generated assets are automatically registered as
@(EmbeddedResource)with standard logical names (NeoKolors.Tui.Fonts.Assets.<FontName>.nkf) and registered with@(FileWrites)sodotnet cleanremoves them cleanly.
Configuring Font Compilation
You can control what fonts to compile and where to output them directly inside
NeoKolors.Tui.Fonts.Assets.csproj.
1. Setting the Output Directory
Set <FontOutputDir> to change where compiled .nkf assets are placed relative to the project
directory:
<PropertyGroup>
<FontOutputDir>nkf</FontOutputDir>
</PropertyGroup>
You can also override this from the command line:
dotnet build -p:FontOutputDir=compiled
2. Selecting Which Fonts to Compile
Declare the fonts to compile inside an <ItemGroup> using <Font> items:
<ItemGroup>
<Font Include="Bytesized" />
<Font Include="Future" />
<Font Include="Dummy" />
</ItemGroup>
- Add a font: Simply add
<Font Include="MyNewFont" />. - Exclude a font: Comment out or remove the corresponding
<Font Include="..." />item. - Auto-discovery fallback: If
<Font>items are omitted or empty,CompileFontsTaskautomatically detects all subdirectories in the project containing amanifest.nkfontorConfig.xmlfile.
3. Per-Font Customization
Each <Font> item supports metadata attributes to customize output naming or placement
individually:
<ItemGroup>
<Font Include="Bytesized" />
<Font Include="Future" OutputPath="custom/folder/Future.nkf" />
<Font Include="Dummy" OutputDir="test_artifacts" />
<Font Include="Fonts/CustomFontFolder" FontName="MyCustomFont" />
</ItemGroup>
| Metadata Attribute | Description | Default |
|---|---|---|
OutputPath / OutputFile / TargetFile |
Explicit destination file path or directory for the compiled .nkf |
$(FontOutputDir)/<FontName>.nkf |
OutputDir / OutputDirectory |
Directory override for this font | $(FontOutputDir) |
FontName / Name |
Override name used for the font asset and embedded resource | Name of source directory |
4. Incremental Compilation & Clean Support
- Up-To-Date Checking: The task inspects file timestamps of all source files in each font
directory against the target
.nkffile. If no source files have been modified, compilation is skipped. - Clean Support: Generated output files are tracked by MSBuild's
@(FileWrites). Runningdotnet cleanautomatically removes compiled.nkffiles.
Usage
AssetsProvider
The AssetsProvider class provides runtime access to these embedded assets.
1. Automatic Font Registration
If the compiler constant NK_FONTS_ENABLE_AUTO_REGISTRATION is defined in your build configuration,
AssetsProvider
uses a C# [ModuleInitializer] to automatically register all built-in fonts into
the FontAtlas
when the assembly
is loaded.
2. Manual Registration
To manually load and register these fonts into the global FontAtlas:
using NeoKolors.Tui.Fonts.Assets;
// Registers "Bytesized", "Future", and "Dummy"
AssetsProvider.RegisterFonts();
3. Direct Font Access
You can retrieve the deserialized NKFont instances directly:
using NeoKolors.Tui.Fonts;
using NeoKolors.Tui.Fonts.Assets;
NKFont? futureFont = AssetsProvider.Future;
NKFont? bytesizedFont = AssetsProvider.Bytesized;
if (futureFont != null)
{
// Ready for measurement or rendering
}
4. Stream Access
Stream access is available via AssetsProvider.GetFontStream(name). It resolves standard manifest
resource names (NeoKolors.Tui.Fonts.Assets.<FontName>.nkf) as well as subfolder-prefixed names
(*.nkf.<FontName>.nkf).
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | 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 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. net11.0 is compatible. |
-
net10.0
- NeoKolors.Tui.Fonts (>= 2026.4.0-preview.4)
-
net11.0
- NeoKolors.Tui.Fonts (>= 2026.4.0-preview.4)
-
net8.0
- NeoKolors.Tui.Fonts (>= 2026.4.0-preview.4)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on NeoKolors.Tui.Fonts.Assets:
| Package | Downloads |
|---|---|
|
NeoKolors.Tui
Package Description |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 2026.4.0-preview.4 | 57 | 11/15/2026 |
| 2026.4.0-preview.3 | 69 | 11/1/2026 |
| 2026.4.0-preview.2 | 65 | 10/30/2026 |
| 2026.4.0-preview.1 | 74 | 10/23/2026 |
| 2026.2.0-rc2.1 | 107 | 6/5/2026 |
| 2026.2.0-rc2 | 78 | 6/4/2026 |
| 2026.2.0-rc1 | 89 | 6/2/2026 |