Specimen Press inspects TrueType fonts and turns glyph outlines into readable SVG specimen sheets.
It exposes one Swift library and one command-line tool.
Use it when a font needs a compact, repeatable inspection artifact.
The output shows glyph coverage, font metrics, baselines, and decoded outline paths.
The bundled fixture makes the demo and tests run without network access or secrets.
- Parse head, cmap, hmtx, and glyf tables.
- Read loca, maxp, hhea, and optional name data.
- Decode simple and composite glyph outlines.
- Report metrics and Unicode coverage as FontSummary.
- Render an SVG specimen sheet for a TrueType font.
- Draw sample text, metric lines, and an uppercase glyph grid.
BinaryReader reads big-endian values with bounds checks.
TrueTypeFont validates the table directory and coordinates table parsing.
GlyphDecoder expands simple contours and composite components.
SpecimenRenderer maps outlines into a stable SVG layout.
The CLI keeps file access and output formatting outside the library.
Install Swift 5.9 or newer.
Clone the repository.
Run the bundled demo.
swift run specimen-press demo --output specimen.svgOpen specimen.svg in a browser or vector editor.
Inspect any TrueType font.
swift run specimen-press inspect /path/to/font.ttfRender a custom sheet.
swift run specimen-press render /path/to/font.ttf --output specimen.svg --sample "A SHORT FONT SAMPLE"Run tests and a release build.
swift test
swift build -c releaseThe bundled fixture reports stable values.
{
"familyName" : "Specimen Press",
"mappedCodePointCount" : 27,
"metrics" : {
"ascender" : 800,
"descender" : -200,
"lineGap" : 200,
"numberOfGlyphs" : 28,
"numberOfHorizontalMetrics" : 28,
"unitsPerEm" : 1000
}
}The demo writes one SVG file.
Wrote specimen.svg
Tests assert fixture metrics, coverage ranges, glyph outlines, SVG labels, and malformed input handling.
Local status: not run because Swift is unavailable in the supplied Windows environment.
CI runs swift test, a release build, and the bundled demo on macOS.
- The first release supports TrueType outlines in glyf.
- It does not parse CFF or CFF2 outlines.
- It reads cmap formats 4 and 12.
- It does not execute TrueType hinting instructions.
- It renders uppercase A-Z cells and uses glyph zero for missing sample characters.
- It inspects one font file at a time.
- It does not subset, edit, or write font files.
- Add CFF and CFF2 outline inspection.
- Add kerning and variable-font axis summaries.
- Add optional JSON and SVG snapshot fixtures.
- Add contour winding diagnostics.
The library and CLI use the MIT License.
The bundled fixture uses the CC0 1.0 Universal dedication in FONT-LICENSE.txt.