diff --git a/src/calibre/ebooks/epub/output.py b/src/calibre/ebooks/epub/output.py index 0ed6d7e222..bea90eeba8 100644 --- a/src/calibre/ebooks/epub/output.py +++ b/src/calibre/ebooks/epub/output.py @@ -413,6 +413,13 @@ class EPUBOutput(OutputFormatPlugin): rule.style.removeProperty('margin-left') # padding-left breaks rendering in webkit and gecko rule.style.removeProperty('padding-left') + # Change whitespace:pre to pre-line to accommodate readers that + # cannot scroll horizontally + for rule in stylesheet.data.cssRules.rulesOfType(CSSRule.STYLE_RULE): + style = rule.style + ws = style.getPropertyValue('white-space') + if ws == 'pre': + style.setProperty('white-space', 'pre-wrap') # }}}