MSDF-Sharp
1.0.0
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
<PackageReference Include="MSDF-Sharp" Version="1.0.0" />
<PackageVersion Include="MSDF-Sharp" Version="1.0.0" />
<PackageReference Include="MSDF-Sharp" />
paket add MSDF-Sharp --version 1.0.0
#r "nuget: MSDF-Sharp, 1.0.0"
#:package MSDF-Sharp@1.0.0
#addin nuget:?package=MSDF-Sharp&version=1.0.0
#tool nuget:?package=MSDF-Sharp&version=1.0.0
MSDFGen-Sharp
| Raw MSDF | Rendered Glyph |
|---|---|
| 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, andCSVmetadata.
🛠 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:
- Chlumsky msdfgen: MIT License.
- Chlumsky msdf-atlas-gen: MIT License.
- FreeTypeSharp: MIT License.
- SixLabors ImageSharp: Six Labors Split License.
- Note: For open-source projects or companies with <$1M USD annual gross revenue, this falls under the Apache License, Version 2.0.
🎨 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 | ||
| Barbarian (Fantasy) |
| 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
- MSDF-Sharp.Core (>= 1.0.0)
- MSDF-Sharp.Extensions (>= 1.0.0)
- Newtonsoft.Json (>= 13.0.3)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.