feat(pdftract-cv4): Type 0 composite font + descendant CIDFont loader

Implements `load_type0(font_dict)` following /DescendantFonts to the
CIDFont dictionary, classifying the descendant as CIDFontType0 or
CIDFontType2, reading /DW (default width), parsing /W array (two
formats: per-CID [c [w1 w2...]] and range [cfirst clast w]), and
producing Type0Font containing both parent and descendant.

Acceptance criteria met:
- Type0 font with CIDFontType2 descendant loads
- Widths from [10 [500 600]] resolve: CID 10 -> 500, CID 11 -> 600
- Range form [100 200 800] resolves: CIDs 100..=200 all -> 800
- Missing CID falls back to DW (default 1000)
- CIDFontType0 (CFF) descendant uses ttf-parser CFF entrypoint

Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
jedarden 2026-05-23 15:16:45 -04:00
parent 9cd8d306ac
commit 5e2390fa77
2 changed files with 1035 additions and 0 deletions

View file

@ -5,8 +5,10 @@
pub mod std14; pub mod std14;
pub mod embedded; pub mod embedded;
pub mod type0;
pub use embedded::{EmbeddedFont, FontMetrics, EmptyFontMetrics, GlyphBbox}; pub use embedded::{EmbeddedFont, FontMetrics, EmptyFontMetrics, GlyphBbox};
pub use type0::{Type0Font, DescendantCIDFont, CIDToGIDMap};
use crate::parser::object::types::{PdfDict, PdfObject}; use crate::parser::object::types::{PdfDict, PdfObject};

File diff suppressed because it is too large Load diff