From f092a643aeb500bc1a5c4c079004225f78336ad2 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 1 Jan 2014 09:46:46 +0530 Subject: [PATCH] MOBI Output: When text indent is specified as a percentage in the input document, prevent the generated MOBI from having too large an indent if the user chooses a large output profile like tablet. See #1265226 (Private bug) --- src/calibre/ebooks/mobi/mobiml.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/calibre/ebooks/mobi/mobiml.py b/src/calibre/ebooks/mobi/mobiml.py index 64c8e208ca..622cca179c 100644 --- a/src/calibre/ebooks/mobi/mobiml.py +++ b/src/calibre/ebooks/mobi/mobiml.py @@ -346,7 +346,13 @@ class MobiMLizer(object): if isblock: bstate.para = None istate.halign = style['text-align'] + rawti = style._get('text-indent') istate.indent = style['text-indent'] + if hasattr(rawti, 'strip') and '%' in rawti: + # We have a percentage text indent, these can come out looking + # too large if the user chooses a wide output profile like + # tablet + istate.indent = min(style._unit_convert(rawti, base=500), istate.indent) if style['margin-left'] == 'auto' \ and style['margin-right'] == 'auto': istate.halign = 'center'