-
Notifications
You must be signed in to change notification settings - Fork 254
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
Justified text is not aligned left on the last line of every paragraph in a multi-cell #364
Comments
I reproduced the bug. Thanks for reporting it @gtnbssn |
Thanks for the ping, @Lucas-C Interesting catch! Fixing it will require to look ahead for each line, to see if the line after it (if any) is empty. At least that's what I would consider a reasonable criterion for "end of paragraph". Any other ideas? Do we need an option to switch paragraph recognition on and off? Edit: |
Would it make more sense to check if the line ends with a line feed / carriage return? We might not always have empty lines between paragraphs. |
Ah I see. So I apparently threw this under the bus when adding support for soft-hyphens to
That sounds better, yes. I had to recheck my understanding of the line wrapping code, and found some incorrect assumptions that I had made. Is there a practical use case for justifying a single line, or the last line of a paragraph, despite the usual typographical conventions? |
Ah indeed, i hadn't thought about this! We do have different rules which explain the space before the exclamation mark for instance... Sorry about that!
I am no expert so maybe others will be able to give a better opinion. But i would say no, at least not for regular typography. Maybe for a specific design? But in this case, anything goes anyway. Here's what another library is doing: https://pdfkit.org/docs/text.html And since they mention word processors: i don't think these offer the option you are describing. |
I was thinking poster or label design, where a single line fit into a given width is quite common (by various means).
Text processors typically not, but a page layout program might. |
I'd really like to include a fix for this as part of v2.5.2... |
Yes, I have just tested it and this is fixed indeed |
I was using 2.5.0, and when the text is justified, the last line of each paragraph was aligned left.
This looks better than justified text, given that the last line is shorter.
With 2.5.1, only the very last line of the multi-cell will be set this way. Last lines of other paragraphs will be justified, sometimes with a lot of blank space.
In the following example, this is mostly visible on page 3.
The text was updated successfully, but these errors were encountered: