r22035 by jghali - make sure each item's layout is valid when reorganizing fonts prior to PDF export

scribus-commit scribus-commit at lists.scribus.net
Sun May 21 15:49:20 UTC 2017


Author: jghali
Date: Sun May 21 15:49:20 2017
New Revision: 22035

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=22035
Log:
make sure each item's layout is valid when reorganizing fonts prior to PDF export

Modified:
    trunk/Scribus/scribus/scribusdoc.cpp

Modified: trunk/Scribus/scribus/scribusdoc.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22035&path=/trunk/Scribus/scribus/scribusdoc.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusdoc.cpp	(original)
+++ trunk/Scribus/scribus/scribusdoc.cpp	Sun May 21 15:49:20 2017
@@ -4282,14 +4282,18 @@
 	QMap<QString,int> Really;
 	QList<PageItem*> allItems;
 
+	bool wasMasterPageMode = m_masterPageMode;
+
 	for (int i = 0; i < 2; ++i)
 	{
 		switch (i)
 		{
 			case 0:
+				setMasterPageMode(true); // Necessary to avoid crash if some relayouting is necessary
 				allItems = MasterItems;
 				break;
 			case 1:
+				setMasterPageMode(false);
 				allItems = DocItems;
 				break;
 		}
@@ -4304,6 +4308,8 @@
 			}
 			if ((it->itemType() == PageItem::TextFrame) || (it->itemType() == PageItem::PathText))
 			{
+				if (it->invalid)
+					it->layout();
 				QString fontName(it->itemText.defaultStyle().charStyle().font().replacementName());
 				Really.insert(fontName, UsedFonts[fontName]);
 				int start = it->firstInFrame();
@@ -4319,6 +4325,8 @@
 		}
 	}
 
+	setMasterPageMode(wasMasterPageMode);
+
 	allItems = FrameItems.values();
 	while (allItems.count() > 0)
 	{
@@ -4330,6 +4338,8 @@
 		}
 		if ((it->itemType() == PageItem::TextFrame) || (it->itemType() == PageItem::PathText))
 		{
+			if (it->invalid)
+				it->layout();
 			QString fontName(it->itemText.defaultStyle().charStyle().font().replacementName());
 			Really.insert(fontName, UsedFonts[fontName]);
 			int start = it->firstInFrame();
@@ -4343,7 +4353,6 @@
 			}
 		}
 	}
-
 	QMap<QString,int>::Iterator itfo, itnext;
 	for (itfo = UsedFonts.begin(); itfo != UsedFonts.end(); itfo = itnext)
 	{




More information about the scribus-commit mailing list