pdftract/crates/pdftract-core/Cargo.toml
jedarden ffaaf690a0 feat(pdftract-6ah): implement embedded font program loader
- Add font::embedded module with TrueType/OpenType CFF/Type1 support
- Wrap ttf-parser/owned_ttf_parser for glyph metrics and cmap lookups
- Implement Type1Metrics with limited capability (Widths/FontBBox only)
- Add EmptyFontMetrics for corrupt/missing fonts
- Expose unified FontMetrics trait: glyph_id_for, advance, bbox, units_per_em
- Handle font subset prefixes (return None for unmapped chars)
- Decode font stream filters (FlateDecode, etc.)
- Emit FONT_PARSE_FAILED and FONT_UNSUPPORTED diagnostics
- Add 14 comprehensive tests for all acceptance criteria

Acceptance criteria:
✓ TrueType font loaded; glyph_id_for('A') matches Face cmap
✓ OpenType CFF font supported (same code path as TrueType)
✓ Type1 font gracefully wraps without CharStrings parser
✓ Corrupt font returns EmptyFontMetrics; emits diagnostic

Co-Authored-By: Claude Code <noreply@anthropic.com>
2026-05-23 14:28:29 -04:00

50 lines
1.2 KiB
TOML

[package]
name = "pdftract-core"
version.workspace = true
edition.workspace = true
rust-version.workspace = true
license.workspace = true
repository.workspace = true
publish = true
[dependencies]
anyhow = { workspace = true }
hex = "0.4"
indexmap = "2.2"
flate2 = { workspace = true }
lzw = { workspace = true }
regex = "1.10"
secrecy = { workspace = true }
serde = { version = "1.0", features = ["derive"], optional = true }
serde_json = { version = "1.0", optional = true }
sha2 = "0.10"
thiserror = { workspace = true }
memchr = { workspace = true }
unicode-normalization = { workspace = true }
ttf-parser = "0.24"
owned_ttf_parser = "0.21"
zstd = "0.13"
rayon = "1.10"
phf = "0.11"
[features]
default = ["serde"]
serde = ["dep:serde", "dep:serde_json"]
receipts = [] # Enable visual citation receipts (SVG clip generation)
proptest = []
fuzzing = [] # Enable cfg(fuzzing) for fuzz harnesses
[dev-dependencies]
chrono = "0.4"
proptest = "1.4"
quick-xml = "0.36"
regex = "1.10"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
tempfile = "3.10"
filetime = "0.2"
[build-dependencies]
phf_codegen = "0.11"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"