Skip to content

Font.Metadata 1.3.0

Latest

Choose a tag to compare

@DmitryGaravsky DmitryGaravsky released this 02 Dec 19:21
21003b5

Font.Metadata 1.3.0 adds a lightweight way to check a possible font at a known offset. It also exposes the state of each face’s table directory when inspecting damaged or partially readable fonts.

Probe before inspecting

Use FontMetadataReader.Probe on a span starting at the candidate offset. The warmed span path uses zero managed allocations. The result distinguishes an unrecognized signature, a recognized format that failed a structural check, and a candidate ready for Inspect. Rejections carry a diagnostic code and location when available.

ReadOnlySpan<byte> candidate = buffer.AsSpan(offset);
FontProbeResult probe = FontMetadataReader.Probe(candidate);
if(probe.Status == FontProbeStatus.Candidate) {
    FontInspectionResult inspection = FontMetadataReader.Inspect(candidate.Slice(0, probe.Length));
    Console.WriteLine(inspection.Status);
}

Use Length only for the inspection slice. SFNT can omit final padding, and a TTC/OTC collection can include trailing bytes. When scanning a resource, resume at the next byte after a rejection and compute the resource hash over the original bytes. Probe examples and format rules

For a readable, seekable stream, ProbeStream checks the current position and restores it before returning. If you already know the container format, use ProbeAs or ProbeStreamAs and pass the same ExpectedFormat to Inspect or Read. This handles EOT files whose size field resembles an SFNT signature. Selecting the expected format

Find faces with usable table directories

Read face.DirectoryStatus even when table inventory is disabled. Choose Complete for fully verified declarations or include Partial to keep usable entries from a damaged directory. Other faces report Invalid, NotRead or Unsupported. Individual table statuses tell you whether the table contents could be read. Directory status reference

Upgrading from 1.2.0

The packages target .NET 10. Both public libraries passed API compatibility checks against 1.2.0. An existing compiled client reproduced its output on 49 inputs covering 62 faces. Reflection-based serializers can expose the new face property. CLI JSON retains schema version 1 and its existing optional table inventory.

Verification

On 2 December 2026, the local candidate at 3efff7e passed 1,125 product tests and 47 release-script checks. On the packaged reader, a scanner reproduced all 21 findings across 978 resources, including their offsets. SHA-256 verification covered all three NuGet packages and the portable CLI archive.

Font.Metadata on NuGet · SPDX adapter · CLI tool · GitHub Releases