mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
E-book viewer: Fix auto hyphenation on macOS not rendering the hyphens correctly. Fixes #1954714 [Ebook viewer: Breaking long words at the ends of lines causing boxes to be rendered instead of hyphens on macOS](https://bugs.launchpad.net/calibre/+bug/1954714)
This commit is contained in:
parent
141ff585c9
commit
cc96900aee
@ -35,6 +35,7 @@
|
||||
// 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
|
||||
// See also settings.pyj
|
||||
if (HYPHEN_CHAR) {
|
||||
for (const elem of document.getElementsByTagName('*')) {
|
||||
if (elem.style) {
|
||||
|
@ -74,6 +74,13 @@ def apply_colors(is_content_popup):
|
||||
ss = E.style(id=styles_id, type='text/css')
|
||||
document.documentElement.appendChild(ss)
|
||||
text = ''
|
||||
if runtime.is_standalone_viewer and 'macos' in window.navigator.userAgent:
|
||||
# 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
|
||||
# See also pdf-preprint.js
|
||||
text += '\n* { -webkit-hyphenate-character: "-" !important }\n'
|
||||
if opts.override_book_colors is not 'never':
|
||||
text = 'body'
|
||||
if opts.override_book_colors is 'dark':
|
||||
|
Loading…
x
Reference in New Issue
Block a user