diff --git a/src/calibre/ebooks/comic/input.py b/src/calibre/ebooks/comic/input.py
index 925416627f..3a3cb7d83e 100755
--- a/src/calibre/ebooks/comic/input.py
+++ b/src/calibre/ebooks/comic/input.py
@@ -322,7 +322,7 @@ class ComicInput(InputFormatPlugin):
('margin_bottom', 0, OptionRecommendation.HIGH),
('insert_blank_line', False, OptionRecommendation.HIGH),
('remove_paragraph_spacing', False, OptionRecommendation.HIGH),
- ('dont_justify', True, OptionRecommendation.HIGH),
+ ('change_justification', 'left', OptionRecommendation.HIGH),
('dont_split_on_pagebreaks', True, OptionRecommendation.HIGH),
('chapter', None, OptionRecommendation.HIGH),
('page_breaks_brefore', None, OptionRecommendation.HIGH),
diff --git a/src/calibre/ebooks/conversion/cli.py b/src/calibre/ebooks/conversion/cli.py
index 0b5c15b3f0..7439718cf6 100644
--- a/src/calibre/ebooks/conversion/cli.py
+++ b/src/calibre/ebooks/conversion/cli.py
@@ -124,7 +124,7 @@ def add_pipeline_options(parser, plumber):
'linearize_tables',
'extra_css',
'margin_top', 'margin_left', 'margin_right',
- 'margin_bottom', 'dont_justify',
+ 'margin_bottom', 'change_justification',
'insert_blank_line', 'remove_paragraph_spacing','remove_paragraph_spacing_indent_size',
'asciiize', 'remove_header', 'header_regex',
'remove_footer', 'footer_regex',
diff --git a/src/calibre/ebooks/conversion/plumber.py b/src/calibre/ebooks/conversion/plumber.py
index 304593a2ca..ec14fb6cfb 100644
--- a/src/calibre/ebooks/conversion/plumber.py
+++ b/src/calibre/ebooks/conversion/plumber.py
@@ -299,12 +299,16 @@ OptionRecommendation(name='margin_right',
help=_('Set the right margin in pts. Default is %default. '
'Note: 72 pts equals 1 inch')),
-OptionRecommendation(name='dont_justify',
- recommended_value=False, level=OptionRecommendation.LOW,
- help=_('Do not force text to be justified in output. Whether text '
- 'is actually displayed justified or not depends on whether '
- 'the ebook format and reading device support justification.')
- ),
+OptionRecommendation(name='change_justification',
+ recommended_value='original', level=OptionRecommendation.LOW,
+ choices=['left','justify','original'],
+ help=_('Change text justification. A value of "left" converts all'
+ ' justified text in the source to left aligned (i.e. '
+ 'unjustified) text. A value of "justify" converts all '
+ 'unjustified text to justified. A value of "original" '
+ '(the default) does not change justification in the '
+ 'source file. Note that only some output formats support '
+ 'justification.')),
OptionRecommendation(name='remove_paragraph_spacing',
recommended_value=False, level=OptionRecommendation.LOW,
diff --git a/src/calibre/ebooks/lrf/output.py b/src/calibre/ebooks/lrf/output.py
index 4d6b248db5..8d3fb72be7 100644
--- a/src/calibre/ebooks/lrf/output.py
+++ b/src/calibre/ebooks/lrf/output.py
@@ -130,7 +130,7 @@ class LRFOutput(OutputFormatPlugin):
])
recommendations = set([
- ('dont_justify', True, OptionRecommendation.HIGH),
+ ('change_justification', 'original', OptionRecommendation.HIGH),
])
def convert_images(self, pages, opts, wide):
diff --git a/src/calibre/ebooks/oeb/stylizer.py b/src/calibre/ebooks/oeb/stylizer.py
index 75c64a7dfd..c9f228a091 100644
--- a/src/calibre/ebooks/oeb/stylizer.py
+++ b/src/calibre/ebooks/oeb/stylizer.py
@@ -318,8 +318,8 @@ class Stylizer(object):
if text == 'inherit':
style['text-align'] = 'inherit'
else:
- if text in ('left', 'justify'):
- val = 'left' if self.opts.dont_justify else 'justify'
+ if text in ('left', 'justify') and self.opts.change_justification in ('left', 'justify'):
+ val = self.opts.change_justification
style['text-align'] = val
else:
style['text-align'] = text
diff --git a/src/calibre/ebooks/oeb/transforms/flatcss.py b/src/calibre/ebooks/oeb/transforms/flatcss.py
index 1eb6afc1b5..b8debff812 100644
--- a/src/calibre/ebooks/oeb/transforms/flatcss.py
+++ b/src/calibre/ebooks/oeb/transforms/flatcss.py
@@ -138,8 +138,8 @@ class CSSFlattener(object):
float(self.context.margin_left))
bs.append('margin-right : %fpt'%\
float(self.context.margin_right))
- bs.append('text-align: '+ \
- ('left' if self.context.dont_justify else 'justify'))
+ if self.context.change_justification != 'original':
+ bs.append('text-align: '+ self.context.change_justification)
body.set('style', '; '.join(bs))
stylizer = Stylizer(html, item.href, self.oeb, self.context, profile,
user_css=self.context.extra_css,
diff --git a/src/calibre/gui2/convert/look_and_feel.py b/src/calibre/gui2/convert/look_and_feel.py
index 4d43f64910..8ef1f77351 100644
--- a/src/calibre/gui2/convert/look_and_feel.py
+++ b/src/calibre/gui2/convert/look_and_feel.py
@@ -19,7 +19,7 @@ class LookAndFeelWidget(Widget, Ui_Form):
def __init__(self, parent, get_option, get_help, db=None, book_id=None):
Widget.__init__(self, parent, 'look_and_feel',
- ['dont_justify', 'extra_css', 'base_font_size',
+ ['change_justification', 'extra_css', 'base_font_size',
'font_size_mapping', 'line_height',
'linearize_tables',
'disable_font_rescaling', 'insert_blank_line',
diff --git a/src/calibre/gui2/convert/look_and_feel.ui b/src/calibre/gui2/convert/look_and_feel.ui
index 84d587d7b2..6fbf4e11cd 100644
--- a/src/calibre/gui2/convert/look_and_feel.ui
+++ b/src/calibre/gui2/convert/look_and_feel.ui
@@ -84,7 +84,7 @@
...
-
+
:/images/wizard.svg:/images/wizard.svg
@@ -181,21 +181,7 @@
- -
-
-
- Insert &blank line
-
-
-
-
-
-
- No text &justification
-
-
-
- -
&Linearize tables
@@ -221,6 +207,42 @@
+ -
+
+
+ Insert &blank line
+
+
+
+ -
+
+
+ Text justification:
+
+
+
+ -
+
+
+ 2
+
+
-
+
+ justify
+
+
+ -
+
+ left
+
+
+ -
+
+ original
+
+
+
+