Fonts

A TrueType/CFF/Woff/Woff2 Loader and Layout Engine.

Discover the art of typography with SixLabors.Fonts, a versatile and powerful font handling library for .NET. Effortlessly render text in a multitude of styles and sizes across platforms. Whether you're creating stunning visuals or sophisticated layouts, SixLabors.Fonts is your key to unlocking exceptional typographic capabilities and enhancing your projects with advanced font parsing and precise text measurement capabilities.

Install anywhere

Fonts carries no native dependencies and can be installed anywhere that supports .NET 6+, Fonts can be used in device, cloud, and embedded/IoT scenarios.

PM > Install-Package SixLabors.Fonts

Simple yet powerful

Experience unmatched simplicity with our Fonts API, meticulously crafted to deliver the tools you need with minimal effort. Designed from the ground up for efficiency, our API empowers you to effortlessly create custom font collections. In turn, we provide comprehensive metrics and sophisticated tooling, ensuring seamless rendering of your fonts.

With SixLabors.Fonts, you gain access to a streamlined, powerful solution for all your font parsing and rendering needs

using SixLabors.Fonts;

FontCollection collection = new();
collection.Add("path/to/font.ttf");
collection.Add("path/to/font2.ttf");
collection.Add("path/to/emojiFont.ttf");
collection.AddCollection("path/to/font.ttc");

if(collection.TryFind("Font Name", out FontFamily family))
if(collection.TryFind("Emoji Font Name", out FontFamily emojiFamily))
{
    Font font = family.CreateFont(12, FontStyle.Italic);
    TextOptions options = new(font)
    {
        FallbackFontFamilies  = new []
        {
            // Will be used if a particular code point doesn't exist in
            // the font passed into the constructor. (e.g. emoji)
            emojiFamily
        }
    };
    FontRectangle rect = TextMeasurer.Measure("Text to measure", options);
}