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

Display hyphen when breaking words #403

Closed
sbrunecker opened this issue Nov 8, 2019 · 1 comment
Closed

Display hyphen when breaking words #403

sbrunecker opened this issue Nov 8, 2019 · 1 comment

Comments

@sbrunecker
Copy link

I need to generate documents with German strings that tend to be quite long. Before generating the html I separate words into syllables and add soft hyphens.

Consider the following example:

<table class="table table-bordered">
    <thead>
    <tr>
        <th>Spalte 1</th>
        <th>Spalte 2</th>
        <th>Spalte 3</th>
        <th>Spalte 4</th>
        <th>Spalte 5</th>

    </tr>
    </thead>
    <tbody>

    <tr>
        <td>Haft&shy;pflicht&shy;ver&shy;si&shy;che&shy;rung</td>
        <td>Bun­des­aus­bil­dungs­för­de­rungs­ge­setz</td>
        <td>Gleich­ge­wichts­dich­te­gra­di­en­ten­zen­tri­fu­ga­tion</td>
        <td>Hähn­chen­mast</td>
        <td>Er­trags­scha­den­ver­si­che­rung Mast­ge­flü­gel</td>
    </tr>
    </tbody>
</table>

In Chrome, a hyphen is displayed when printing this example:

image

When generating with openhtmltopdf, no hyphen is displayed:

image

How can I get hyphens as in Chrome?

danfickle added a commit that referenced this issue Nov 10, 2019
Replace soft hyphens with hard hyphens on new line split points. Still needs work for text justification with soft hyphens.

With failing test.
danfickle added a commit that referenced this issue Nov 15, 2019
+ Take into account letter spacing property when getting minimum width for table cell.
+ Tweak justification algorithm to allow more space between characters when there are no spaces in the line.

Two column tests had to be disabled because they were broken by the tweak to justiifcation. In the next commit I plan to allow the user to control the justification settings via CSS.
danfickle added a commit that referenced this issue Nov 16, 2019
Also, new proofs for column tests which use justified text as we have tweaked the justification algorithm.

Properties introduced to configure text justification are:
+ -fs-max-justification-inter-word
+ -fs-max-justification-inter-char

These properties can only be used on block and block-like (table cells) elements.

This commit should finish the soft-hyphen support which is now supported for normal, justified and custom letter-spacing.
@danfickle
Copy link
Owner

Thanks @sbrunecker,

Your concise and useful sample, as well as screenshots, allowed me to focus on implementing soft-hyphens rather than coming up with test cases. It should all work now including justification and letter-spacing support.

I'm planning a release in the near future unless something comes up.

Dan.

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