Struct FontProbe
The result of Probe(ReadOnlySpan<byte>).
public readonly record struct FontProbe : IEquatable<FontProbe>
- Implements
- Inherited Members
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);
Constructors
FontProbe(FontFileKind, int, FontOutlines?)
The result of Probe(ReadOnlySpan<byte>).
public FontProbe(FontFileKind Kind, int FaceCount, FontOutlines? Outlines)
Parameters
KindFontFileKindWhat the data is.
FaceCountintThe number of faces: 1 for a single font or CFF, the collection's count, 0 when unknown.
OutlinesFontOutlines?How the first face stores outlines, when that can be told from the header.
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);
Properties
FaceCount
The number of faces: 1 for a single font or CFF, the collection's count, 0 when unknown.
public int FaceCount { get; init; }
Property Value
Kind
What the data is.
public FontFileKind Kind { get; init; }
Property Value
Outlines
How the first face stores outlines, when that can be told from the header.
public FontOutlines? Outlines { get; init; }