Index: scribus/CMakeLists.txt
===================================================================
--- scribus/CMakeLists.txt	(revision 17213)
+++ scribus/CMakeLists.txt	(working copy)
@@ -588,6 +588,7 @@
   sccolorshade.cpp
   scdocoutput.cpp
   scdocoutput_ps2.cpp
+  scdomelement.cpp
   scfonts.cpp
   scgtplugin.cpp
   scgzfile.cpp
Index: scribus/gtaction.cpp
===================================================================
--- scribus/gtaction.cpp	(revision 17213)
+++ scribus/gtaction.cpp	(working copy)
@@ -616,7 +616,7 @@
 
 double gtAction::getLineSpacing(int fontSize)
 {
-	return ((fontSize / 10.0) * static_cast<double>(textFrame->doc()->typographicPrefs().autoLineSpacing) / 100) + (fontSize / 10.0);
+	return ((fontSize / 10.0) * (static_cast<double>(textFrame->doc()->typographicPrefs().autoLineSpacing) / 100));
 }
 
 double gtAction::getFrameWidth()
Index: scribus/pageitem_textframe.cpp
===================================================================
--- scribus/pageitem_textframe.cpp	(revision 17215)
+++ scribus/pageitem_textframe.cpp	(working copy)
@@ -1131,7 +1131,10 @@
 static double calculateLineSpacing (const ParagraphStyle &style, PageItem *item)
 {
 	if (style.lineSpacingMode() == ParagraphStyle::AutomaticLineSpacing)
-		return style.charStyle().font().height(style.charStyle().fontSize() / 10.0);
+	{
+		double autoLS = static_cast<double>(item->doc()->typographicPrefs().autoLineSpacing) / 100.0;
+		return (style.charStyle().font().height(style.charStyle().fontSize() / 10.0) * autoLS);
+	}
 	if (style.lineSpacingMode() == ParagraphStyle::BaselineGridLineSpacing)
 		return item->doc()->guidesPrefs().valueBaselineGrid;
 	return style.lineSpacing();
@@ -1347,6 +1350,9 @@
 		current.nextColumn();
 		lastLineY = extra.Top;
 
+		//automatic line spacing factor (calculated once)
+		double autoLS = static_cast<double>(m_Doc->typographicPrefs().autoLineSpacing) / 100.0;
+
 		// find start of first line
 		if (firstInFrame() < itemText.length())
 		{
@@ -2313,7 +2319,7 @@
 						// go back to last break position
 						style = itemText.paragraphStyle(a);
 						if (style.lineSpacingMode() == ParagraphStyle::AutomaticLineSpacing)
-							style.setLineSpacing(charStyle.font().height(hlcsize10));
+							style.setLineSpacing(charStyle.font().height(hlcsize10) * autoLS);
 						else if (style.lineSpacingMode() == ParagraphStyle::BaselineGridLineSpacing)
 							style.setLineSpacing(m_Doc->guidesPrefs().valueBaselineGrid);
 						
Index: scribus/plugins/fileloader/scribus12format/scribus12format.cpp
===================================================================
--- scribus/plugins/fileloader/scribus12format/scribus12format.cpp	(revision 17213)
+++ scribus/plugins/fileloader/scribus12format/scribus12format.cpp	(working copy)
@@ -836,7 +836,8 @@
 		m_Doc->typographicPrefs().valueSmallCaps = dc.attribute("VKAPIT").toInt();
 		m_Doc->guidesPrefs().valueBaselineGrid = ScCLocale::toDoubleC(dc.attribute("BASEGRID"), 12.0);
 		m_Doc->guidesPrefs().offsetBaselineGrid = ScCLocale::toDoubleC(dc.attribute("BASEO"), 0.0);
-		m_Doc->typographicPrefs().autoLineSpacing = dc.attribute("AUTOL", "20").toInt();
+		// #9621 : autolinespacing is now express as a percentage of the font height
+		m_Doc->typographicPrefs().autoLineSpacing = 100 /*dc.attribute("AUTOL", "20").toInt()*/;
 		m_Doc->GroupCounter = 1 /*dc.attribute("GROUPC", "1").toInt()*/;
 		//m_Doc->HasCMS = static_cast<bool>(dc.attribute("HCMS", "0").toInt());
 		m_Doc->cmsSettings().SoftProofOn = static_cast<bool>(dc.attribute("DPSo", "0").toInt());
Index: scribus/plugins/fileloader/scribus134format/scribus134format.cpp
===================================================================
--- scribus/plugins/fileloader/scribus134format/scribus134format.cpp	(revision 17213)
+++ scribus/plugins/fileloader/scribus134format/scribus134format.cpp	(working copy)
@@ -1029,7 +1029,9 @@
 	doc->typographicPrefs().valueSmallCaps     = attrs.valueAsInt("VKAPIT");
 	doc->guidesPrefs().valueBaselineGrid      = attrs.valueAsDouble("BASEGRID", 12.0);
 	doc->guidesPrefs().offsetBaselineGrid     = attrs.valueAsDouble("BASEO", 0.0);
-	doc->typographicPrefs().autoLineSpacing    = attrs.valueAsInt("AUTOL", 20);
+	// #9621 : autolinespacing is now express as a percentage of the font height
+	// It was not working in regualer text frame in 1.3.4+, so set it to the default value
+	doc->typographicPrefs().autoLineSpacing    = 100 /*attrs.valueAsInt("AUTOL", 20)*/;
 	doc->typographicPrefs().valueUnderlinePos  = attrs.valueAsInt("UnderlinePos", -1);
 	doc->typographicPrefs().valueUnderlineWidth  = attrs.valueAsInt("UnderlineWidth", -1);
 	doc->typographicPrefs().valueStrikeThruPos   = attrs.valueAsInt("StrikeThruPos", -1);
Index: scribus/plugins/fileloader/scribus13format/scribus13format.cpp
===================================================================
--- scribus/plugins/fileloader/scribus13format/scribus13format.cpp	(revision 17213)
+++ scribus/plugins/fileloader/scribus13format/scribus13format.cpp	(working copy)
@@ -296,7 +296,9 @@
 		m_Doc->typographicPrefs().valueSmallCaps = dc.attribute("VKAPIT").toInt();
 		m_Doc->guidesPrefs().valueBaselineGrid  = ScCLocale::toDoubleC(dc.attribute("BASEGRID"), 12.0);
 		m_Doc->guidesPrefs().offsetBaselineGrid = ScCLocale::toDoubleC(dc.attribute("BASEO"), 0.0);
-		m_Doc->typographicPrefs().autoLineSpacing = dc.attribute("AUTOL", "20").toInt();
+		// #9621 : autolinespacing is now express as a percentage of the font height
+		// It was not working in regualer text frame in 1.3.x, so set it to the default value
+		m_Doc->typographicPrefs().autoLineSpacing = 100 /*dc.attribute("AUTOL", "20").toInt()*/;
 		m_Doc->typographicPrefs().valueUnderlinePos = dc.attribute("UnderlinePos", "-1").toInt();
 		m_Doc->typographicPrefs().valueUnderlineWidth = dc.attribute("UnderlineWidth", "-1").toInt();
 		m_Doc->typographicPrefs().valueStrikeThruPos = dc.attribute("StrikeThruPos", "-1").toInt();
Index: scribus/plugins/fileloader/scribus150format/scribus150format.cpp
===================================================================
--- scribus/plugins/fileloader/scribus150format/scribus150format.cpp	(revision 17213)
+++ scribus/plugins/fileloader/scribus150format/scribus150format.cpp	(working copy)
@@ -2085,7 +2085,8 @@
 	doc->typographicPrefs().valueSmallCaps     = attrs.valueAsInt("VKAPIT");
 	doc->guidesPrefs().valueBaselineGrid      = attrs.valueAsDouble("BASEGRID", 12.0);
 	doc->guidesPrefs().offsetBaselineGrid     = attrs.valueAsDouble("BASEO", 0.0);
-	doc->typographicPrefs().autoLineSpacing    = attrs.valueAsInt("AUTOL", 20);
+	// #9621 : autolinespacing is now expressed as a percentage of the font height
+	doc->typographicPrefs().autoLineSpacing    = attrs.valueAsInt("AUTOL", 100, 200, 100);
 	doc->typographicPrefs().valueUnderlinePos  = attrs.valueAsInt("UnderlinePos", -1);
 	doc->typographicPrefs().valueUnderlineWidth  = attrs.valueAsInt("UnderlineWidth", -1);
 	doc->typographicPrefs().valueStrikeThruPos   = attrs.valueAsInt("StrikeThruPos", -1);
Index: scribus/prefsmanager.cpp
===================================================================
--- scribus/prefsmanager.cpp	(revision 17213)
+++ scribus/prefsmanager.cpp	(working copy)
@@ -37,25 +37,27 @@
 #include "commonstrings.h"
 #include "filewatcher.h"
 #include "latexhelpers.h"
-#include "ui/missing.h"
-#include "ui/prefs_keyboardshortcuts.h"
 #include "pagesize.h"
 #include "pagestructs.h"
 #include "pdfoptions.h"
 #include "prefsfile.h"
 #include "scclocale.h"
 #include "sccolorengine.h"
+#include "scdomelement.h"
 #include "scfonts.h"
-#include "ui/scmessagebox.h"
 #include "scpaths.h"
 #include "scribuscore.h"
 #include "scribusstructs.h"
 #include "sctextstream.h"
-#include "ui/modetoolbar.h"
 #include "util_color.h"
 #include "util_file.h"
 #include "util_ghostscript.h"
 
+#include "ui/missing.h"
+#include "ui/modetoolbar.h"
+#include "ui/prefs_keyboardshortcuts.h"
+#include "ui/scmessagebox.h"
+
 extern bool emergencyActivated;
 
 PrefsManager* PrefsManager::_instance = 0;
@@ -189,7 +191,7 @@
 	appPrefs.typoPrefs.valueSubScript = 33;
 	appPrefs.typoPrefs.scalingSubScript = 66;
 	appPrefs.typoPrefs.valueSmallCaps = 75;
-	appPrefs.typoPrefs.autoLineSpacing = 20;
+	appPrefs.typoPrefs.autoLineSpacing = 100;
 	appPrefs.typoPrefs.valueUnderlinePos = -1;
 	appPrefs.typoPrefs.valueUnderlineWidth = -1;
 	appPrefs.typoPrefs.valueStrikeThruPos = -1;
@@ -1861,7 +1863,7 @@
 		return false;
 	}
 	f.close();
-	QDomElement elem=docu.documentElement();
+	ScDomElement elem = docu.documentElement();
 	if (elem.tagName() != "SCRIBUSRC")
 		return false;
 	//Ignore scribus*.rc files prior to 1.5.0 due to changes
@@ -1886,7 +1888,7 @@
 		appPrefs.verifierPrefs.checkerPrefsList.clear();
 	while(!DOC.isNull())
 	{
-		QDomElement dc=DOC.toElement();
+		ScDomElement dc = DOC.toElement();
 
 		if (dc.tagName()=="UI")
 		{
@@ -2036,7 +2038,7 @@
 			appPrefs.typoPrefs.valueSubScript = dc.attribute("SubScriptDistance").toInt();
 			appPrefs.typoPrefs.scalingSubScript = dc.attribute("SubScriptScaling").toInt();
 			appPrefs.typoPrefs.valueSmallCaps  = dc.attribute("SmallCapsScaling").toInt();
-			appPrefs.typoPrefs.autoLineSpacing = dc.attribute("AutomaticLineSpacing", "20").toInt();
+			appPrefs.typoPrefs.autoLineSpacing = dc.valueAsUInt("AutomaticLineSpacing", 100, 200, 100);
 			double ulp = ScCLocale::toDoubleC(dc.attribute("UnderlineDistance"), -1.0);
 			if (ulp != -1)
 				appPrefs.typoPrefs.valueUnderlinePos = qRound(ulp * 10);
@@ -2202,7 +2204,7 @@
 			while(!scrp.isNull())
 			{
 				QDomElement scrpElem = scrp.toElement();
-				if (scrpElem.tagName()=="Recent")
+				if (scrpElem.tagName() == "Recent")
 				{
 					QString nam = scrpElem.attribute("Name");
 					QFileInfo fd(nam);
Index: scribus/sampleitem.cpp
===================================================================
--- scribus/sampleitem.cpp	(revision 17213)
+++ scribus/sampleitem.cpp	(working copy)
@@ -36,9 +36,7 @@
 	bgShade = 100;
 	tmpStyle.setName("(preview temporary)");
 	tmpStyle.setLineSpacingMode(ParagraphStyle::FixedLineSpacing);
-	tmpStyle.setLineSpacing((m_Doc->itemToolPrefs().textSize / 10.0)
-		* static_cast<double>(m_Doc->typographicPrefs().autoLineSpacing) / 100
-		+ (m_Doc->itemToolPrefs().textSize / 10.0));
+	tmpStyle.setLineSpacing((m_Doc->itemToolPrefs().textSize / 10.0) * (static_cast<double>(m_Doc->typographicPrefs().autoLineSpacing) / 100));
 	tmpStyle.setAlignment(ParagraphStyle::Leftaligned);
 	tmpStyle.setLeftMargin(0);
 	tmpStyle.setFirstIndent(0);
@@ -162,7 +160,7 @@
 {
 	tmpStyle.charStyle().setFontSize(fontSize);
 	if (autoLineSpa)
-		tmpStyle.setLineSpacing(((fontSize / 10)  * (m_Doc->typographicPrefs().autoLineSpacing / 100) + (fontSize / 10)));
+		tmpStyle.setLineSpacing((fontSize / 10)  * (m_Doc->typographicPrefs().autoLineSpacing / 100.0));
 }
 
 /*void SampleItem::setTabValues(QValueList<PageItem::TabRecord> tabValues)
Index: scribus/scdomelement.cpp
===================================================================
--- scribus/scdomelement.cpp	(revision 0)
+++ scribus/scdomelement.cpp	(revision 0)
@@ -0,0 +1,74 @@
+/*
+For general Scribus (>=1.3.2) copyright and licensing information please refer
+to the COPYING file provided with the program. Following this notice may exist
+a copyright and/or license notice that predates the release of Scribus 1.3.2
+for which a new license (GPL+exception) is in place.
+*/
+
+#include "scclocale.h"
+#include "scdomelement.h"
+
+ScDomElement::ScDomElement() : QDomElement()
+{
+
+}
+
+ScDomElement::ScDomElement(const QDomElement &elem) : QDomElement(elem)
+{
+
+}
+
+int ScDomElement::valueAsInt (const QString& attrName, int def) const
+{
+	int retValue = def;
+	QString attr = attribute(attrName);
+	if (!attr.isEmpty())
+	{
+		bool success = false;
+		int intVal = attr.toInt(&success);
+		if (success)
+			retValue = intVal;
+	}
+	return retValue;
+}
+
+int ScDomElement::valueAsInt (const QString& attrName, int min, int max, int def) const
+{
+	int value = valueAsInt(attrName, def);
+	return qMin(max, qMax(value, min));
+}
+
+uint ScDomElement::valueAsUInt (const QString& attrName, uint def) const
+{
+	uint retValue = def;
+	QString attr = attribute(attrName);
+	if (!attr.isEmpty())
+	{
+		bool success = false;
+		uint intVal = attr.toUInt(&success);
+		if (success)
+			retValue = intVal;
+	}
+	return retValue;
+}
+
+uint ScDomElement::valueAsUInt (const QString& attrName, uint min, uint max, uint def) const
+{
+	uint value = valueAsUInt(attrName, def);
+	return qMin(max, qMax(value, min));
+}
+
+double ScDomElement::valueAsDouble (const QString& attrName, double def) const
+{
+	double retValue = def;
+	QString attr = attribute(attrName);
+	if (!attr.isEmpty())
+		retValue = ScCLocale::toDoubleC(attr, def);
+	return retValue;
+}
+
+double ScDomElement::valueAsDouble (const QString& attrName, double min, double max, double def) const
+{
+	double value = valueAsDouble(attrName, def);
+	return qMin(max, qMax(value, min));
+}
Index: scribus/scdomelement.h
===================================================================
--- scribus/scdomelement.h	(revision 0)
+++ scribus/scdomelement.h	(revision 0)
@@ -0,0 +1,26 @@
+/*
+For general Scribus (>=1.3.2) copyright and licensing information please refer
+to the COPYING file provided with the program. Following this notice may exist
+a copyright and/or license notice that predates the release of Scribus 1.3.2
+for which a new license (GPL+exception) is in place.
+*/
+#ifndef SCDOMELEMENT_H
+#define SCDOMELEMENT_H
+
+#include <QDomElement>
+
+class ScDomElement : public QDomElement
+{
+public:
+	ScDomElement();
+	ScDomElement(const QDomElement &elem); 
+
+	int     valueAsInt    (const QString& attrName, int def = 0) const;
+	int     valueAsInt    (const QString& attrName, int min, int max, int def = 0) const;
+	uint    valueAsUInt   (const QString& attrName, uint def = 0) const;
+	uint    valueAsUInt   (const QString& attrName, uint min, uint max, uint def = 0) const;
+	double  valueAsDouble (const QString& attrName, double def = 0.0) const;
+	double  valueAsDouble (const QString& attrName, double min, double max, double def = 0.0) const;
+};
+
+#endif
Index: scribus/scpageoutput.cpp
===================================================================
--- scribus/scpageoutput.cpp	(revision 17213)
+++ scribus/scpageoutput.cpp	(working copy)
@@ -1234,6 +1234,10 @@
 			painter->scale(1, -1);
 		}
 		uint tabCc = 0;
+
+		//automatic line spacing factor (calculated once)
+		double autoLS = static_cast<double>(m_doc->typographicPrefs().autoLineSpacing) / 100.0;
+
 		for (uint ll=0; ll < item->itemText.lines(); ++ll)
 		{
 			LineSpec ls = item->itemText.line(ll);
@@ -1261,15 +1265,12 @@
 					const ParagraphStyle& style(item->itemText.paragraphStyle(a));
 					if (style.lineSpacingMode() == ParagraphStyle::BaselineGridLineSpacing)
 						chs = qRound(10 * ((m_doc->guidesPrefs().valueBaselineGrid * (style.dropCapLines()-1) + (charStyle.font().ascent(style.charStyle().fontSize() / 10.0))) / charStyle.font().realCharHeight(chstr[0], 10)));
+					else if (style.lineSpacingMode() == ParagraphStyle::FixedLineSpacing)
+						chs = qRound(10 * ((style.lineSpacing() * (style.dropCapLines()-1)+(charStyle.font().ascent(style.charStyle().fontSize() / 10.0))) / charStyle.font().realCharHeight(chstr[0], 10)));
 					else
 					{
-						if (style.lineSpacingMode() == ParagraphStyle::FixedLineSpacing)
-							chs = qRound(10 * ((style.lineSpacing() * (style.dropCapLines()-1)+(charStyle.font().ascent(style.charStyle().fontSize() / 10.0))) / charStyle.font().realCharHeight(chstr[0], 10)));
-						else
-						{
-							double currasce = charStyle.font().height(style.charStyle().fontSize() / 10.0);
-							chs = qRound(10 * ((currasce * (style.dropCapLines()-1)+(charStyle.font().ascent(style.charStyle().fontSize() / 10.0))) / charStyle.font().realCharHeight(chstr[0], 10)));
-						}
+						double currasce = charStyle.font().height(style.charStyle().fontSize() / 10.0) * autoLS;
+						chs = qRound(10 * ((currasce * (style.dropCapLines() - 1)+(charStyle.font().ascent(style.charStyle().fontSize() / 10.0))) / charStyle.font().realCharHeight(chstr[0], 10)));
 					}
 				}
 				if (chstr[0] == SpecialChars::TAB)
Index: scribus/scribusdoc.cpp
===================================================================
--- scribus/scribusdoc.cpp	(revision 17213)
+++ scribus/scribusdoc.cpp	(working copy)
@@ -7836,11 +7836,11 @@
 	{
 		ParagraphStyle storyStyle;
 		storyStyle.charStyle().setFontSize(size);
-		if (storyStyle.lineSpacingMode() == 0)
+		if (storyStyle.lineSpacingMode() == ParagraphStyle::AutomaticLineSpacing)
 		{
-			storyStyle.setLineSpacing(((size / 10.0) * static_cast<double>(docPrefsData.typoPrefs.autoLineSpacing) / 100) + (size / 10.0));
+			storyStyle.setLineSpacing((size / 10.0) * (static_cast<double>(docPrefsData.typoPrefs.autoLineSpacing) / 100));
 		}
-		else if (storyStyle.lineSpacingMode() == 1)
+		else if (storyStyle.lineSpacingMode() == ParagraphStyle::FixedLineSpacing)
 		{
 			storyStyle.setLineSpacing(storyStyle.charStyle().font().height(size));
 		}
@@ -13066,7 +13066,7 @@
 //			bb->setFontSize(qMax(qRound(bb->fontSize()*((scx+scy)/2)), 1));
 			if ((bb->itemText.length() != 0) && (!bb->isTableItem))
 			{
-//				bb->setLineSpacing(((bb->fontSize() / 10.0) * static_cast<double>(Doc->typographicSettings.autoLineSpacing) / 100) + (bb->fontSize() / 10.0));
+//				bb->setLineSpacing(((bb->fontSize() / 10.0) * static_cast<double>(Doc->typographicSettings.autoLineSpacing) / 100));
 				for (aa = 0; aa < bb->itemText.length(); ++aa)
 					bb->itemText.item(aa)->setFontSize(qMax(qRound(bb->itemText.item(aa)->fontSize()*((scx+scy)/2)), 1));
 				if (bb->asPathText())
Index: scribus/scxmlstreamreader.cpp
===================================================================
--- scribus/scxmlstreamreader.cpp	(revision 17213)
+++ scribus/scxmlstreamreader.cpp	(working copy)
@@ -80,6 +80,18 @@
 	return retValue;
 }
 
+int ScXmlStreamAttributes::valueAsInt (const char* attrName, int min, int max, int def) const
+{
+	int value = valueAsInt(attrName, def);
+	return qMin(max, qMax(value, min));
+}
+
+int ScXmlStreamAttributes::valueAsInt (const QString& attrName, int min, int max, int def) const
+{
+	int value = valueAsInt(attrName, def);
+	return qMin(max, qMax(value, min));
+}
+
 uint ScXmlStreamAttributes::valueAsUInt  (const char*    attrName, uint def) const
 {
 	uint retValue = def;
Index: scribus/scxmlstreamreader.h
===================================================================
--- scribus/scxmlstreamreader.h	(revision 17213)
+++ scribus/scxmlstreamreader.h	(working copy)
@@ -23,6 +23,8 @@
 	bool    valueAsBool   (const QString& attrName, bool def = false) const;
 	int     valueAsInt    (const char*    attrName, int def = 0) const;
 	int     valueAsInt    (const QString& attrName, int def = 0) const;
+	int     valueAsInt    (const char*    attrName, int min, int max, int def = 0) const;
+	int     valueAsInt    (const QString& attrName, int min, int max, int def = 0) const;
 	uint    valueAsUInt   (const char*    attrName, uint def = 0) const;
 	uint    valueAsUInt   (const QString& attrName, uint def = 0) const;
 	double  valueAsDouble (const char*    attrName, double def = 0.0) const;
Index: scribus/styles/paragraphstyle.cpp
===================================================================
--- scribus/styles/paragraphstyle.cpp	(revision 17213)
+++ scribus/styles/paragraphstyle.cpp	(working copy)
@@ -98,7 +98,7 @@
 	switch (that.lineSpacingMode())
 	{
 		case 0: 
-			that.setLineSpacing(((that.charStyle().fontSize() / 10.0) * static_cast<qreal>(typographicSettings.autoLineSpacing) / 100) + (size / 10.0));
+			that.setLineSpacing(((that.charStyle().fontSize() / 10.0) * static_cast<qreal>(typographicSettings.autoLineSpacing) / 100));
 			break;
 		case 1:
 			that.setLineSpacing(that.charStyle().font().height(size));
Index: scribus/ui/prefs_typographybase.ui
===================================================================
--- scribus/ui/prefs_typographybase.ui	(revision 17213)
+++ scribus/ui/prefs_typographybase.ui	(working copy)
@@ -515,9 +515,12 @@
            <property name="suffix">
             <string> %</string>
            </property>
-           <property name="maximum">
+           <property name="minimum">
             <number>100</number>
            </property>
+           <property name="maximum">
+            <number>200</number>
+           </property>
           </widget>
          </item>
         </layout>
