From 9b244ef94739301a198212b906cc8a661ace3abe Mon Sep 17 00:00:00 2001
From: David Tardon <dtardon@redhat.com>
Date: Sun, 28 Jan 2018 13:28:03 +0100
Subject: [PATCH 08/12] reduce the amount of copypasta

---
 Scribus/scribus/plugins/import/revenge/rawpainter.cpp | 15 ++++-----------
 1 file changed, 4 insertions(+), 11 deletions(-)

diff --git a/Scribus/scribus/plugins/import/revenge/rawpainter.cpp b/Scribus/scribus/plugins/import/revenge/rawpainter.cpp
index 6b958390a..4cb0d52e7 100644
--- a/Scribus/scribus/plugins/import/revenge/rawpainter.cpp
+++ b/Scribus/scribus/plugins/import/revenge/rawpainter.cpp
@@ -1636,21 +1636,14 @@ void RawPainter::openSpan(const librevenge::RVNGPropertyList &propList)
 	}
 	if (propList["style:text-scale"] && propList["style:text-scale"]->getUnit() == librevenge::RVNG_PERCENT)
 		textCharStyle.setScaleH(propList["style:text-scale"]->getDouble() * 1000);
-	if (propList["style:font-name"])
-	{
-		QString fontVari;
-		if (propList["fo:font-weight"])
-			fontVari = QString(propList["fo:font-weight"]->getStr().cstr());
-		QString fontName = QString(propList["style:font-name"]->getStr().cstr());
-		QString realFontName = constructFontName(fontName, fontVari);
-		textCharStyle.setFont((*m_Doc->AllFonts)[realFontName]);
-	}
-	if (propList["fo:font-name"])
+	// NOTE: fo:font-name was only ever emitted by libfreehand, by a mistake
+	const librevenge::RVNGProperty *fontNameProp = propList["style:font-name"] ? propList["style:font-name"] : propList["fo:font-name"];
+	if (fontNameProp)
 	{
 		QString fontVari;
 		if (propList["fo:font-weight"])
 			fontVari = QString(propList["fo:font-weight"]->getStr().cstr());
-		QString fontName = QString(propList["fo:font-name"]->getStr().cstr());
+		QString fontName = QString(fontNameProp->getStr().cstr());
 		QString realFontName = constructFontName(fontName, fontVari);
 		textCharStyle.setFont((*m_Doc->AllFonts)[realFontName]);
 	}
-- 
2.14.3

