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

Handle HTML5 <wbr> #1965

Closed
castedo opened this issue Sep 14, 2023 · 3 comments
Closed

Handle HTML5 <wbr> #1965

castedo opened this issue Sep 14, 2023 · 3 comments
Labels
feature New feature that should be supported
Milestone

Comments

@castedo
Copy link

castedo commented Sep 14, 2023

With version 59 the following test.html.txt generates test.pdf.

What is unexpected is that WeasyPrint seems to use the <wbr> as a reason to not break at all but rather let the text break out of the green fixed-width word-wrap: break-word paragraph, essentially the opposite of what wbr should cause.

I am not sure whether the HTML5 <wbr> element (Word Break Opportunity) should work in WeasyPrint. I am guessing there are only a few corner cases where this is valuable. <wbr> seems like a nice complement to white-space: nowrap to allow more control over where text should and should not be broken (but without adding a hyphen like &shy;). I was going to use <wbr> but now I am only using white-space: nowrap since <wbr> does not seem to work as expected in WeasyPrint.

@liZe
Copy link
Member

liZe commented Sep 14, 2023

Hi!

<wbr> is not supported at all, that’s why it doesn’t work, but…

Maybe it’s "just" a CSS oneliner. Could you try to add wbr::before { content: "\200B" } into your CSS? If it does work for you (seems to work for me), then the bug should be easy to fix in WeasyPrint 😄.

@castedo
Copy link
Author

castedo commented Sep 14, 2023

Nice, that does work for me! 👍 Smart thinking!

@liZe liZe added the feature New feature that should be supported label Sep 14, 2023
@liZe liZe changed the title HTML5 <wbr> element prevents line break rather than encourage it Handle HTML5 <wbr> Sep 14, 2023
@liZe liZe added this to the 60.0 milestone Sep 14, 2023
@liZe liZe closed this as completed in bc576d5 Sep 14, 2023
@liZe
Copy link
Member

liZe commented Sep 14, 2023

Nice, that does work for me! 👍 Smart thinking!

That’s already how br is already handled, and that wasn’t even my idea 😄.

netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this issue Oct 15, 2023
Version 60.1
------------

Released on 2023-09-29.

Bug fixes:

* `#1973 <https://github.com/Kozea/WeasyPrint/issues/1973>`_:
  Fix crash caused by wrong UTF-8 indices


Version 60.0
------------

Released on 2023-09-25.

New features:

* `#1903 <https://github.com/Kozea/WeasyPrint/issues/1903>`_:
  Print form fields
* `#1922 <https://github.com/Kozea/WeasyPrint/pull/1922>`_:
  Add support for textLength and lengthAdjust in SVG text elements
* `#1965 <https://github.com/Kozea/WeasyPrint/issues/1965>`_:
  Handle <wbr> tag
* `#1970 <https://github.com/Kozea/WeasyPrint/pull/1970>`_:
  Handle y offset of glyphs
* `#1909 <https://github.com/Kozea/WeasyPrint/issues/1909>`_:
  Add a --timeout option

Bug fixes:

* `#1887 <https://github.com/Kozea/WeasyPrint/pull/1887>`_:
  Fix footnote-call displayed incorrectly for some fonts
* `#1890 <https://github.com/Kozea/WeasyPrint/pull/1890>`_:
  Fix page-margin boxes layout algorithm
* `#1908 <https://github.com/Kozea/WeasyPrint/pull/1908>`_:
  Fix IndexError when rendering PDF version 1.4
* `#1906 <https://github.com/Kozea/WeasyPrint/issues/1906>`_:
  Apply text transformations to first-letter pseudo elements
* `#1915 <https://github.com/Kozea/WeasyPrint/pull/1915>`_:
  Avoid footnote appearing before its call
* `#1934 <https://github.com/Kozea/WeasyPrint/pull/1934>`_:
  Fix balance before "column-span: all"
* `#1935 <https://github.com/Kozea/WeasyPrint/issues/1935>`_:
  Only draw required glyph with OpenType-SVG fonts
* `#1595 <https://github.com/Kozea/WeasyPrint/issues/1595>`_:
  Don’t draw clipPath when defined after reference
* `#1895 <https://github.com/Kozea/WeasyPrint/pull/1895>`_:
  Don’t ignore min-width when computing cell size
* `#1899 <https://github.com/Kozea/WeasyPrint/pull/1899>`_:
  Fix named pages inheritance
* `#1936 <https://github.com/Kozea/WeasyPrint/pull/1936>`_:
  Avoid page breaks caused by children of overflow hidden boxes
* `#1943 <https://github.com/Kozea/WeasyPrint/issues/1943>`_:
  Use bleed area for page’s painting area
* `#1946 <https://github.com/Kozea/WeasyPrint/issues/1946>`_:
  Use margin box of children to define available width for leaders
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature that should be supported
Projects
None yet
Development

No branches or pull requests

2 participants