-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Text wrapper not properly working with soft hyphens #457
Labels
Comments
This is an issue for me as well. I'd love to see a solution for this in upcoming versions! |
4 tasks
RudyBricks
added a commit
to RudyBricks/pdfkit
that referenced
this issue
Dec 26, 2023
blikblum
pushed a commit
that referenced
this issue
Jan 2, 2024
* Replace soft hyphen with visible hyphen if line break demands it * Add changelog entry for #457 * Add soft hyphen support in readme
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The linebreak logic doesn't seem to be designed to handle soft hyphens. These are characters that indicate where a word may be split in order to prevent a big gap as the end of a line.
http://www.fileformat.info/info/unicode/char/ad/index.htm
In my language composed words are written as one, so "computer screen" becomes "computerscreen". You understand that words can get potentially very long, like "computerscreensizemeasurementaccuracycategory" or something. I put some soft hyphens in this word so it breaks if it doesn't fit on one line so you probably see a dash now, try resizing the text field.
Typing soft hyphens is annoying because you can't usually see them, so it's advised to use unicode, like in JS you can type "I have a very big computer\u00ADscreen."
so Instead of this:
I have a very big
computerscreen.
you get:
I have a very big computer-
screen.
Long story short: in PDFKit all soft hyphen characters are typed as a dash and not just the one at the end of a line. It probably takes a bit of puzzling to get the sizing algorithms working correctly.
Is this something someone would like to look a little more in to?
The text was updated successfully, but these errors were encountered: