MSDF-Sharp 1.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package MSDF-Sharp --version 1.0.0
                    
NuGet\Install-Package MSDF-Sharp -Version 1.0.0
                    
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="MSDF-Sharp" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MSDF-Sharp" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="MSDF-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 MSDF-Sharp --version 1.0.0
                    
#r "nuget: MSDF-Sharp, 1.0.0"
                    
#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 MSDF-Sharp@1.0.0
                    
#: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=MSDF-Sharp&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=MSDF-Sharp&version=1.0.0
                    
Install as a Cake Tool

MSDFGen-Sharp

Raw MSDF Rendered Glyph
Raw MSDF A Rendered A
Original MSDF output High-quality rendered result

A comprehensive C# port of the original msdfgen and msdf-atlas-gen projects. This library provides high-quality Multi-channel Signed Distance Field (MSDF) generation for fonts and vector graphics, maintaining an almost 1:1 correspondence with the CLI and core functionality of Chlumsky's original implementation.

🏗 Project Architecture

The repository is organized into several components to separate core logic, extensions, and CLI tools:

Core

  • Msdfgen.Core: The heart of the project. Contains the fundamental algorithms for MSDF generation, including math utilities, edge coloring, and shape processing.
  • MsdfAtlasGen: Implements the logic for packing multiple glyphs into a single texture atlas and managing atlas metadata.
  • Msdfgen.Extensions: Provides integration with third-party libraries like FreeType and ImageSharp for font loading and image processing.

CLI Tools

  • MsdfAtlasGen.Cli: The primary command-line tool for generating font atlases and exporting metadata (FNT, JSON, etc.).
  • Msdfgen.Cli: A diagnostic CLI tool for generating single-glyph MSDFs and testing core features.

MSDFGen-Sharp is a port of the original msdfgen and msdf-atlas-gen projects. It is not a direct port of the original CLI tools. If you want to use the original CLI tools, you can find them here MSDFGen and here MSDFAtlasGen.

📦 Installation

To use MSDF-Sharp in your project, install the package from NuGet:

dotnet add package MSDF-Sharp

Alternatively, you can find it on NuGet.org.

✨ Key Features

  • Multi-channel Signed Distance Fields (MSDF): Superior sharpness for text rendering at any scale.
  • Font Atlas Generation: Efficiently pack multiple glyphs into a single texture.
  • Advanced Error Correction: Integrated "Indiscriminate" and "Auto" modes to eliminate artifacts.
  • Overlap Support: Properly handles complex glyphs with self-intersecting contours.
  • Multi-threaded: Built-in support for parallel glyph generation.
  • Compatibility: Generates standard BMFont (.fnt), JSON, and CSV metadata.

🛠 Building and Running

This project requires .NET 9.0 SDK. You can download it from here.

Refer to the MsdfAtlasGen.Cli and Msdfgen.Cli READMEs for more information on how to build and run the projects.

📄 License

This project is licensed under the MIT License. It utilizes several third-party libraries:

🎨 Showcase

Font Atlases and Renders

Below are examples of generated MSDF atlases and how they appear when rendered.

Font MSDF Atlas Rendered Showcase
Roboto Regular Roboto Atlas Roboto Render
Barbarian (Fantasy) Barbarian Atlas Barbarian Render
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
1.0.2 329 1/8/2026
1.0.1 100 1/8/2026
1.0.0 101 1/7/2026