fschutt / printpdf

An easy-to-use library for writing PDF in Rust
https://docs.rs/printpdf/
MIT License
777 stars 95 forks source link

How To Use FontData for Calculating Width and Height of a Text #145

Closed alpaylan closed 10 months ago

alpaylan commented 10 months ago

I wanted to use FontData for calculating width and height of a text so I can do layouting, but I couldn't figure out a way to do it. Is that possible?

fschutt commented 10 months ago

See here: https://github.com/fschutt/printpdf/issues/39#issuecomment-559118743

Font parsing / shaping is deliberately not part of printpdf, because it's very complex, I wrote azul-text-layout to do that: https://crates.io/crates/azul-text-layout

alpaylan commented 10 months ago

Thanks!