Forum Bugs

Prince does not use <wbr/> opportunity

natevw
I have some table headers which do not lay out well unless I explicitly provide word-break opportunities. For reasons, in our codebase we are generating these in two different ways: one via direct entry of U+200B characters in our UTF-8 source code (Python strings) and the other via `<wbr/>` elements in our HTML templates.

I notice that when rendered by Prince, the former ("raw" U+200B character) do encourage word breaks when necessary (e.g. in narrow table headings) but the latter (wbr element) have no effect. This seems like a bug to me?


My first workaround attempt turned out to be sufficient, simply adding to our CSS the following:

wbr::after {
  content: "\200B";   /* WORKAROUND: https://www.princexml.com/forum/topic/4810 */
}


Makes the wbr elements behave in Prince as they did already in browsers and should according to MDN interpretation of HTML standard: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/wbr#notes

It looks like a very similar workaround was already noted on the forums at https://www.princexml.com/forum/topic/9/css-for-nobr-and-wbr-elements but as a "tip" rather than a bug report.

Edited by natevw

natevw
BTW somewhat related, perhaps not a bug but seems a bit sub-optimal behavior also related to these break markers: the U+200B character causes Prince to load and reference a system fallback font wherever used.

This is relatively harmless I guess, but seems a bit silly since there's no real glyph to draw and at least in our case it's the only reason "DejaVuSans" ends up getting included at all in the PDF output. Would it be possible to just pretend that character were present in the surrounding font or just a (non-loaded) generic codepoints face?



178 0 obj
<</Type /Font
/Subtype /TrueType
/BaseFont /PXAAAD+DejaVuSans
/FirstChar 1
/LastChar 1
/Widths [0]
/FontDescriptor 364 0 R
/ToUnicode 365 0 R>>
endobj

364 0 obj
<</Type /FontDescriptor
/FontName /DejaVuSans
/Ascent 928
/Descent -235
/ItalicAngle 0
/StemV 0
/CapHeight 0
/Flags 4
/FontBBox [-1020 -462 1793 1232]
/FontFile2 366 0 R>>
endobj

…

<</Font <</F1 106 0 R
/F2 107 0 R
/F3 108 0 R
/F4 178 0 R>>

…

/F1 18.0000 Tf
(Something/) Tj
/F4 18.0000 Tf
<01> Tj
/F1 18.0000 Tf
(s) Tj
59.2020 0.0000 Td
(omething something) Tj

Edited by natevw