r21321 by fschmid -

scribus-commit scribus-commit at lists.scribus.net
Mon May 16 07:21:23 UTC 2016


Author: fschmid
Date: Mon May 16 07:21:23 2016
New Revision: 21321

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=21321
Log:
Fixed Bug #14064: bezier curve + text frame + text to path = crash

Modified:
    trunk/Scribus/scribus/pageitem_pathtext.cpp
    trunk/Scribus/scribus/pdflib_core.cpp
    trunk/Scribus/scribus/plugins/export/svgexplugin/svgexplugin.cpp
    trunk/Scribus/scribus/plugins/export/xpsexport/xpsexplugin.cpp
    trunk/Scribus/scribus/pslib.cpp

Modified: trunk/Scribus/scribus/pageitem_pathtext.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21321&path=/trunk/Scribus/scribus/pageitem_pathtext.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem_pathtext.cpp	(original)
+++ trunk/Scribus/scribus/pageitem_pathtext.cpp	Mon May 16 07:21:23 2016
@@ -163,6 +163,8 @@
 		CurX += itemText.charStyle(0).fontSize() * itemText.charStyle(0).tracking() / 10000.0;
 		totalTextLen += itemText.charStyle(0).fontSize() * itemText.charStyle(0).tracking() / 10000.0;
 	}
+	else
+		return;
 	itemRenderText.clear();
 	itemRenderText.setDoc(m_Doc);
 	itemRenderText.setDefaultStyle(itemText.defaultStyle());

Modified: trunk/Scribus/scribus/pdflib_core.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21321&path=/trunk/Scribus/scribus/pdflib_core.cpp
==============================================================================
--- trunk/Scribus/scribus/pdflib_core.cpp	(original)
+++ trunk/Scribus/scribus/pdflib_core.cpp	Mon May 16 07:21:23 2016
@@ -4595,7 +4595,8 @@
 				tmp += "-1 0 0 1 "+FToStr(ite->width())+" 0 cm\n";
 			if (ite->imageFlippedV())
 				tmp += "1 0 0 -1 0 "+FToStr(-ite->height())+" cm\n";
-			tmp += setTextSt(ite, PNr, pag);
+			if (ite->itemText.length() != 0)
+				tmp += setTextSt(ite, PNr, pag);
 			tmp += "Q\n";
 			tmp += "Q\n";
 			if (((ite->lineColor() != CommonStrings::None) || (!ite->NamedLStyle.isEmpty()) || (!ite->strokePattern().isEmpty()) || (ite->GrTypeStroke > 0)))
@@ -5027,7 +5028,8 @@
 					tmp += "q\n";
 				tmp += PDF_TransparenzFill(ite);
 			}
-			tmp += setTextSt(ite, PNr, pag);
+			if (ite->itemText.length() != 0)
+				tmp += setTextSt(ite, PNr, pag);
 			if (ite->GrMask > 0)
 				tmp += "Q\n";
 			break;

Modified: trunk/Scribus/scribus/plugins/export/svgexplugin/svgexplugin.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21321&path=/trunk/Scribus/scribus/plugins/export/svgexplugin/svgexplugin.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/export/svgexplugin/svgexplugin.cpp	(original)
+++ trunk/Scribus/scribus/plugins/export/svgexplugin/svgexplugin.cpp	Mon May 16 07:21:23 2016
@@ -1267,9 +1267,12 @@
 		}
 	}
 
-	SvgPainter p(trans, this, ob);
-	Item->textLayout.renderBackground(&p);
-	Item->textLayout.render(&p);
+	if (Item->itemText.length() != 0)
+	{
+		SvgPainter p(trans, this, ob);
+		Item->textLayout.renderBackground(&p);
+		Item->textLayout.render(&p);
+	}
 	if (Item->isTextFrame())
 	{
 		if (Item->NamedLStyle.isEmpty())

Modified: trunk/Scribus/scribus/plugins/export/xpsexport/xpsexplugin.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21321&path=/trunk/Scribus/scribus/plugins/export/xpsexport/xpsexplugin.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/export/xpsexport/xpsexplugin.cpp	(original)
+++ trunk/Scribus/scribus/plugins/export/xpsexport/xpsexplugin.cpp	Mon May 16 07:21:23 2016
@@ -1043,75 +1043,44 @@
 	}
 
 //	parentElem.appendChild(grp);
-	XPSPainter p(Item, grp, this, xps_fontMap, rel_root);
-	Item->textLayout.renderBackground(&p);
-	Item->textLayout.render(&p);
-	QDomElement grp2 = p_docu.createElement("Canvas");
-	if (grp.hasAttribute("RenderTransform"))
-		grp2.setAttribute("RenderTransform", grp.attribute("RenderTransform"));
-	if (grp.hasAttribute("Name"))
-		grp2.setAttribute("Name", grp.attribute("Name"));
-	if (grp.hasAttribute("Opacity"))
-		grp2.setAttribute("Opacity", grp.attribute("Opacity"));
-	bool first = true;
-	QString RenderTransform = "";
-	QString FontRenderingEmSize = "";
-	QString FontUri = "";
-	QString Fill = "";
-	QString OriginX = "";
-	QString OriginY = "";
-	QString Indices = "";
-	QString UnicodeString = "";
-	QDomElement glyph;
-	for(QDomElement txtGrp = grp.firstChildElement(); !txtGrp.isNull(); txtGrp = txtGrp.nextSiblingElement() )
-	{
-		if (txtGrp.tagName() != "Glyphs")
-		{
-			if (!first)
-			{
-				glyph.setAttribute("Indices", Indices);
-				glyph.setAttribute("UnicodeString", UnicodeString);
-				first = true;
-			}
-			grp2.appendChild(txtGrp.cloneNode(true));
-		}
-		else
-		{
-			if (first)
-			{
-				RenderTransform = txtGrp.attribute("RenderTransform");
-				FontRenderingEmSize = txtGrp.attribute("FontRenderingEmSize");
-				FontUri = txtGrp.attribute("FontUri");
-				Fill = txtGrp.attribute("Fill");
-				OriginX = txtGrp.attribute("OriginX");
-				OriginY = txtGrp.attribute("OriginY");
-				Indices = txtGrp.attribute("Indices");
-				UnicodeString = txtGrp.attribute("UnicodeString");
-				glyph = p_docu.createElement("Glyphs");
-				glyph.setAttribute("RenderTransform", RenderTransform);
-				glyph.setAttribute("BidiLevel", "0");
-				glyph.setAttribute("StyleSimulations", "None");
-				glyph.setAttribute("FontRenderingEmSize", FontRenderingEmSize);
-				glyph.setAttribute("FontUri", FontUri);
-				glyph.setAttribute("Fill", Fill);
-				glyph.setAttribute("OriginX", OriginX);
-				glyph.setAttribute("OriginY", OriginY);
-				glyph.setAttribute("Indices", Indices);
-				glyph.setAttribute("UnicodeString", UnicodeString);
-				grp2.appendChild(glyph);
-				first = false;
-			}
-			else
-			{
-				if ((RenderTransform == txtGrp.attribute("RenderTransform")) && (FontRenderingEmSize == txtGrp.attribute("FontRenderingEmSize")) && (FontUri == txtGrp.attribute("FontUri")) && (OriginY == txtGrp.attribute("OriginY")) && (Fill == txtGrp.attribute("Fill")))
-				{
-					Indices.append(";" + txtGrp.attribute("Indices"));
-					UnicodeString.append(txtGrp.attribute("UnicodeString"));
-				}
-				else
+	if (Item->itemText.length() != 0)
+	{
+		XPSPainter p(Item, grp, this, xps_fontMap, rel_root);
+		Item->textLayout.renderBackground(&p);
+		Item->textLayout.render(&p);
+		QDomElement grp2 = p_docu.createElement("Canvas");
+		if (grp.hasAttribute("RenderTransform"))
+			grp2.setAttribute("RenderTransform", grp.attribute("RenderTransform"));
+		if (grp.hasAttribute("Name"))
+			grp2.setAttribute("Name", grp.attribute("Name"));
+		if (grp.hasAttribute("Opacity"))
+			grp2.setAttribute("Opacity", grp.attribute("Opacity"));
+		bool first = true;
+		QString RenderTransform = "";
+		QString FontRenderingEmSize = "";
+		QString FontUri = "";
+		QString Fill = "";
+		QString OriginX = "";
+		QString OriginY = "";
+		QString Indices = "";
+		QString UnicodeString = "";
+		QDomElement glyph;
+		for(QDomElement txtGrp = grp.firstChildElement(); !txtGrp.isNull(); txtGrp = txtGrp.nextSiblingElement() )
+		{
+			if (txtGrp.tagName() != "Glyphs")
+			{
+				if (!first)
 				{
 					glyph.setAttribute("Indices", Indices);
 					glyph.setAttribute("UnicodeString", UnicodeString);
+					first = true;
+				}
+				grp2.appendChild(txtGrp.cloneNode(true));
+			}
+			else
+			{
+				if (first)
+				{
 					RenderTransform = txtGrp.attribute("RenderTransform");
 					FontRenderingEmSize = txtGrp.attribute("FontRenderingEmSize");
 					FontUri = txtGrp.attribute("FontUri");
@@ -1134,15 +1103,49 @@
 					grp2.appendChild(glyph);
 					first = false;
 				}
-			}
-			if (txtGrp == grp.lastChildElement())
-			{
-				glyph.setAttribute("Indices", Indices);
-				glyph.setAttribute("UnicodeString", UnicodeString);
-			}
-		}
-	}
-	parentElem.appendChild(grp2);
+				else
+				{
+					if ((RenderTransform == txtGrp.attribute("RenderTransform")) && (FontRenderingEmSize == txtGrp.attribute("FontRenderingEmSize")) && (FontUri == txtGrp.attribute("FontUri")) && (OriginY == txtGrp.attribute("OriginY")) && (Fill == txtGrp.attribute("Fill")))
+					{
+						Indices.append(";" + txtGrp.attribute("Indices"));
+						UnicodeString.append(txtGrp.attribute("UnicodeString"));
+					}
+					else
+					{
+						glyph.setAttribute("Indices", Indices);
+						glyph.setAttribute("UnicodeString", UnicodeString);
+						RenderTransform = txtGrp.attribute("RenderTransform");
+						FontRenderingEmSize = txtGrp.attribute("FontRenderingEmSize");
+						FontUri = txtGrp.attribute("FontUri");
+						Fill = txtGrp.attribute("Fill");
+						OriginX = txtGrp.attribute("OriginX");
+						OriginY = txtGrp.attribute("OriginY");
+						Indices = txtGrp.attribute("Indices");
+						UnicodeString = txtGrp.attribute("UnicodeString");
+						glyph = p_docu.createElement("Glyphs");
+						glyph.setAttribute("RenderTransform", RenderTransform);
+						glyph.setAttribute("BidiLevel", "0");
+						glyph.setAttribute("StyleSimulations", "None");
+						glyph.setAttribute("FontRenderingEmSize", FontRenderingEmSize);
+						glyph.setAttribute("FontUri", FontUri);
+						glyph.setAttribute("Fill", Fill);
+						glyph.setAttribute("OriginX", OriginX);
+						glyph.setAttribute("OriginY", OriginY);
+						glyph.setAttribute("Indices", Indices);
+						glyph.setAttribute("UnicodeString", UnicodeString);
+						grp2.appendChild(glyph);
+						first = false;
+					}
+				}
+				if (txtGrp == grp.lastChildElement())
+				{
+					glyph.setAttribute("Indices", Indices);
+					glyph.setAttribute("UnicodeString", UnicodeString);
+				}
+			}
+		}
+		parentElem.appendChild(grp2);
+	}
 	if (Item->isTextFrame())
 	{
 		if ((Item->GrTypeStroke != 0) || (Item->lineColor() != CommonStrings::None) || !Item->NamedLStyle.isEmpty())

Modified: trunk/Scribus/scribus/pslib.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21321&path=/trunk/Scribus/scribus/pslib.cpp
==============================================================================
--- trunk/Scribus/scribus/pslib.cpp	(original)
+++ trunk/Scribus/scribus/pslib.cpp	Mon May 16 07:21:23 2016
@@ -1990,7 +1990,8 @@
 				PS_translate(0, -c->height());
 				PS_scale(1, -1);
 			}
-			setTextSt(Doc, c, PNr-1, a, sep, farb, master);
+			if (c->itemText.length() != 0)
+				setTextSt(Doc, c, PNr-1, a, sep, farb, master);
 			if (((c->lineColor() != CommonStrings::None) || (!c->NamedLStyle.isEmpty()) || (!c->strokePattern().isEmpty()) || (c->GrTypeStroke > 0)))
 			{
 				PS_setlinewidth(c->lineWidth());
@@ -2302,7 +2303,8 @@
 					PS_restore();
 				}
 			}
-			setTextSt(Doc, c, PNr-1, a, sep, farb, master);
+			if (c->itemText.length() != 0)
+				setTextSt(Doc, c, PNr-1, a, sep, farb, master);
 			break;
 		case PageItem::Symbol:
 			if (m_Doc->docPatterns.contains(c->pattern()))
@@ -2921,7 +2923,8 @@
 					PS_translate(0, -ite->height());
 					PS_scale(1, -1);
 				}
-				setTextSt(Doc, ite, PNr, mPage, sep, farb, true);
+				if (ite->itemText.length() != 0)
+					setTextSt(Doc, ite, PNr, mPage, sep, farb, true);
 				if (((ite->lineColor() != CommonStrings::None) || (!ite->NamedLStyle.isEmpty()) || (!ite->strokePattern().isEmpty()) || (ite->GrTypeStroke > 0)))
 				{
 					if (ite->NamedLStyle.isEmpty()) // && (ite->lineWidth() != 0.0))
@@ -3018,7 +3021,8 @@
 						PS_restore();
 					}
 				}
-				setTextSt(Doc, ite, PNr, mPage, sep, farb, true);
+				if (ite->itemText.length() != 0)
+					setTextSt(Doc, ite, PNr, mPage, sep, farb, true);
 				PS_restore();
 			}
 			if (!success)




More information about the scribus-commit mailing list