PDF Output: Fix the option to break long words at the ends of lines causing boxes to be rendered at the end fo the line on macOS with some

fonts. Fixes #1951467 [Private bug](https://bugs.launchpad.net/calibre/+bug/1951467)
This commit is contained in:
Kovid Goyal 2021-11-19 11:05:29 +05:30
parent 1a8209a898
commit 0e2c29d2e3
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -31,7 +31,15 @@
if (is_block) avoid_page_breaks_inside(img); if (is_block) avoid_page_breaks_inside(img);
else if (img.parentNode && img.parentNode.childElementCount === 1) avoid_page_breaks_inside(img.parentNode); else if (img.parentNode && img.parentNode.childElementCount === 1) avoid_page_breaks_inside(img.parentNode);
} }
// Change the hyphenate character to a plain ASCII minus (U+002d) the default
// is U+2010 but that does not render with the default Times font on macOS as of Monterey
// and Qt 15.5 See https://bugs.launchpad.net/bugs/1951467 and can be easily reproduced
// by converting a plain text file with the --pdf-hyphenate option
for (const elem of document.getElementsByTagName('*')) {
if (elem.style) {
elem.style.setProperty('-webkit-hyphenate-character', '"-"', 'important');
}
}
})(); })();