百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
F

Fonts

> 编程语言
开源

:black_nib: 字体加载和布局库。

347 stars0 点赞1 次浏览
访问官网GitHub

工具介绍

:black_nib: 字体加载和布局库。

SixLabors.Fonts

SixLabors.Fonts is a cross-platform library for loading, measuring, and laying out fonts and text. It supports TrueType and OpenType fonts (including CFF1 and CFF2 outlines), WOFF/WOFF2 web fonts, variable fonts, color fonts (COLR v0/v1 and SVG), and TrueType hinting. The library provides a full OpenType layout engine with GSUB/GPOS support, advanced text shaping for complex scripts, and bidirectional text rendering.

Fonts also exposes high-level text layout primitives for applications that need more than a single bounding box. Callers can measure advance, ink bounds, renderable bounds, lines, words, graphemes, and glyphs; reuse prepared text across multiple wrapping widths; inspect the resolved font used to shape and render fallback glyphs; and use built-in hit testing, caret placement, and selection geometry.

License

  • Fonts is licensed under the Six Labors Split License, Version 1.0

Support Six Labors

Support the efforts of the development of the Six Labors projects.

  • Purchase a Commercial License :heart:
  • Become a sponsor via GitHub Sponsors :heart:
  • Become a sponsor via Open Collective :heart:

Documentation

  • Detailed documentation for the Fonts API is available. This includes additional conceptual documentation to help you get started.
  • Our Samples Repository is also available containing buildable code samples demonstrating common activities.

Questions

  • Do you have questions? We are happy to help! Please join our Discussions Forum.
  • Please read our Contribution Guide before opening issues or pull requests!

Code of Conduct

This project has adopted the code of conduct defined by the Contributor Covenant to clarify expected behavior in our community.

Installation

Install stable releases via Nuget; development releases are available via Feedz.io.

Package Name Release (NuGet) Nightly (Feedz.io)
SixLabors.Fonts

Manual build

If you prefer, you can compile Fonts yourself (please do and help!)

  • Using Visual Studio 2022
    • Make sure you have the latest version installed
    • Make sure you have the .NET 8 SDK installed

Alternatively, you can work from command line and/or with a lightweight editor on both Linux/Unix and Windows:

  • Visual Studio Code with C# Extension
  • .NET Core

To clone Fonts locally, click the "Clone in [YOUR_OS]" button above or run the following git commands:

bash
git clone https://github.com/SixLabors/Fonts

If working with Windows please ensure that you have enabled log file paths in git (run as Administrator).

bash
git config --system core.longpaths true

Submodules

This repository contains git submodules. To add the submodules to the project, navigate to the repository root and type:

bash
git submodule update --init --recursive

LFS

This repository uses LFS Large File Storage. To configure it for the project, navigate to the repository root and type:

bash
git lfs install
bash
git lfs pull

Features

  • Reading font description (name, family, subname etc plus other string metadata).
  • Loading TrueType fonts and OpenType fonts with CFF1 and CFF2 outlines.
  • Loading WOFF and WOFF2 web fonts.
  • Loading all compatible fonts from the local machine store.
  • Support for variable fonts (fvar, gvar, cvar, CFF2 variations).
  • Support for color fonts (COLR v0/v1 and SVG).
  • TrueType hinting (FreeType v40-compatible interpreter).
  • Support for advanced OpenType layout via glyph substitution (GSUB) and glyph positioning (GPOS).
  • Advanced text shaping for complex scripts (Indic, Myanmar, Universal Shaping Engine).
  • Support for ligatures and kerning.
  • Support for rendering left to right, right to left, and bidirectional text.
  • Support for line breaking based on UAX 14.
  • Support for reusable prepared text layout via TextBlock.
  • Text measurement APIs for advance bounds, ink bounds, renderable bounds, line metrics, word metrics, grapheme metrics, and glyph metrics.
  • Glyph and grapheme metrics expose the resolved font used to shape and render each entry, including fallback fonts.
  • Text interaction helpers for hit testing, caret positioning, caret movement, and selection bounds.
  • Support for wrapping, trimming, ellipsis, hyphenation, tab width, tracking, line height, and horizontal and vertical layout modes.

API Examples

Read font description

csharp
FontDescription description = null;
using(var fs = File.OpenRead("Font.ttf")){
    description = FontDescription.Load(fs); // once it has loaded the data the stream is no longer required and can be disposed of
}

string name = description.FontName(CultureInfo.InvariantCulture);

Populating a font collection

csharp
FontCollection fonts = new FontCollection();
FontFamily font1 = fonts.Add("./path/to/font1.ttf");
FontFamily font2 = fonts.Add("./path/to/font2.woff");

How can you help?

Please... Spread the word, contribute algorithms, submit performance improvements, unit tests.

Projects using SixLabors.Fonts

  • SixLabors.ImageSharp.Drawing - cross platform, fully managed, image drawing library.

The SixLabors.Fonts Team

  • Scott Williams
  • Dirk Lemstra
  • Anton Firsov
  • James Jackson-South
  • Brian Popow

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

C#dotnetfontnetstandardopentype

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言