diff --git a/resources/pdf-preprint.js b/resources/pdf-preprint.js index 4035fef675..bdd9c92974 100644 --- a/resources/pdf-preprint.js +++ b/resources/pdf-preprint.js @@ -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) { diff --git a/src/pyj/read_book/settings.pyj b/src/pyj/read_book/settings.pyj index 00e7f12bdd..b0af75c6b6 100644 --- a/src/pyj/read_book/settings.pyj +++ b/src/pyj/read_book/settings.pyj @@ -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':