Skip to main content

textparse_glyphs/
textparse_glyphs.rs

1//! Dump the Rust parser's raw glyphs for a page: `<pdf> <page_index>`.
2fn main() {
3    let path = std::env::args().nth(1).expect("pdf");
4    let pi: usize = std::env::args()
5        .nth(2)
6        .and_then(|s| s.parse().ok())
7        .unwrap_or(0);
8    let bytes = std::fs::read(&path).unwrap();
9    let gs = fleischwolf_pdf::textparse::debug_glyphs(&bytes, pi);
10    let s: String = gs.iter().map(|g| g.0).collect();
11    println!("{s}");
12    for (ch, ll, lr, lb, lt) in &gs {
13        eprintln!(
14            "{:?} x0={:7.2} x1={:7.2} yb={:7.2} yt={:7.2}",
15            ch, ll, lr, lb, lt
16        );
17    }
18}