Table of Contents

Enum FontFileKind

Namespace
Egami.Fonts
Assembly
Egami.Fonts.dll

What kind of font data some bytes hold, as Probe(ReadOnlySpan<byte>) sees it.

public enum FontFileKind

Fields

Cff = 3

A bare Compact Font Format stream, as PDF embeds it in FontFile3.

Collection = 2

A TrueType or OpenType collection (.ttc, .otc) of several faces.

Sfnt = 1

A single TrueType or OpenType font (.ttf, .otf).

Unknown = 0

Not font data Egami recognizes.

Woff = 4

A WOFF file, which Egami reads from 2.7.2 on.

Woff2 = 5

A WOFF2 file, which Egami reads from 2.7.2 on.

Examples

// One face from a file; a collection takes an index. The bytes are read once and every table is parsed when first needed.
Typeface face = Typeface.FromFile(FontFile);
Console.WriteLine($"{face.FamilyName} {face.SubfamilyName}, {face.GlyphCount} glyphs, {face.UnitsPerEm} units per em");

// What a file holds, from its header alone.
FontProbe probe = FontLoader.Probe(File.ReadAllBytes(FontFile));
Console.WriteLine($"{probe.Kind}, {probe.FaceCount} face(s), {probe.Outlines} outlines");

// Damaged fonts load leniently with diagnostics; Strict throws instead.
var seen = new List<EgamiDiagnostic>();
var options = new FontLoadOptions { Context = EgamiContext.Default with { Diagnostics = seen.Add } };
Typeface lenient = Typeface.FromMemory(File.ReadAllBytes(FontFile), 0, options);