pdftract/crates
jedarden ece0442587 feat(pdftract-5f92): implement Type3 font loader
Implemented Type3Font struct and loader with:
- /CharProcs: HashMap of glyph name -> stream reference (strips "/" prefix)
- /FirstChar, /LastChar: character code range
- /Widths: per-code advance widths in glyph space
- /FontMatrix: 3x3 transform from glyph to text space (default [0.001 0 0 0.001 0 0])
- /Resources: optional resource dict for nested content streams
- /Encoding: code -> glyph name mapping (FontEncoding)

Key features:
- advance_for() applies FontMatrix[0] to scale glyph space to text space
- Missing /Widths defaults to all-zero with FONT_PARSE_FAILED diagnostic
- Widths length mismatch emits FONT_TYPE3_WIDTHS_LENGTH_MISMATCH
- Missing /CharProcs returns empty map (malformed but valid)
- Arbitrary glyph names supported (not limited to AGL)

Added FontType3WidthsLengthMismatch to diagnostics.rs severity() method.

Acceptance criteria:
- PASS: Valid Type3 font loads with all fields populated
- PASS: /FontMatrix [0.001 0 0 0.001 0 0]: width 500 -> 0.5 text-units
- PASS: /FontMatrix [1 0 0 1 0 0]: width 500 -> 500 text-units
- PASS: Missing /Widths defaults to all-zero with diagnostic
- PASS: Code outside [FirstChar, LastChar] returns advance 0, no panic

All 13 Type3 tests pass.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-24 01:07:18 -04:00
..
pdftract-cer-diff docs(pdftract-aawrz): add LICENSE-MIT and LICENSE-APACHE files 2026-05-23 10:36:28 -04:00
pdftract-cli feat(pdftract-3zhf): add unified TableDetector::detect entry point 2026-05-24 00:51:59 -04:00
pdftract-core feat(pdftract-5f92): implement Type3 font loader 2026-05-24 01:07:18 -04:00
pdftract-libpdftract feat(pdftract-juc): implement Standard 14 font metrics registry 2026-05-23 14:04:02 -04:00
pdftract-py docs(pdftract-aawrz): add LICENSE-MIT and LICENSE-APACHE files 2026-05-23 10:36:28 -04:00