r16953 by fschmid - Fixed Bug 10359: "Invalid PDF creation"

scribus-commit scribus-commit at lists.scribus.net
Thu Nov 3 21:34:42 UTC 2011


Author: fschmid
Date: Thu Nov  3 21:34:42 2011
New Revision: 16953

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=16953
Log:
Fixed Bug 10359: "Invalid PDF creation"

Modified:
    trunk/Scribus/scribus/pdflib_core.cpp

Modified: trunk/Scribus/scribus/pdflib_core.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16953&path=/trunk/Scribus/scribus/pdflib_core.cpp
==============================================================================
--- trunk/Scribus/scribus/pdflib_core.cpp (original)
+++ trunk/Scribus/scribus/pdflib_core.cpp Thu Nov  3 21:34:42 2011
@@ -942,96 +942,26 @@
 	size_t ar = sizeof(tmpf) / sizeof(*tmpf);
 	for (uint ax = 0; ax < ar; ++ax)
 		ind2PDFabr[ax] = tmpf[ax];
+	QList<PageItem*> allItems;
 	for (int c = 0; c < doc.FrameItems.count(); ++c)
 	{
 		pgit = doc.FrameItems.at(c);
-		if ((pgit->itemType() == PageItem::TextFrame) || (pgit->itemType() == PageItem::PathText))
-		{
-			if (pgit->isAnnotation())
-			{
-				int annotType  = pgit->annotation().Type();
-				bool mustEmbed = ((annotType >= 2) && (annotType <= 6) && (annotType != 4));
-				if (pgit->annotation().Type() == 4)
-					StdFonts.insert("/ZapfDingbats", "");
-				if (pgit->itemText.length() > 0 || mustEmbed)
-				{
-					if (Options.Version < PDFOptions::PDFVersion_14)
-						StdFonts.insert(ind2PDFabr[pgit->annotation().Font()], "");
-					ReallyUsed.insert(pgit->itemText.defaultStyle().charStyle().font().replacementName(), DocFonts[pgit->itemText.defaultStyle().charStyle().font().replacementName()]);
-				}
-			}
-			for (uint e = 0; e < static_cast<uint>(pgit->itemText.length()); ++e)
-			{
-				ReallyUsed.insert(pgit->itemText.charStyle(e).font().replacementName(), DocFonts[pgit->itemText.charStyle(e).font().replacementName()]);
-			}
-		}
-	}
-	for (int c = 0; c < doc.MasterItems.count(); ++c)
-	{
-		pgit = doc.MasterItems.at(c);
-		if ((pgit->itemType() == PageItem::TextFrame) || (pgit->itemType() == PageItem::PathText))
-		{
-			if (pgit->isAnnotation())
-			{
-				int annotType  = pgit->annotation().Type();
-				bool mustEmbed = ((annotType >= 2) && (annotType <= 6) && (annotType != 4));
-				if (pgit->annotation().Type() == 4)
-					StdFonts.insert("/ZapfDingbats", "");
-				if (pgit->itemText.length() > 0 || mustEmbed)
-				{
-					if (Options.Version < PDFOptions::PDFVersion_14)
-						StdFonts.insert(ind2PDFabr[pgit->annotation().Font()], "");
-					ReallyUsed.insert(pgit->itemText.defaultStyle().charStyle().font().replacementName(), DocFonts[pgit->itemText.defaultStyle().charStyle().font().replacementName()]);
-				}
-			}
-			for (uint e = 0; e < static_cast<uint>(pgit->itemText.length()); ++e)
-			{
-				ReallyUsed.insert(pgit->itemText.charStyle(e).font().replacementName(), DocFonts[pgit->itemText.charStyle(e).font().replacementName()]);
-			}
-		}
-	}
-	for (int d = 0; d < doc.Items->count(); ++d)
-	{
-		pgit = doc.Items->at(d);
-		if ((pgit->itemType() == PageItem::TextFrame) || (pgit->itemType() == PageItem::PathText))
-		{
-			if (pgit->isAnnotation())
-			{
-				int annotType  = pgit->annotation().Type();
-				bool mustEmbed = ((annotType >= 2) && (annotType <= 6) && (annotType != 4));
-				if (pgit->annotation().Type() == 4)
-					StdFonts.insert("/ZapfDingbats", "");
-				if (pgit->itemText.length() > 0 || mustEmbed)
-				{
-					if (Options.Version < PDFOptions::PDFVersion_14)
-						StdFonts.insert(ind2PDFabr[pgit->annotation().Font()], "");
-					ReallyUsed.insert(pgit->itemText.defaultStyle().charStyle().font().replacementName(), DocFonts[pgit->itemText.defaultStyle().charStyle().font().replacementName()]);
-				}
-			}
-			for (uint e = 0; e < static_cast<uint>(pgit->itemText.length()); ++e)
-			{
-				ReallyUsed.insert(pgit->itemText.charStyle(e).font().replacementName(), DocFonts[pgit->itemText.charStyle(e).font().replacementName()]);
-			}
-		}
-	}
-/*	if (Options.docInfoMarks)
-	{
-		StdFonts.insert("/Helvetica", "");
-	} */
-	QStringList patterns = doc.getPatternDependencyList(doc.getUsedPatterns());
-	for (int c = 0; c < patterns.count(); ++c)
-	{
-		ScPattern pa = doc.docPatterns[patterns[c]];
-		for (int o = 0; o < pa.items.count(); o++)
-		{
-			pgit = pa.items.at(o);
+		if (pgit->isGroup())
+			allItems = pgit->asGroupFrame()->getItemList();
+		else
+			allItems.append(pgit);
+		for (int ii = 0; ii < allItems.count(); ii++)
+		{
+			pgit = allItems.at(ii);
 			if ((pgit->itemType() == PageItem::TextFrame) || (pgit->itemType() == PageItem::PathText))
 			{
 				if (pgit->isAnnotation())
 				{
+					int annotType  = pgit->annotation().Type();
+					bool mustEmbed = ((annotType >= 2) && (annotType <= 6) && (annotType != 4));
 					if (pgit->annotation().Type() == 4)
 						StdFonts.insert("/ZapfDingbats", "");
-					if (pgit->itemText.length() > 0)
+					if (pgit->itemText.length() > 0 || mustEmbed)
 					{
 						if (Options.Version < PDFOptions::PDFVersion_14)
 							StdFonts.insert(ind2PDFabr[pgit->annotation().Font()], "");
@@ -1041,6 +971,109 @@
 				for (uint e = 0; e < static_cast<uint>(pgit->itemText.length()); ++e)
 				{
 					ReallyUsed.insert(pgit->itemText.charStyle(e).font().replacementName(), DocFonts[pgit->itemText.charStyle(e).font().replacementName()]);
+				}
+			}
+		}
+	}
+	for (int c = 0; c < doc.MasterItems.count(); ++c)
+	{
+		pgit = doc.MasterItems.at(c);
+		if (pgit->isGroup())
+			allItems = pgit->asGroupFrame()->getItemList();
+		else
+			allItems.append(pgit);
+		for (int ii = 0; ii < allItems.count(); ii++)
+		{
+			pgit = allItems.at(ii);
+			if ((pgit->itemType() == PageItem::TextFrame) || (pgit->itemType() == PageItem::PathText))
+			{
+				if (pgit->isAnnotation())
+				{
+					int annotType  = pgit->annotation().Type();
+					bool mustEmbed = ((annotType >= 2) && (annotType <= 6) && (annotType != 4));
+					if (pgit->annotation().Type() == 4)
+						StdFonts.insert("/ZapfDingbats", "");
+					if (pgit->itemText.length() > 0 || mustEmbed)
+					{
+						if (Options.Version < PDFOptions::PDFVersion_14)
+							StdFonts.insert(ind2PDFabr[pgit->annotation().Font()], "");
+						ReallyUsed.insert(pgit->itemText.defaultStyle().charStyle().font().replacementName(), DocFonts[pgit->itemText.defaultStyle().charStyle().font().replacementName()]);
+					}
+				}
+				for (uint e = 0; e < static_cast<uint>(pgit->itemText.length()); ++e)
+				{
+					ReallyUsed.insert(pgit->itemText.charStyle(e).font().replacementName(), DocFonts[pgit->itemText.charStyle(e).font().replacementName()]);
+				}
+			}
+		}
+	}
+	for (int d = 0; d < doc.Items->count(); ++d)
+	{
+		pgit = doc.Items->at(d);
+		if (pgit->isGroup())
+			allItems = pgit->asGroupFrame()->getItemList();
+		else
+			allItems.append(pgit);
+		for (int ii = 0; ii < allItems.count(); ii++)
+		{
+			pgit = allItems.at(ii);
+			if ((pgit->itemType() == PageItem::TextFrame) || (pgit->itemType() == PageItem::PathText))
+			{
+				if (pgit->isAnnotation())
+				{
+					int annotType  = pgit->annotation().Type();
+					bool mustEmbed = ((annotType >= 2) && (annotType <= 6) && (annotType != 4));
+					if (pgit->annotation().Type() == 4)
+						StdFonts.insert("/ZapfDingbats", "");
+					if (pgit->itemText.length() > 0 || mustEmbed)
+					{
+						if (Options.Version < PDFOptions::PDFVersion_14)
+							StdFonts.insert(ind2PDFabr[pgit->annotation().Font()], "");
+						ReallyUsed.insert(pgit->itemText.defaultStyle().charStyle().font().replacementName(), DocFonts[pgit->itemText.defaultStyle().charStyle().font().replacementName()]);
+					}
+				}
+				for (uint e = 0; e < static_cast<uint>(pgit->itemText.length()); ++e)
+				{
+					ReallyUsed.insert(pgit->itemText.charStyle(e).font().replacementName(), DocFonts[pgit->itemText.charStyle(e).font().replacementName()]);
+				}
+			}
+		}
+	}
+/*	if (Options.docInfoMarks)
+	{
+		StdFonts.insert("/Helvetica", "");
+	} */
+	QStringList patterns = doc.getPatternDependencyList(doc.getUsedPatterns());
+	for (int c = 0; c < patterns.count(); ++c)
+	{
+		ScPattern pa = doc.docPatterns[patterns[c]];
+		for (int o = 0; o < pa.items.count(); o++)
+		{
+			pgit = pa.items.at(o);
+			if (pgit->isGroup())
+				allItems = pgit->asGroupFrame()->getItemList();
+			else
+				allItems.append(pgit);
+			for (int ii = 0; ii < allItems.count(); ii++)
+			{
+				pgit = allItems.at(ii);
+				if ((pgit->itemType() == PageItem::TextFrame) || (pgit->itemType() == PageItem::PathText))
+				{
+					if (pgit->isAnnotation())
+					{
+						if (pgit->annotation().Type() == 4)
+							StdFonts.insert("/ZapfDingbats", "");
+						if (pgit->itemText.length() > 0)
+						{
+							if (Options.Version < PDFOptions::PDFVersion_14)
+								StdFonts.insert(ind2PDFabr[pgit->annotation().Font()], "");
+							ReallyUsed.insert(pgit->itemText.defaultStyle().charStyle().font().replacementName(), DocFonts[pgit->itemText.defaultStyle().charStyle().font().replacementName()]);
+						}
+					}
+					for (uint e = 0; e < static_cast<uint>(pgit->itemText.length()); ++e)
+					{
+						ReallyUsed.insert(pgit->itemText.charStyle(e).font().replacementName(), DocFonts[pgit->itemText.charStyle(e).font().replacementName()]);
+					}
 				}
 			}
 		}
@@ -3463,6 +3496,23 @@
 			PutDoc("/"+it3t.key()+" "+QString::number(it3t.value())+" 0 R\n");
 		PutDoc(">>\n");
 	}
+	if ((ICCProfiles.count() != 0) || (spotMap.count() != 0))
+	{
+		PutDoc("/ColorSpace << \n");
+		QMap<QString,ICCD>::Iterator it3c;
+		if (ICCProfiles.count() != 0)
+		{
+			for (it3c = ICCProfiles.begin(); it3c != ICCProfiles.end(); ++it3c)
+				PutDoc("/"+it3c.value().ResName+" "+QString::number(it3c.value().ResNum)+" 0 R\n");
+		}
+		QMap<QString,SpotC>::Iterator it3sc;
+		if (spotMap.count() != 0)
+		{
+			for (it3sc = spotMap.begin(); it3sc != spotMap.end(); ++it3sc)
+				PutDoc("/"+it3sc.value().ResName+" "+QString::number(it3sc.value().ResNum)+" 0 R\n");
+		}
+		PutDoc(">>\n");
+	}
 	PutDoc(">>\n");
 	if (Options.Compress)
 		data = CompressStr(&data);




More information about the scribus-commit mailing list