SlugText-Sharp 0.1.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package SlugText-Sharp --version 0.1.1
                    
NuGet\Install-Package SlugText-Sharp -Version 0.1.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="SlugText-Sharp" Version="0.1.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SlugText-Sharp" Version="0.1.1" />
                    
Directory.Packages.props
<PackageReference Include="SlugText-Sharp" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add SlugText-Sharp --version 0.1.1
                    
#r "nuget: SlugText-Sharp, 0.1.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package SlugText-Sharp@0.1.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=SlugText-Sharp&version=0.1.1
                    
Install as a Cake Addin
#tool nuget:?package=SlugText-Sharp&version=0.1.1
                    
Install as a Cake Tool

SlugText-Sharp

SlugText-Sharp is a C# implementation of Slug-style text rendering data generation. It compiles OpenType/TrueType fonts into a compact binary .slug payload ("SLUGGISH" format in this repository) that can be consumed by a GPU text renderer.

This repository contains:

  • SlugSharp.Core: library for generating and exporting .slug binaries.
  • SlugSharp.CLI: command-line utility around the core API.
  • renderingShaders/: reference HLSL shaders derived from the original Slug project shader approach.

Why use SlugText-Sharp

Compared to MSDF workflows, Slug-style generation can be significantly slower in exchange for simpler dynamic/on-the-fly generation. A commonly cited benchmark reports roughly one order of magnitude lower generation performance (about 10x slower) than MSDF in specific scenarios.

Reference: "Improved signed distance field generation for modern text rendering" (Lund University):

In practice, the model is still very attractive when you need:

  • Runtime/on-demand font asset generation.
  • A compact API with very few integration lines.
  • Good quality for scalable text rendering pipelines.

Install (NuGet)

dotnet add package SlugText-Sharp

Quick Start

using SlugSharp.Core;

var slugBytes = SlugCompiler.Compile(
    fontPath: "fonts/SpaceMono-Regular.ttf",
    options: new GeneratorOptions
    {
        BandCount = 16,
        FullRange = false,
        Whitelist = null
    });

File.WriteAllBytes("SpaceMono.slug", slugBytes);
SluggishParser.Validate(slugBytes); // optional sanity check

See full usage guide in docs/core-usage.md.

API Overview

  • SlugCompiler.Compile(string fontPath, GeneratorOptions? options = null)
    • One-shot call that generates and serializes .slug bytes.
  • SlugGenerator.Generate(string fontPath)
    • Lower-level call returning raw generation data before serialization.
  • SluggishWriter.Export(SlugGenerationRaw generatedData)
    • Serializes generated raw data to binary format.
  • SluggishParser.Validate(byte[] bytes)
    • Validates binary structure and texture blocks.

Release Automation

CI + NuGet publish is configured in .github/workflows/ci.yml.

  • Push/PR on main or master: build and test.
  • Push a tag vX.Y.Z: package and publish to NuGet using NUGET_API_KEY.

Local helper script (ignored from git):

./scripts/local/release.sh 0.2.0

This script updates SlugSharp.Core.csproj version, runs restore/build/test, commits, tags, and pushes.

Licensing

This project is licensed under the MIT License. See LICENSE.

Original Slug project by Eric Lengyel is dual-licensed (MIT or Apache-2.0):

Shader references in renderingShaders/ are derived from the Slug project and are credited accordingly.

For details, see docs/licensing-and-attribution.md.

Product Compatible and additional computed target framework versions.
.NET 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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.2 101 4/11/2026
0.1.1 93 4/11/2026