SlugText-Sharp
0.1.1
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
<PackageReference Include="SlugText-Sharp" Version="0.1.1" />
<PackageVersion Include="SlugText-Sharp" Version="0.1.1" />
<PackageReference Include="SlugText-Sharp" />
paket add SlugText-Sharp --version 0.1.1
#r "nuget: SlugText-Sharp, 0.1.1"
#:package SlugText-Sharp@0.1.1
#addin nuget:?package=SlugText-Sharp&version=0.1.1
#tool nuget:?package=SlugText-Sharp&version=0.1.1
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.slugbinaries.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
.slugbytes.
- One-shot call that generates and serializes
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
mainormaster: build and test. - Push a tag
vX.Y.Z: package and publish to NuGet usingNUGET_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 | Versions 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. |
-
net9.0
- FreeTypeSharp (>= 3.0.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.