Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to get information about length/heigth of a string you're printing to a pdf #123

Closed
astrale-sharp opened this issue Jun 29, 2022 · 2 comments

Comments

@astrale-sharp
Copy link

astrale-sharp commented Jun 29, 2022

Hi!

I'm toying with the idea of writing an alternative to tex/latex, i want to keep the idea of boxes and glue (if you are familiar)

so i would like to know the rectangle in which a text you want to put on the pdf will be contained with.

I also would like to be able to align these boxes in a way that the text flows naturally, explanation :
the characters 'an' and 'd' don't have the same height, so the resulting boxes don't have the same height but i would like to known where to align them so we can read 'and' naturally.

Is it even possible? what do you think? Do you have advice ? Thanks!

If something is unclear, i can rephrase it, I'm not an English speaker

Thank you for this library and possibly your answer ❤️

@fschutt
Copy link
Owner

fschutt commented Jun 30, 2022

See issue #49 - you can use either my crate https://crates.io/crates/azul-text-layout or some other crate to calculate that. Your problem is called "font shaping" and it's very complex, so I didn't want to integrate it into a library

If you don't want to deal with that, use https://crates.io/crates/genpdf/0.2.0 (which is built on printpdf) instead

@fschutt fschutt closed this as completed Jun 30, 2022
@astrale-sharp
Copy link
Author

thank you so much for your answer! i'm going to explore :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants