Class CffOptions
What a bare CFF stream lacks and an sfnt would supply, for FromCff(ReadOnlyMemory<byte>, CffOptions?).
public sealed record CffOptions : IEquatable<CffOptions>
- Inheritance
-
CffOptions
- 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);
Properties
Default
Gets the default options: units per em from the FontMatrix and widths from the charstrings.
public static CffOptions Default { get; }
Property Value
LoadOptions
Gets the options for loading leniently or strictly.
public FontLoadOptions LoadOptions { get; init; }
Property Value
UnitsPerEm
Gets the units per em, or null to take it from the CFF FontMatrix (1000 when the matrix is absent).
public int? UnitsPerEm { get; init; }
Property Value
- int?
Widths
Gets the advance widths by glyph id in font units, such as the widths a PDF font dictionary gives, or null to take them from the charstrings. Glyphs past the end use their charstring width.
public IReadOnlyList<float>? Widths { get; init; }