r22378 by jghali -

scribus-commit scribus-commit at lists.scribus.net
Mon Feb 5 18:32:33 UTC 2018


Author: jghali
Date: Mon Feb  5 18:32:33 2018
New Revision: 22378

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=22378
Log:
#15099, improve librevenge based import: improve handling of sub/superscript <dtardon>

Modified:
    trunk/Scribus/scribus/plugins/import/revenge/rawpainter.cpp

Modified: trunk/Scribus/scribus/plugins/import/revenge/rawpainter.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22378&path=/trunk/Scribus/scribus/plugins/import/revenge/rawpainter.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/revenge/rawpainter.cpp	(original)
+++ trunk/Scribus/scribus/plugins/import/revenge/rawpainter.cpp	Mon Feb  5 18:32:33 2018
@@ -1663,10 +1663,20 @@
 	}
 	if (propList["style:text-position"])
 	{
-		if (propList["style:text-position"]->getStr() == "50% 67%")
-			styleEffects |= ScStyle_Superscript;
-		else
-			styleEffects |= ScStyle_Subscript;
+		QStringList pos = QString(propList["style:text-position"]->getStr().cstr()).split(' ', QString::SkipEmptyParts);
+		if (pos.size() > 0)
+		{
+			if (pos[0] == "super")
+				styleEffects |= ScStyle_Superscript;
+			else if (pos[0] == "sub")
+				styleEffects |= ScStyle_Subscript;
+			else
+				textCharStyle.setBaselineOffset(textCharStyle.fontSize() * fromPercentage(pos[0]) * 10);
+		}
+		if (pos.size() > 1)
+			// TODO: Scribus makes font size for sub-/superscript smaller, so this doesn't match well.
+			// Multiply? Or use baseline offset instead of sub-/superscript?
+			textCharStyle.setFontSize(textCharStyle.fontSize() * fromPercentage(pos[1]));
 	}
 	if (propList["fo:font-variant"] && propList["fo:font-variant"]->getStr() == "small-caps")
 		styleEffects |= ScStyle_SmallCaps;




More information about the scribus-commit mailing list