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

Is it possible to align text to the top? #104

Closed
YaxinCheng opened this issue Nov 16, 2021 · 2 comments
Closed

Is it possible to align text to the top? #104

YaxinCheng opened this issue Nov 16, 2021 · 2 comments

Comments

@YaxinCheng
Copy link

YaxinCheng commented Nov 16, 2021

Hi, I'm trying to generate a pdf from top to bottom, but the use_text accepts y as the distance to the bottom. What I am trying to achieve is to be able to export the pdf in different font sizes but all have the same top and bottom margin (5pt). However, given the current api, I can only set the bottom margin.

I want to have the ability to change fonts and font size, so it will be hard to calculate the distance to the bottom. Is there a way to do it yet? I was also looking into getting the height of a specific font size, but had no luck on that.

@YaxinCheng
Copy link
Author

Seems like it has already been answered: #49. I will close this for now

@fschutt
Copy link
Owner

fschutt commented Nov 20, 2021

Yeah well you need to use an extra crate for font parsing. I've written azul-text-layout for that purpose, but it's a separate crate.

"y as distance to the bottom" is a PDF limitation, that's how PDF files store the information internally. Whatever you use, you have to calculate that distance somehow.

If you don't need ultra-high performance you could also look into wkhtmltopdf solutions

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