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

Hyphenation with soft-hyphens (­) does not work #1722

Closed
mn4367 opened this Issue May 17, 2014 · 11 comments

Comments

Projects
None yet
4 participants
@mn4367
Contributor

mn4367 commented May 17, 2014

wkhtmltopdf no longer respects soft-hyphens so words are not broken at positions where a manual break is suggested. A sample document to test is here. This is a bit strange since this worked with earlier versions like 0.11.0rc2.

Tested with version 0.12.1-7fac78c on OS X (Carbon and Cocoa) and 0.12.1-c22928d on Windows 7 64 (MSVC 2013).

@ashkulz

This comment has been minimized.

Member

ashkulz commented May 19, 2014

Is it related to webkit bug 76392? I think that applying change I4248909e should possibly fix this issue, can you test it and confirm?

@ashkulz ashkulz added the NeedInfo label May 19, 2014

@mn4367

This comment has been minimized.

Contributor

mn4367 commented May 19, 2014

I'll try and report.

@mn4367

This comment has been minimized.

Contributor

mn4367 commented May 19, 2014

@ashkulz, great, after applying the changes you mentioned it works, many thanks!! There is only one caveat, the hyphen is too long (perhaps an endash, the same effect is true for version 0.11.0.rc2) as shown in the word majority in this example:

softhyphen

I digged a little deeper and just tried -webkit-hyphenate-character: '-'; in the CSS and luckily that also works:

softhyphen2

In fact it works better than with version 0.11.0rc2 where the hyphen sometimes isn't rendered with text-align: justify;.

This is case for documentation in my opinion.

@mn4367 mn4367 closed this May 19, 2014

@ashkulz ashkulz added Documentation and removed NeedInfo labels May 20, 2014

@ashkulz ashkulz added this to the 0.12.1 milestone May 20, 2014

@hertling

This comment has been minimized.

hertling commented May 22, 2014

How are you injecting the soft hyphens in the HTML?

@mn4367

This comment has been minimized.

Contributor

mn4367 commented May 22, 2014

In my example this was done manually. A popular solution for automatic hyphenation based on Javascript is Hyphenator.js.

@mn4367

This comment has been minimized.

Contributor

mn4367 commented May 22, 2014

I forgot to say that the above example only was possible after applying the patch @ashkulz mentioned, so with the current builds hyphenation is not yet possible.

@ashkulz

This comment has been minimized.

Member

ashkulz commented May 23, 2014

So should we merge the patch into our Qt?

@mn4367

This comment has been minimized.

Contributor

mn4367 commented May 24, 2014

My use cases for wkhtmltopdf require hyphenation. That is of course by no means representative, but for me the lack of it would have prevented using the current build. The patch contains only small changes, so I'm confident that it doesn't break other things, but that's not backed by thorough tests.

I vote for including the patch.

@mn4367 mn4367 reopened this May 24, 2014

@ashkulz ashkulz modified the milestones: future, 0.12.1 Jun 1, 2014

@ashkulz ashkulz added Verified and removed Documentation labels Jun 1, 2014

@ashkulz ashkulz modified the milestones: 0.12.2, future Jul 2, 2014

@ashkulz ashkulz closed this in 834273b Oct 20, 2014

@ashkulz ashkulz added Fixed and removed Verified labels Oct 20, 2014

ashkulz added a commit that referenced this issue Oct 21, 2014

@ashkulz

This comment has been minimized.

Member

ashkulz commented Oct 22, 2014

Please test this with the latest 0.12.2 test release available from the downloads page and report back if you find any problems.

@ashkulz

This comment has been minimized.

Member

ashkulz commented Jan 10, 2015

0.12.2 has been released, which includes changes related to this issue.

@xdestiny

This comment has been minimized.

xdestiny commented Feb 25, 2015

Can confirm that visible hyphenation is working in 0.12.2.1.

There is, however, one big difference to how hyphens are present in the PDF file. Copying or searching through a PDF with Acrobat becomes impossible (other PDF viewers like Foxit Reader might work).

This happens to text that has been prepared with ­ elements but has no visibly hyphenation in the PDF file because it does not need to fold around the document's edge, for example "major­ity" in the middle of a line. The text "majority" cannot be found in the document and will have spaces instead of the soft hyphens when copied to a text document. The example would appear as "major ity".

This was not true for PDFs created with 0.11rc1, although this may not directly relate to the issue at hand.

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