r21124 by fschmid -

scribus-commit scribus-commit at lists.scribus.net
Sun Mar 27 18:41:16 UTC 2016


Author: fschmid
Date: Sun Mar 27 18:41:16 2016
New Revision: 21124

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=21124
Log:
Fixed Bug #13852: XPS export of Text is broken.

Modified:
    trunk/Scribus/scribus/plugins/export/xpsexport/xpsexplugin.cpp

Modified: trunk/Scribus/scribus/plugins/export/xpsexport/xpsexplugin.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21124&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	Sun Mar 27 18:41:16 2016
@@ -838,6 +838,14 @@
 		glyph.setAttribute("OriginX", m_xps->FToStr(x() * m_xps->conversionFactor));
 		glyph.setAttribute("OriginY", m_xps->FToStr(y() * m_xps->conversionFactor));
 		glyph.setAttribute("Indices", QString("%1,%2").arg(gl.glyph).arg((gl.xadvance * m_xps->conversionFactor) / size * 100));
+		for (int a = 32; a < 65536; a++)
+		{
+			if (gl.glyph == font().char2CMap(QChar(a)))
+			{
+				glyph.setAttribute("UnicodeString", QChar(a));
+				break;
+			}
+		}
 
 		m_group.appendChild(glyph);
 	}
@@ -989,6 +997,47 @@
 			ob.setAttribute("Data", pai);
 			getFillStyle(Item, ob, rel_root, xOffset, yOffset, false);
 			grp.appendChild(ob);
+		}
+	}
+	if (Item->isPathText())
+	{
+		if ((Item->PoShow) && (Item->lineColor() != CommonStrings::None))
+		{
+			QDomElement ob = p_docu.createElement("Path");
+			FPointArray path = Item->PoLine.copy();
+			path.scale(conversionFactor, conversionFactor);
+			QString pa = SetClipPath(&path, false);
+			ob.setAttribute("Data", pa);
+			if (Item->NamedLStyle.isEmpty())
+			{
+				if ((!Item->strokePattern().isEmpty()) && (Item->patternStrokePath))
+				{
+					processSymbolStroke(xOffset, yOffset, Item, parentElem, rel_root);
+				}
+				else
+				{
+					getStrokeStyle(Item, ob, rel_root, xOffset, yOffset);
+					grp.appendChild(ob);
+				}
+			}
+			else
+			{
+				QDomElement grp2 = p_docu.createElement("Canvas");
+				multiLine ml = m_Doc->MLineStyles[Item->NamedLStyle];
+				for (int it = ml.size()-1; it > -1; it--)
+				{
+					if ((ml[it].Color != CommonStrings::None) && (ml[it].Width != 0))
+					{
+						QDomElement ob3 = p_docu.createElement("Path");
+						ob3.setAttribute("Data", pa);
+						GetMultiStroke(&ml[it], ob3);
+						grp2.appendChild(ob3);
+					}
+				}
+				if (Item->lineTransparency() != 0)
+					grp2.setAttribute("Opacity", FToStr(1.0 - Item->lineTransparency()));
+				grp.appendChild(grp2);
+			}
 		}
 	}
 
@@ -1011,6 +1060,7 @@
 	QString OriginX = "";
 	QString OriginY = "";
 	QString Indices = "";
+	QString UnicodeString = "";
 	QDomElement glyph;
 	for(QDomElement txtGrp = grp.firstChildElement(); !txtGrp.isNull(); txtGrp = txtGrp.nextSiblingElement() )
 	{
@@ -1027,6 +1077,7 @@
 				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");
@@ -1037,6 +1088,7 @@
 				glyph.setAttribute("OriginX", OriginX);
 				glyph.setAttribute("OriginY", OriginY);
 				glyph.setAttribute("Indices", Indices);
+				glyph.setAttribute("UnicodeString", UnicodeString);
 				grp2.appendChild(glyph);
 				first = false;
 			}
@@ -1045,10 +1097,12 @@
 				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");
@@ -1056,6 +1110,7 @@
 					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");
@@ -1066,15 +1121,59 @@
 					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())
+		{
+			if (Item->NamedLStyle.isEmpty())
+			{
+				if ((!Item->strokePattern().isEmpty()) && (Item->patternStrokePath))
+				{
+					processSymbolStroke(xOffset, yOffset, Item, parentElem, rel_root);
+				}
+				else
+				{
+					QDomElement ob3 = p_docu.createElement("Path");
+					ob3.setAttribute("Data", pa);
+					getStrokeStyle(Item, ob3, rel_root, xOffset, yOffset);
+					ob3.setAttribute("RenderTransform", MatrixToStr(mpl));
+					parentElem.appendChild(ob3);
+				}
+			}
+			else
+			{
+				QDomElement grp2 = p_docu.createElement("Canvas");
+				multiLine ml = m_Doc->MLineStyles[Item->NamedLStyle];
+				for (int it = ml.size()-1; it > -1; it--)
+				{
+					if ((ml[it].Color != CommonStrings::None) && (ml[it].Width != 0))
+					{
+						QDomElement ob3 = p_docu.createElement("Path");
+						ob3.setAttribute("Data", pa);
+						GetMultiStroke(&ml[it], ob3);
+						grp2.appendChild(ob3);
+					}
+				}
+				if (Item->lineTransparency() != 0)
+					grp2.setAttribute("Opacity", FToStr(1.0 - Item->lineTransparency()));
+				grp2.setAttribute("RenderTransform", MatrixToStr(mpl));
+				parentElem.appendChild(grp2);
+			}
+		}
+	}
 }
 
 void XPSExPlug::processSymbolItem(double xOffset, double yOffset, PageItem *Item, QDomElement &parentElem, QDomElement &rel_root)




More information about the scribus-commit mailing list