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

Why is line_height not available directly in the write() function? #1256

Open
Alexis-Falquier opened this issue Sep 4, 2024 · 2 comments
Open

Comments

@Alexis-Falquier
Copy link

Currently to write a block of text and adjust the line height one would need to do this:

...
with pdf.text_columns(line_height=1.3) as text_block:
        text_block.write(text=<block of text>)
...

while it isnt much, it seems logical for the write() function to have the ability to manipulate the text it is writing and therefore have line height as a parameter, as such:
pdf.write(text=<block of text>, line_height=1.3)

In fact it would make sense that write() have most of the parameters available in text_columns() is there a reason that they are not?

@Lucas-C
Copy link
Member

Lucas-C commented Sep 4, 2024

Hi @Alexis-Falquier

For text regions, the goal is to group together the settings for rendering several lines of text:
https://py-pdf.github.io/fpdf2/TextRegion.html

However, if you need to render a single line of text, you can use:

I'll let @gmischler correct me if need be, as he designed the text regions API 🙂

@Lucas-C
Copy link
Member

Lucas-C commented Oct 14, 2024

Hi

Unless you want to add something on the subject @Alexis-Falquier and @gmischler, I'm probably going to close this issue before the end of the year 🙂

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

No branches or pull requests

2 participants