SharpAstro.Fonts 0.2.91

This package has a SemVer 2.0.0 package version: 0.2.91+3caf5d3574afac4fdee337e849b37f29dbcbc29f.
dotnet add package SharpAstro.Fonts --version 0.2.91
                    
NuGet\Install-Package SharpAstro.Fonts -Version 0.2.91
                    
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="SharpAstro.Fonts" Version="0.2.91" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SharpAstro.Fonts" Version="0.2.91" />
                    
Directory.Packages.props
<PackageReference Include="SharpAstro.Fonts" />
                    
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 SharpAstro.Fonts --version 0.2.91
                    
#r "nuget: SharpAstro.Fonts, 0.2.91"
                    
#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 SharpAstro.Fonts@0.2.91
                    
#: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=SharpAstro.Fonts&version=0.2.91
                    
Install as a Cake Addin
#tool nuget:?package=SharpAstro.Fonts&version=0.2.91
                    
Install as a Cake Tool

SharpAstro.Fonts

A pure-managed, MIT-licensed C# library for loading and rendering OpenType / TrueType fonts.

Status

All phases complete. TrueType hinting, CFF outlines, COLR v0/v1 color glyphs, bitmap emoji, variable fonts, PostScript Type 1, WOFF/WOFF2, and CJK variation selectors. 155 tests passing across outline, rasterizer, color, hinting, variation, and CJK baseline suites.

Goals

  • 100% managed C#, AOT-compatible, no native dependencies.
  • Cross-platform — targets net10.0, runs on x64 (Windows, Linux, macOS) and ARM64 (Windows on ARM, Apple Silicon, Linux ARM64). SIMD hot paths use Vector<T> to auto-scale across SSE2 / AVX2 / AVX-512 / AdvSIMD.
  • Thread-safe by construction (immutable font records, per-call rasterizer state, lock-free hinting snapshot cache).
  • MIT-licensed end to end. No code is copied from FreeType, SixLabors.Fonts, HarfBuzz, or other non-MIT sources.
  • Feature parity with the FreeType subset needed for PDF rendering and UI text.

Supported formats

Container formats

Format Notes
OpenType / TrueType (.otf, .ttf) SFNT versions 0x00010000, OTTO, true, typ1
TrueType Collection (.ttc) Per-face offset loading
WOFF1 Zlib-compressed SFNT
WOFF2 Brotli + glyf/loca transform reconstruction
PostScript Type 1 (.pfb) PFB binary container, eexec decryption

OpenType tables

Core
Tag Coverage
head Full
maxp v0.5 (CFF) and v1.0 (TrueType)
hhea / hmtx Full horizontal metrics
vhea / vmtx Full vertical metrics
Character mapping (cmap)
Format Description
0 Byte encoding (256-entry)
4 Segmented BMP (most common)
6 Trimmed table
12 Segmented full UCS-4
14 Unicode Variation Sequences (IVS / emoji VS)

Not implemented: formats 2 (high-byte CJK legacy), 8 (mixed 16/32), 13 (last-resort).

Outlines
Tag Coverage
loca Short and long offset formats
glyf Simple glyphs (full flag/coordinate decoding), composite glyphs (all transform variants, scaled/unscaled component offsets, composite instructions)
CFF CFF1: Type 2 charstring interpreter, CID-keyed fonts (FDSelect format 0 + 3), global + local subroutines

Not implemented: CFF2 (blend operator, uint32 INDEX counts).

TrueType hinting
Tag Coverage
cvt Full CVT array, scaled per ppem
fpgm Executed once at face load
prep Executed per size change

Full v40 grayscale interpreter: ~150 opcodes including DELTAP1/2/3, DELTAC1/2/3, ISECT, engine compensation, IUP, SHP/SHC/SHZ, all round modes, function defs, projection/freedom/dual vector setters. Per-(face, ppem) HintingSnapshot cache with thread-safe per-call clone.

Color
Tag Coverage
COLR v0: base glyph + layer records. v1: all 32 paint formats including Var* variants, full Porter-Duff composite modes (HSL non-separable modes fall back to SrcOver), ColorLine with Pad/Repeat/Reflect extend, VarIndexMap + embedded ItemVariationStore
CPAL v0 and v1 headers, multiple palettes, BGRA→RGBA conversion
CBLC Index formats 1, 2, 3. Formats 4/5 (sparse) parse but return empty
CBDT Image formats 17, 18 (metrics + PNG), 19 (PNG-only with shared metrics)

Not implemented: sbix (Apple bitmap strikes), non-PNG CBDT image formats.

Variable fonts
Tag Coverage
fvar Axis definitions, named instances, normalization
avar v1 segment maps (piecewise-linear remap)
gvar Full tuple variation: shared/private point numbers, packed deltas, composite component-offset deltas, phantom points
HVAR Advance-width variation via ItemVariationStore + DeltaSetIndexMap
VVAR Advance-height variation (mirrors HVAR)
MVAR Font-wide metric variation (all tags)
cvar CVT hint-program variation (packed tuples targeting CVT indices)

Not implemented: avar v2 (non-linear ItemVariationStore remapping).

Kerning / positioning
Tag Coverage
kern Microsoft v0, format 0 (ordered pairs with binary search)
GPOS LookupType 2 PairAdjustment: format 1 (per-glyph pair sets) and format 2 (class-based pair matrix), Coverage format 1+2, ClassDef format 1+2

Not implemented: Apple kern v1, kern format 2, GPOS lookup types 1/3–9.

Shared variation infrastructure
Component Coverage
ItemVariationStore Format 1, LONG_WORDS flag, piecewise-linear region scalars. Shared by HVAR, VVAR, MVAR, COLR v1
DeltaSetIndexMap Format 0 (uint16) and format 1 (uint32), variable entry sizes

Rasterizer

Feature Notes
Anti-aliased (smooth) Analytic coverage rasterizer
Mono fallback Binary threshold
SDF (signed distance field) For GPU text rendering
COLR v0/v1 renderer Full paint-tree walker into RGBA surface

PostScript Type 1

Feature Notes
.pfb binary container Segment markers, eexec decryption
Type 1 charstrings Full interpreter including seac accented composites
Encoding array + FontMatrix Standard encoding, custom encoding

Not implemented: .pfa ASCII format, standalone CID Type 0 (CID-keyed CFF is supported via the CFF1 parser).

License

MIT — see LICENSE.

Specifications used as reference

All public, freely-implementable specs:

Layout

src/SharpAstro.Fonts/                   pure library
tests/SharpAstro.Fonts.Tests/           xUnit v3 tests + font fixtures
benchmarks/SharpAstro.Fonts.Benchmarks/ BenchmarkDotNet perf suite

Development history

Developed in 12 phases, each validated against golden output:

  1. SFNT skeleton + cmap
  2. TrueType outlines (glyf/loca, composite glyphs)
  3. Smooth rasterizer (analytic coverage)
  4. CFF1 (Type 2 charstring interpreter, CID-keyed fonts)
  5. COLR v0/v1 + CPAL (paint tree, gradients, composite modes)
  6. CBDT bitmap glyphs (PNG emoji)
  7. Variable fonts (fvar/avar/gvar/cvar/HVAR/VVAR/MVAR)
  8. TrueType bytecode hinting (v40 grayscale, ~150 opcodes)
  9. PostScript Type 1 (.pfb)
  10. SDF rasterizer, kern/GPOS kerning, stroker, vertical metrics
  11. WOFF / WOFF2
  12. DIR.Lib integration (replaced FreeType native bindings)
Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  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 (1)

Showing the top 1 NuGet packages that depend on SharpAstro.Fonts:

Package Downloads
DIR.Lib

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.2.91 28 4/15/2026
0.2.81 23 4/14/2026
0.2.71 28 4/14/2026
0.2.61 88 4/14/2026
0.1.51 59 4/14/2026