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

Text wrapper not properly working with soft hyphens #457

Open
Janneman84 opened this issue Dec 26, 2015 · 1 comment
Open

Text wrapper not properly working with soft hyphens #457

Janneman84 opened this issue Dec 26, 2015 · 1 comment

Comments

@Janneman84
Copy link

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 "computers­creen­size­measurement­accuracy­category" 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?

@sampov2
Copy link

sampov2 commented Apr 21, 2016

This is an issue for me as well. I'd love to see a solution for this in upcoming versions!

RCBiczok added a commit to RCBiczok/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
Projects
None yet
Development

No branches or pull requests

3 participants