Fonts

A TrueType/Woff loader and renderer.

Install anywhere

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

PM > Install-Package SixLabors.Fonts -PreRelease

Simple yet powerful

Our Fonts API is unparalleled for it's ease of use; designed from the ground up to give you the tools you need with the minimum of effort. Easily create custom font collections and we'll provide you with all the metrics and tooling required to render them.

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);
}