r17023 by fschmid - Fixed Bug 7659: "Page numbering disappears when Text Frame is attached to Path"

scribus-commit scribus-commit at lists.scribus.net
Fri Nov 25 18:14:01 UTC 2011


Author: fschmid
Date: Fri Nov 25 18:14:01 2011
New Revision: 17023

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=17023
Log:
Fixed Bug 7659: "Page numbering disappears when Text Frame is attached to Path"

Modified:
    trunk/Scribus/scribus/pageitem_pathtext.cpp
    trunk/Scribus/scribus/pageitem_pathtext.h
    trunk/Scribus/scribus/pdflib_core.cpp
    trunk/Scribus/scribus/plugins/svgexplugin/svgexplugin.cpp
    trunk/Scribus/scribus/pslib.cpp
    trunk/Scribus/scribus/scribusview.cpp

Modified: trunk/Scribus/scribus/pageitem_pathtext.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17023&path=/trunk/Scribus/scribus/pageitem_pathtext.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem_pathtext.cpp (original)
+++ trunk/Scribus/scribus/pageitem_pathtext.cpp Fri Nov 25 18:14:01 2011
@@ -51,7 +51,7 @@
 using namespace std;
 
 PageItem_PathText::PageItem_PathText(ScribusDoc *pa, double x, double y, double w, double h, double w2, QString fill, QString outline)
-	: PageItem(pa, PageItem::PathText, x, y, w, h, w2, fill, outline)
+	: PageItem(pa, PageItem::PathText, x, y, w, h, w2, fill, outline), itemRenderText(pa)
 {
 	firstChar = 0;
 	MaxChars = itemText.length();
@@ -177,17 +177,35 @@
 		totalTextLen += itemText.charStyle(0).fontSize() * itemText.charStyle(0).tracking() / 10000.0;
 	}
 	segLen = PoLine.lenPathSeg(seg);
+	itemRenderText.setDefaultStyle(itemText.defaultStyle());
+	itemRenderText.clear();
 	for (a = firstChar; a < itemText.length(); ++a)
 	{
+		CharStyle nstyle;
 		hl = itemText.item(a);
+		nstyle = itemText.charStyle(a);
+		chstr = hl->ch;
+		if (!(chstr[0] == SpecialChars::PARSEP || chstr[0] == SpecialChars::TAB || chstr[0] == SpecialChars::LINEBREAK))
+			chstr = ExpandToken(a);
+		for (int cc = 0; cc < chstr.count(); cc++)
+		{
+			int pot = itemRenderText.length();
+			itemRenderText.insertChars(pot, chstr.mid(cc, 1));
+			itemRenderText.applyCharStyle(pot, 1, nstyle);
+		}
+		chstr.clear();
+	}
+	for (a = firstChar; a < itemRenderText.length(); ++a)
+	{
+		hl = itemRenderText.item(a);
 		chstr = hl->ch;
 		if (chstr[0] == SpecialChars::PAGENUMBER || chstr[0] == SpecialChars::PARSEP || chstr[0] == SpecialChars::PAGECOUNT
 			|| chstr[0] == SpecialChars::TAB || chstr[0] == SpecialChars::LINEBREAK)
 			continue;
-		if (a < itemText.length()-1)
-			chstr += itemText.text(a+1, 1);
+		if (a < itemRenderText.length()-1)
+			chstr += itemRenderText.text(a+1, 1);
 		hl->glyph.yadvance = 0;
-		layoutGlyphs(itemText.charStyle(a), chstr, hl->glyph);
+		layoutGlyphs(itemRenderText.charStyle(a), chstr, hl->glyph);
 		hl->glyph.shrink();
 		if (hl->hasObject())
 			totalTextLen += (hl->embedded.getItem()->gWidth + hl->embedded.getItem()->lineWidth()) * hl->glyph.scaleH;
@@ -198,36 +216,36 @@
 	{
 		totalCurveLen += PoLine.lenPathSeg(segs);
 	}
-	if ((itemText.defaultStyle().alignment() != 0) && (totalCurveLen >= totalTextLen + Extra))
-	{
-		if (itemText.defaultStyle().alignment() == 2)
+	if ((itemRenderText.defaultStyle().alignment() != 0) && (totalCurveLen >= totalTextLen + Extra))
+	{
+		if (itemRenderText.defaultStyle().alignment() == 2)
 		{
 			CurX = totalCurveLen  - totalTextLen;
 			CurX -= Extra;
 		}
-		if (itemText.defaultStyle().alignment() == 1)
+		if (itemRenderText.defaultStyle().alignment() == 1)
 			CurX = (totalCurveLen - totalTextLen) / 2.0;
-		if ((itemText.defaultStyle().alignment() == 3) || (itemText.defaultStyle().alignment() == 4))
-			extraOffset = (totalCurveLen - Extra  - totalTextLen) / static_cast<double>(itemText.length());
+		if ((itemRenderText.defaultStyle().alignment() == 3) || (itemRenderText.defaultStyle().alignment() == 4))
+			extraOffset = (totalCurveLen - Extra  - totalTextLen) / static_cast<double>(itemRenderText.length());
 	}
 #ifndef NLS_PROTO
 	QPainterPath guidePath = PoLine.toQPainterPath(false);
 	QList<QPainterPath> pathList = decomposePath(guidePath);
 	QPainterPath currPath = pathList[0];
 	int currPathIndex = 0;
-	for (a = firstChar; a < itemText.length(); ++a)
+	for (a = firstChar; a < itemRenderText.length(); ++a)
 	{
 		CurY = 0;
-		hl = itemText.item(a);
+		hl = itemRenderText.item(a);
 		chstr = hl->ch;
 		if (chstr[0] == SpecialChars::PAGENUMBER || chstr[0] == SpecialChars::PARSEP || chstr[0] == SpecialChars::PAGECOUNT
 			|| chstr[0] == SpecialChars::TAB || chstr[0] == SpecialChars::LINEBREAK)
 			continue;
 		chs = hl->fontSize();
-		if (a < itemText.length()-1)
-			chstr += itemText.text(a+1, 1);
+		if (a < itemRenderText.length()-1)
+			chstr += itemRenderText.text(a+1, 1);
 		hl->glyph.yadvance = 0;
-		layoutGlyphs(itemText.charStyle(a), chstr, hl->glyph);
+		layoutGlyphs(itemRenderText.charStyle(a), chstr, hl->glyph);
 		hl->glyph.shrink();                                                           // HACK
 		if (hl->hasObject())
 			dx = (hl->embedded.getItem()->gWidth + hl->embedded.getItem()->lineWidth()) * hl->glyph.scaleH / 2.0;
@@ -287,8 +305,8 @@
 		p->setWorldMatrix(trafo);
 		if (!m_Doc->RePos)
 		{
-			actFill = itemText.charStyle(a).fillColor();
-			actFillShade = itemText.charStyle(a).fillShade();
+			actFill = itemRenderText.charStyle(a).fillColor();
+			actFillShade = itemRenderText.charStyle(a).fillShade();
 			if (actFill != CommonStrings::None)
 			{
 				p->setFillMode(ScPainter::Solid);
@@ -305,8 +323,8 @@
 			}
 			else
 				p->setFillMode(ScPainter::None);
-			actStroke = itemText.charStyle(a).strokeColor();
-			actStrokeShade = itemText.charStyle(a).strokeShade();
+			actStroke = itemRenderText.charStyle(a).strokeColor();
+			actStrokeShade = itemRenderText.charStyle(a).strokeShade();
 			if (actStroke != CommonStrings::None)
 			{
 				if ((cachedStrokeShade != actStrokeShade) || (cachedStroke != actStroke))
@@ -322,9 +340,9 @@
 			}
 			p->translate(0.0, BaseOffs);
 			if (hl->ch == SpecialChars::OBJECT)
-				DrawObj_Embedded(p, cullingArea, itemText.charStyle(a), hl->embedded.getItem());
+				DrawObj_Embedded(p, cullingArea, itemRenderText.charStyle(a), hl->embedded.getItem());
 			else
-				drawGlyphs(p, itemText.charStyle(a), hl->glyph);
+				drawGlyphs(p, itemRenderText.charStyle(a), hl->glyph);
 		}
 		p->setWorldMatrix(savWM);
 		p->restore();

Modified: trunk/Scribus/scribus/pageitem_pathtext.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17023&path=/trunk/Scribus/scribus/pageitem_pathtext.h
==============================================================================
--- trunk/Scribus/scribus/pageitem_pathtext.h (original)
+++ trunk/Scribus/scribus/pageitem_pathtext.h Fri Nov 25 18:14:01 2011
@@ -46,6 +46,7 @@
 	virtual bool createInfoGroup(QFrame *, QGridLayout *);
 	virtual void applicableActions(QStringList& actionList);
 	virtual QString infoDescription();
+	StoryText itemRenderText;
 
 protected:
 	virtual void DrawObj_Item(ScPainter *p, QRectF e);

Modified: trunk/Scribus/scribus/pdflib_core.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17023&path=/trunk/Scribus/scribus/pdflib_core.cpp
==============================================================================
--- trunk/Scribus/scribus/pdflib_core.cpp (original)
+++ trunk/Scribus/scribus/pdflib_core.cpp Fri Nov 25 18:14:01 2011
@@ -61,6 +61,7 @@
 #include "pageitem.h"
 #include "pageitem_textframe.h"
 #include "pageitem_group.h"
+#include "pageitem_pathtext.h"
 #include "pdfoptions.h"
 #include "prefscontext.h"
 #include "prefsmanager.h"
@@ -2431,75 +2432,6 @@
 						}
 						break;
 					case PageItem::PathText:
-						if (ite->PoShow)
-						{
-							if (ite->PoLine.size() > 3)
-							{
-								PutPage("q\n");
-								if ((ite->lineColor() != CommonStrings::None) || (!ite->NamedLStyle.isEmpty()) || (!ite->strokePattern().isEmpty()) || (ite->GrTypeStroke > 0))
-								{
-									if (((ite->lineTransparency() != 0) || (ite->lineBlendmode() != 0)) && ((Options.Version >= PDFOptions::PDFVersion_14) || (Options.Version == PDFOptions::PDFVersion_X4)))
-										PutPage(PDF_TransparenzStroke(ite));
-									if (ite->NamedLStyle.isEmpty())
-									{
-										if (!ite->strokePattern().isEmpty())
-										{
-											if (ite->patternStrokePath)
-											{
-												QPainterPath path = ite->PoLine.toQPainterPath(false);
-												PutPage(HandleBrushPattern(ite, path, pag, pag->pageNr()));
-											}
-											else
-											{
-												if (!PDF_PatternFillStroke(tmpOut, ite, 1))
-													return false;
-												PutPage(tmpOut);
-												PutPage(SetClipPath(ite, false));
-												PutPage("S\n");
-											}
-										}
-										else if (ite->GrTypeStroke > 0)
-										{
-											if (!PDF_GradientFillStroke(tmpOut, ite, true))
-												return false;
-											PutPage("q\n");
-											PutPage(tmpOut);
-											PutPage(SetClipPath(ite, false));
-											PutPage("S\n");
-											PutPage("Q\n");
-										}
-										else
-										{
-											PutPage(SetClipPath(ite, false));
-											PutPage("S\n");
-										}
-									}
-									else
-									{
-										multiLine ml = doc.MLineStyles[ite->NamedLStyle];
-										for (int it = ml.size()-1; it > -1; it--)
-										{
-											if ((ml[it].Color != CommonStrings::None) && (ml[it].Width != 0))
-											{
-												PutPage(setStrokeMulti(&ml[it]));
-												PutPage(SetClipPath(ite, false));
-												PutPage("S\n");
-											}
-										}
-									}
-								}
-								PutPage("Q\n");
-							}
-						}
-						if (((ite->GrMask > 0) || (ite->fillTransparency() != 0) || (ite->fillBlendmode() != 0)) && ((Options.Version >= PDFOptions::PDFVersion_14) || (Options.Version == PDFOptions::PDFVersion_X4)))
-						{
-							if (ite->GrMask > 0)
-								PutPage("q\n");
-							PutPage(PDF_TransparenzFill(ite));
-						}
-						PutPage(setTextSt(ite, pag->pageNr(), pag));
-						if (ite->GrMask > 0)
-							PutPage("Q\n");
 						break;
 					case PageItem::OSGFrame:
 						break;
@@ -3229,7 +3161,7 @@
 			if ((!pag->pageName().isEmpty()) && (ite->OwnPage != static_cast<int>(pag->pageNr())) && (ite->OwnPage != -1))
 				continue;
 			QString name = QString("/master_page_obj_%1_%2").arg(mPageIndex).arg(qHash(ite));
-			if (! ite->asTextFrame())
+			if ((!ite->asTextFrame()) && (!ite->asPathText()))
 				PutPage(name+" Do\n");
 			else
 			{
@@ -4964,13 +4896,16 @@
 	}
 	else
 	{
+		ite->OwnPage = PNr;
+		ite->asPathText()->layout();
+		ite->OwnPage = savedOwnPage;
 		double CurX = 0;
-		for (int d = ite->firstInFrame(); d <= ite->lastInFrame(); ++d)
-		{
-			const ScText * const hl = ite->itemText.item(d);
+		for (int d = 0; d < ite->asPathText()->itemRenderText.length(); ++d)
+		{
+			const ScText * const hl = ite->asPathText()->itemRenderText.item(d);
 			const QChar ch = hl->ch;
-			const CharStyle& chstyle(ite->itemText.charStyle(d));
-			const ParagraphStyle& pstyle(ite->itemText.paragraphStyle(d));
+			const CharStyle& chstyle(ite->asPathText()->itemRenderText.charStyle(d));
+			const ParagraphStyle& pstyle(ite->asPathText()->itemRenderText.paragraphStyle(d));
 			if (SpecialChars::isBreak(ch, true) || (ch == QChar(10)))
 				continue;
 			if (chstyle.effects() & ScStyle_SuppressSpace)

Modified: trunk/Scribus/scribus/plugins/svgexplugin/svgexplugin.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17023&path=/trunk/Scribus/scribus/plugins/svgexplugin/svgexplugin.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/svgexplugin/svgexplugin.cpp (original)
+++ trunk/Scribus/scribus/plugins/svgexplugin/svgexplugin.cpp Fri Nov 25 18:14:01 2011
@@ -36,6 +36,7 @@
 #include "canvas.h"
 #include "cmsettings.h"
 #include "commonstrings.h"
+#include "pageitem_pathtext.h"
 #include "prefsmanager.h"
 #include "prefsfile.h"
 #include "prefscontext.h"
@@ -976,13 +977,13 @@
 	}
 	double x, y, wide;
 	QString chstr;
-	for (int a = 0; a < Item->itemText.length(); ++a)
+	for (int a = 0; a < Item->asPathText()->itemRenderText.length(); ++a)
 	{
 		x = 0.0;
 		y = 0.0;
-		ScText *hl = Item->itemText.item(a);
-		const CharStyle& charStyle(Item->itemText.charStyle(a));
-		chstr = Item->itemText.text(a,1);
+		ScText *hl = Item->asPathText()->itemRenderText.item(a);
+		const CharStyle& charStyle(Item->asPathText()->itemRenderText.charStyle(a));
+		chstr = Item->asPathText()->itemRenderText.text(a,1);
 		if ((chstr == QChar(13)) || (chstr == QChar(29)))
 			continue;
 		if (chstr == QChar(30))

Modified: trunk/Scribus/scribus/pslib.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17023&path=/trunk/Scribus/scribus/pslib.cpp
==============================================================================
--- trunk/Scribus/scribus/pslib.cpp (original)
+++ trunk/Scribus/scribus/pslib.cpp Fri Nov 25 18:14:01 2011
@@ -40,6 +40,7 @@
 #include "scconfig.h"
 #include "pluginapi.h"
 #include "pageitem_latexframe.h"
+#include "pageitem_pathtext.h"
 #include "prefsmanager.h"
 #include "scclocale.h"
 #include "sccolorengine.h"
@@ -1711,6 +1712,7 @@
 	double tsz;
 	int h, s, v, k;
 	int d;
+	int savedOwnPage;
 	ScText *hl;
 	QVector<double> dum;
 	QChar chstr;
@@ -2151,6 +2153,8 @@
 			}
 			break;
 		case PageItem::PathText:
+			if (master)
+				break;
 			if (c->PoShow)
 			{
 				if (c->PoLine.size() > 3)
@@ -2195,10 +2199,14 @@
 				}
 			}
 #ifndef NLS_PROTO
-			for (d = c->firstInFrame(); d <= c->lastInFrame(); ++d)
-			{
-				hl = c->itemText.item(d);
-				const CharStyle & style(c->itemText.charStyle(d));
+			savedOwnPage = c->OwnPage;
+			c->OwnPage = PNr-1;
+			c->asPathText()->layout();
+			c->OwnPage = savedOwnPage;
+			for (d = 0; d < c->asPathText()->itemRenderText.length(); ++d)
+			{
+				hl = c->asPathText()->itemRenderText.item(d);
+				const CharStyle & style(c->asPathText()->itemRenderText.charStyle(d));
 				if ((hl->ch == QChar(13)) || (hl->ch == QChar(30)) || (hl->ch == QChar(9)) || (hl->ch == QChar(28)))
 					continue;
 				QPointF tangt = QPointF( cos(hl->PRot), sin(hl->PRot) );
@@ -2688,6 +2696,8 @@
 					continue;
 				if ((!a->pageName().isEmpty()) && (c->asTextFrame()))
 					continue;
+				if ((!a->pageName().isEmpty()) && (c->asPathText()))
+					continue;
 				if ((!a->pageName().isEmpty()) && (c->asImageFrame()) && ((sep) || (!farb)))
 					continue;
 				//if ((!Art) && (view->SelItem.count() != 0) && (!c->Select))
@@ -2721,6 +2731,8 @@
 			if (c->LayerID != ll.ID)
 				continue;
 			if ((!a->pageName().isEmpty()) && (c->asTextFrame()))
+				continue;
+			if ((!a->pageName().isEmpty()) && (c->asPathText()))
 				continue;
 			if ((!a->pageName().isEmpty()) && (c->asImageFrame()) && ((sep) || (!farb)))
 				continue;
@@ -2811,7 +2823,7 @@
 				ScQApp->processEvents();
 			if ((ite->LayerID != layer.ID) || (!ite->printEnabled()))
 				continue;
-			if (!(ite->asTextFrame()) && !(ite->asImageFrame()))
+			if (!(ite->asTextFrame()) && !(ite->asImageFrame()) && !(ite->asPathText()))
 			{
 				int mpIndex = Doc->MasterNames[page->MPageNam];
 				PS_UseTemplate(QString("mp_obj_%1_%2").arg(mpIndex).arg(qHash(ite)));
@@ -2908,6 +2920,462 @@
 				}
 				PS_restore();
 			}
+			else if (ite->asPathText())
+			{
+				double tsz;
+				int d;
+				ScText *hl;
+				QChar chstr;
+				PS_save();
+				PS_translate(ite->xPos() - mPage->xOffset(), mPage->height() - (ite->yPos() - mPage->yOffset()));
+				if (ite->PoShow)
+				{
+					if (ite->PoLine.size() > 3)
+					{
+						PS_save();
+						if (ite->NamedLStyle.isEmpty()) //&& (c->lineWidth() != 0.0))
+						{
+							if ((!ite->strokePattern().isEmpty()) && (ite->patternStrokePath))
+							{
+								QPainterPath path = ite->PoLine.toQPainterPath(false);
+								HandleBrushPattern(ite, path, mPage, PNr, sep, farb, ic, gcr, true);
+							}
+							else
+							{
+								SetClipPath(&ite->PoLine, false);
+								if (!ite->strokePattern().isEmpty())
+									HandleStrokePattern(ite);
+								else if (ite->GrTypeStroke > 0)
+									HandleGradientFillStroke(ite, gcr);
+								else if (ite->lineColor() != CommonStrings::None)
+									putColor(ite->lineColor(), ite->lineShade(), false);
+							}
+						}
+						else
+						{
+							multiLine ml = Doc->MLineStyles[ite->NamedLStyle];
+							for (int it = ml.size()-1; it > -1; it--)
+							{
+								if (ml[it].Color != CommonStrings::None) //&& (ml[it].Width != 0))
+								{
+									SetColor(ml[it].Color, ml[it].Shade, &h, &s, &v, &k, gcr);
+									PS_setcmykcolor_stroke(h / 255.0, s / 255.0, v / 255.0, k / 255.0);
+									PS_setlinewidth(ml[it].Width);
+									PS_setcapjoin(static_cast<Qt::PenCapStyle>(ml[it].LineEnd), static_cast<Qt::PenJoinStyle>(ml[it].LineJoin));
+									PS_setdash(static_cast<Qt::PenStyle>(ml[it].Dash), 0, dum);
+									SetClipPath(&ite->PoLine, false);
+									putColor(ml[it].Color, ml[it].Shade, false);
+								}
+							}
+						}
+						PS_restore();
+					}
+				}
+	#ifndef NLS_PROTO
+				int savedOwnPage = ite->OwnPage;
+				ite->OwnPage = PNr;
+				ite->asPathText()->layout();
+				ite->OwnPage = savedOwnPage;
+				for (d = 0; d < ite->asPathText()->itemRenderText.length(); ++d)
+				{
+					hl = ite->asPathText()->itemRenderText.item(d);
+					const CharStyle & style(ite->asPathText()->itemRenderText.charStyle(d));
+					if ((hl->ch == QChar(13)) || (hl->ch == QChar(30)) || (hl->ch == QChar(9)) || (hl->ch == QChar(28)))
+						continue;
+					QPointF tangt = QPointF( cos(hl->PRot), sin(hl->PRot) );
+					tsz = style.fontSize();
+					chstr = hl->ch;
+					if (hl->ch == QChar(29))
+						chstr = ' ';
+					if (hl->ch == QChar(0xA0))
+						chstr = ' ';
+					if (style.effects() & 32)
+					{
+						if (chstr.toUpper() != chstr)
+							chstr = chstr.toUpper();
+					}
+					if (style.effects() & 64)
+					{
+						if (chstr.toUpper() != chstr)
+						{
+							tsz = style.fontSize() * Doc->typographicPrefs().valueSmallCaps / 100;
+							chstr = chstr.toUpper();
+						}
+					}
+					if (style.effects() & 1)
+						tsz = style.fontSize() * Doc->typographicPrefs().scalingSuperScript / 100;
+					if (style.effects() & 2)
+						tsz = style.fontSize() * Doc->typographicPrefs().scalingSubScript / 100;
+					if (style.fillColor() != CommonStrings::None)
+					{
+						SetColor(style.fillColor(), style.fillShade(), &h, &s, &v, &k, gcr);
+						PS_setcmykcolor_stroke(h / 255.0, s / 255.0, v / 255.0, k / 255.0);
+					}
+					if (hl->hasObject())
+					{
+						PS_save();
+						PutStream( MatrixToStr(1.0, 0.0, 0.0, -1.0, -hl->PDx, 0.0) + "\n");
+						if (ite->textPathFlipped)
+						{
+							PutStream("[1 0 0 -1 0 0]\n");
+							PutStream("[0 0 0  0 0 0] concatmatrix\n"); //???????
+						}
+						if (ite->textPathType == 0)
+							PutStream( MatrixToStr(tangt.x(), -tangt.y(), -tangt.y(), -tangt.x(), hl->PtransX, -hl->PtransY) + "\n");
+						else if (ite->textPathType == 1)
+							PutStream( MatrixToStr(1.0, 0.0, 0.0, -1.0, hl->PtransX, -hl->PtransY) + "\n");
+						else if (ite->textPathType == 2)
+						{
+							double a = 1;
+							double b = -1;
+							if (tangt.x()< 0)
+							{
+								a = -1;
+								b = 1;
+							}
+							if (fabs(tangt.x()) > 0.1)
+								PutStream( MatrixToStr(a, (tangt.y() / tangt.x()) * b, 0.0, -1.0, hl->PtransX, -hl->PtransY) + "\n");
+							else
+								PutStream( MatrixToStr(a, 4.0, 0.0, -1.0, hl->PtransX, -hl->PtransY) + "\n");
+						}
+						PutStream("[0.0 0.0 0.0 0.0 0.0 0.0] concatmatrix\nconcat\n");
+	//					PS_translate(0, (tsz / 10.0));
+						if (ite->BaseOffs != 0)
+							PS_translate(0, -ite->BaseOffs);
+						if (style.scaleH() != 1000)
+							PS_scale(style.scaleH() / 1000.0, 1);
+						QList<PageItem*> emG = hl->embedded.getGroupedItems();
+						for (int em = 0; em < emG.count(); ++em)
+						{
+							PageItem* embedded = emG.at(em);
+							PS_save();
+							PS_translate(embedded->gXpos * (style.scaleH() / 1000.0), ((embedded->gHeight * (style.scaleV() / 1000.0)) - embedded->gYpos * (style.scaleV() / 1000.0)));
+							if (style.baselineOffset() != 0)
+								PS_translate(0, embedded->gHeight * (style.baselineOffset() / 1000.0));
+							if (style.scaleH() != 1000)
+								PS_scale(style.scaleH() / 1000.0, 1);
+							if (style.scaleV() != 1000)
+								PS_scale(1, style.scaleV() / 1000.0);
+							ProcessItem(Doc, mPage, embedded, PNr, sep, farb, ic, gcr, true, true);
+							PS_restore();
+						}
+						PS_restore();
+						continue;
+					}
+					/* Subset all TTF Fonts until the bug in the TTF-Embedding Code is fixed */
+					if (FontSubsetMap.contains(style.font().scName()))
+					{
+	//					uint chr = chstr.unicode();
+						uint chr = style.font().char2CMap(chstr);
+						if (style.font().canRender(chstr))
+						{
+							PS_save();
+							if (style.fillColor() != CommonStrings::None)
+							{
+								PutStream( MatrixToStr(1.0, 0.0, 0.0, -1.0, -hl->PDx, 0.0) + "\n");
+								if (ite->textPathFlipped)
+								{
+									PutStream("[1.0 0.0 0.0 -1.0 0.0 0.0]\n");
+									PutStream("[0.0 0.0 0.0  0.0 0.0 0.0] concatmatrix\n");
+								}
+								if (ite->textPathType == 0)
+									PutStream( MatrixToStr(tangt.x(), -tangt.y(), -tangt.y(), -tangt.x(), hl->PtransX, -hl->PtransY) + "\n");
+								else if (ite->textPathType == 1)
+									PutStream( MatrixToStr(1.0, 0.0, 0.0, -1.0, hl->PtransX, -hl->PtransY) + "\n");
+								else if (ite->textPathType == 2)
+								{
+									double a = 1;
+									double b = -1;
+									if (tangt.x() < 0)
+									{
+										a = -1;
+										b = 1;
+									}
+									if (fabs(tangt.x()) > 0.1)
+										PutStream( MatrixToStr(a, (tangt.y() / tangt.x()) * b, 0.0, -1.0, hl->PtransX, -hl->PtransY) + "\n");
+									else
+										PutStream( MatrixToStr(a, 4.0, 0.0, -1.0, hl->PtransX, -hl->PtransY) + "\n");
+								}
+								PutStream("[0.0 0.0 0.0 0.0 0.0 0.0] concatmatrix\nconcat\n");
+								PS_translate(0, (tsz / 10.0));
+								if (ite->BaseOffs != 0)
+									PS_translate(0, -ite->BaseOffs);
+								if (hl->glyph.xoffset !=0 || hl->glyph.yoffset != 0)
+									PS_translate(hl->glyph.xoffset, -hl->glyph.yoffset);
+								if (style.scaleH() != 1000)
+									PS_scale(style.scaleH() / 1000.0, 1);
+								if (((style.effects() & ScStyle_Underline) && !SpecialChars::isBreak(chstr)) //FIXME && (chstr != QChar(13)))
+									|| ((style.effects() & ScStyle_UnderlineWords) && !chstr.isSpace() && !SpecialChars::isBreak(chstr)))
+								{
+									PS_save();
+									PS_translate(0, -(tsz / 10.0));
+									double Ulen = hl->glyph.xadvance;
+									double Upos, Uwid, kern;
+									if (style.effects() & ScStyle_StartOfLine)
+										kern = 0;
+									else
+										kern = style.fontSize() * style.tracking() / 10000.0;
+									if ((style.underlineOffset() != -1) || (style.underlineWidth() != -1))
+									{
+										if (style.underlineOffset() != -1)
+											Upos = (style.underlineOffset() / 1000.0) * (style.font().descent(style.fontSize() / 10.0));
+										else
+											Upos = style.font().underlinePos(style.fontSize() / 10.0);
+										if (style.underlineWidth() != -1)
+											Uwid = (style.underlineWidth() / 1000.0) * (style.fontSize() / 10.0);
+										else
+											Uwid = qMax(style.font().strokeWidth(style.fontSize() / 10.0), 1.0);
+									}
+									else
+									{
+										Upos = style.font().underlinePos(style.fontSize() / 10.0);
+										Uwid = qMax(style.font().strokeWidth(style.fontSize() / 10.0), 1.0);
+									}
+									if (style.baselineOffset() != 0)
+										Upos += (style.fontSize() / 10.0) * hl->glyph.scaleV * (style.baselineOffset() / 1000.0);
+									if (style.fillColor() != CommonStrings::None)
+									{
+										SetColor(style.fillColor(), style.fillShade(), &h, &s, &v, &k, gcr);
+										PS_setcmykcolor_stroke(h / 255.0, s / 255.0, v / 255.0, k / 255.0);
+									}
+									PS_setlinewidth(Uwid);
+									if (style.effects() & ScStyle_Subscript)
+									{
+										PS_moveto(hl->glyph.xoffset     , Upos);
+										PS_lineto(hl->glyph.xoffset+Ulen, Upos);
+									}
+									else
+									{
+										PS_moveto(hl->glyph.xoffset     , hl->glyph.yoffset+Upos);
+										PS_lineto(hl->glyph.xoffset+Ulen, hl->glyph.yoffset+Upos);
+									}
+									putColor(style.fillColor(), style.fillShade(), false);
+									PS_restore();
+								}
+								if (chstr != ' ')
+								{
+									if ((style.effects() & ScStyle_Shadowed) && (style.strokeColor() != CommonStrings::None))
+									{
+										PS_save();
+										PS_translate(style.fontSize() * style.shadowXOffset() / 10000.0, style.fontSize() * style.shadowYOffset() / 10000.0);
+										putColorNoDraw(style.strokeColor(), style.strokeShade(), gcr);
+										PS_showSub(chr, FontSubsetMap[style.font().scName()], tsz / 10.0, false);
+										PS_restore();
+									}
+									putColorNoDraw(style.fillColor(), style.fillShade(), gcr);
+									PS_showSub(chr, FontSubsetMap[style.font().scName()], tsz / 10.0, false);
+									if ((style.effects() & ScStyle_Outline))
+									{
+										if ((style.strokeColor() != CommonStrings::None) && ((tsz * style.outlineWidth() / 10000.0) != 0))
+										{
+											PS_save();
+											PS_setlinewidth(tsz * style.outlineWidth() / 10000.0);
+											putColorNoDraw(style.strokeColor(), style.strokeShade(), gcr);
+											PS_showSub(chr, FontSubsetMap[style.font().scName()], tsz / 10.0, true);
+											PS_restore();
+										}
+									}
+								}
+								if ((style.effects() & ScStyle_Strikethrough) && (chstr != SpecialChars::PARSEP))
+								{
+									PS_save();
+									PS_translate(0, -(tsz / 10.0));
+									double Ulen = hl->glyph.xadvance;
+									double Upos, Uwid, kern;
+									if (hl->effects() & ScStyle_StartOfLine)
+										kern = 0;
+									else
+										kern = style.fontSize() * style.tracking() / 10000.0;
+									if ((style.strikethruOffset() != -1) || (style.strikethruWidth() != -1))
+									{
+										if (style.strikethruOffset() != -1)
+											Upos = (style.strikethruOffset() / 1000.0) * (style.font().ascent(style.fontSize() / 10.0));
+										else
+											Upos = style.font().strikeoutPos(style.fontSize() / 10.0);
+										if (style.strikethruWidth() != -1)
+											Uwid = (style.strikethruWidth() / 1000.0) * (style.fontSize() / 10.0);
+										else
+											Uwid = qMax(style.font().strokeWidth(style.fontSize() / 10.0), 1.0);
+									}
+									else
+									{
+										Upos = style.font().strikeoutPos(style.fontSize() / 10.0);
+										Uwid = qMax(style.font().strokeWidth(style.fontSize() / 10.0), 1.0);
+									}
+									if (style.baselineOffset() != 0)
+										Upos += (style.fontSize() / 10.0) * hl->glyph.scaleV * (style.baselineOffset() / 1000.0);
+									if (style.fillColor() != CommonStrings::None)
+									{
+										SetColor(style.fillColor(), style.fillShade(), &h, &s, &v, &k, gcr);
+										PS_setcmykcolor_stroke(h / 255.0, s / 255.0, v / 255.0, k / 255.0);
+									}
+									PS_setlinewidth(Uwid);
+									PS_moveto(hl->glyph.xoffset     , Upos);
+									PS_lineto(hl->glyph.xoffset+Ulen, Upos);
+									putColor(style.fillColor(), style.fillShade(), false);
+									PS_restore();
+								}
+							}
+							PS_restore();
+						}
+					}
+					else
+					{
+						uint glyph = hl->glyph.glyph;
+						PS_selectfont(style.font().replacementName(), tsz / 10.0);
+						PS_save();
+						PutStream( MatrixToStr(1.0, 0.0, 0.0, -1.0, -hl->PDx, 0.0) + "\n");
+						if (ite->textPathFlipped)
+						{
+							PutStream("[1.0 0.0 0.0 -1.0 0.0 0.0]\n");
+							PutStream("[0.0 0.0 0.0  0.0 0.0 0.0] concatmatrix\n");
+						}
+						if (ite->textPathType == 0)
+							PutStream( MatrixToStr(tangt.x(), -tangt.y(), -tangt.y(), -tangt.x(), hl->PtransX, -hl->PtransY) + "\n");
+						else if (ite->textPathType == 1)
+							PutStream( MatrixToStr(1.0, 0.0, 0.0, -1.0, hl->PtransX, -hl->PtransY) + "\n");
+						else if (ite->textPathType == 2)
+						{
+							double a = 1;
+							double b = -1;
+							if (tangt.x() < 0)
+							{
+								a = -1;
+								b = 1;
+							}
+							if (fabs(tangt.x()) > 0.1)
+								PutStream( MatrixToStr(a, (tangt.y() / tangt.x()) * b, 0.0, -1.0, hl->PtransX, -hl->PtransY) + "\n");
+							else
+								PutStream( MatrixToStr(a, 4.0, 0.0, -1.0, hl->PtransX, -hl->PtransY) + "\n");
+						}
+						PutStream("[0.0 0.0 0.0 0.0 0.0 0.0] concatmatrix\nconcat\n");
+						if (ite->BaseOffs != 0)
+							PS_translate(0, -ite->BaseOffs);
+						if (hl->glyph.xoffset !=0 || hl->glyph.yoffset != 0)
+							PS_translate(hl->glyph.xoffset, -hl->glyph.yoffset);
+						if (((style.effects() & ScStyle_Underline) && !SpecialChars::isBreak(chstr)) //FIXME && (chstr != QChar(13)))
+							|| ((style.effects() & ScStyle_UnderlineWords) && !chstr.isSpace() && !SpecialChars::isBreak(chstr)))
+						{
+							PS_save();
+							double Ulen = hl->glyph.xadvance;
+							double Upos, Uwid, kern;
+							if (style.effects() & ScStyle_StartOfLine)
+								kern = 0;
+							else
+								kern = style.fontSize() * style.tracking() / 10000.0;
+							if ((style.underlineOffset() != -1) || (style.underlineWidth() != -1))
+							{
+								if (style.underlineOffset() != -1)
+									Upos = (style.underlineOffset() / 1000.0) * (style.font().descent(style.fontSize() / 10.0));
+								else
+									Upos = style.font().underlinePos(style.fontSize() / 10.0);
+								if (style.underlineWidth() != -1)
+									Uwid = (style.underlineWidth() / 1000.0) * (style.fontSize() / 10.0);
+								else
+									Uwid = qMax(style.font().strokeWidth(style.fontSize() / 10.0), 1.0);
+							}
+							else
+							{
+								Upos = style.font().underlinePos(style.fontSize() / 10.0);
+								Uwid = qMax(style.font().strokeWidth(style.fontSize() / 10.0), 1.0);
+							}
+							if (style.baselineOffset() != 0)
+								Upos += (style.fontSize() / 10.0) * hl->glyph.scaleV * (style.baselineOffset() / 1000.0);
+							if (style.fillColor() != CommonStrings::None)
+							{
+								SetColor(style.fillColor(), style.fillShade(), &h, &s, &v, &k, gcr);
+								PS_setcmykcolor_stroke(h / 255.0, s / 255.0, v / 255.0, k / 255.0);
+							}
+							PS_setlinewidth(Uwid);
+							if (style.effects() & ScStyle_Subscript)
+							{
+								PS_moveto(hl->glyph.xoffset     , Upos);
+								PS_lineto(hl->glyph.xoffset+Ulen, Upos);
+							}
+							else
+							{
+								PS_moveto(hl->glyph.xoffset     , hl->glyph.yoffset+Upos);
+								PS_lineto(hl->glyph.xoffset+Ulen, hl->glyph.yoffset+Upos);
+							}
+							putColor(style.fillColor(), style.fillShade(), false);
+							PS_restore();
+						}
+						if (chstr != ' ')
+						{
+							if ((style.effects() & ScStyle_Shadowed) && (style.strokeColor() != CommonStrings::None))
+							{
+								PS_save();
+								PS_translate(style.fontSize() * style.shadowXOffset() / 10000.0, style.fontSize() * style.shadowYOffset() / 10000.0);
+								PS_show_xyG(style.font().replacementName(), glyph, 0, 0, style.strokeColor(), style.strokeShade());
+								PS_restore();
+							}
+							PS_show_xyG(style.font().replacementName(), glyph, 0, 0, style.fillColor(), style.fillShade());
+							if ((style.effects() & ScStyle_Outline))
+							{
+								if ((style.strokeColor() != CommonStrings::None) && ((tsz * style.outlineWidth() / 10000.0) != 0))
+								{
+									uint gl = style.font().char2CMap(chstr);
+									FPointArray gly = style.font().glyphOutline(gl);
+									QTransform chma;
+									chma.scale(tsz / 100.0, tsz / 100.0);
+									gly.map(chma);
+									PS_save();
+									PS_setlinewidth(tsz * style.outlineWidth() / 10000.0);
+									PS_translate(0,  tsz / 10.0);
+									SetColor(style.strokeColor(), style.strokeShade(), &h, &s, &v, &k, gcr);
+									PS_setcmykcolor_stroke(h / 255.0, s / 255.0, v / 255.0, k / 255.0);
+									SetClipPath(&gly);
+									PS_closepath();
+									putColor(style.strokeColor(), style.strokeShade(), false);
+									PS_restore();
+								}
+							}
+						}
+						if ((style.effects() & ScStyle_Strikethrough) && (chstr != SpecialChars::PARSEP))
+						{
+							PS_save();
+							double Ulen = hl->glyph.xadvance;
+							double Upos, Uwid, kern;
+							if (hl->effects() & ScStyle_StartOfLine)
+								kern = 0;
+							else
+								kern = style.fontSize() * style.tracking() / 10000.0;
+							if ((style.strikethruOffset() != -1) || (style.strikethruWidth() != -1))
+							{
+								if (style.strikethruOffset() != -1)
+									Upos = (style.strikethruOffset() / 1000.0) * (style.font().ascent(style.fontSize() / 10.0));
+								else
+									Upos = style.font().strikeoutPos(style.fontSize() / 10.0);
+								if (style.strikethruWidth() != -1)
+									Uwid = (style.strikethruWidth() / 1000.0) * (style.fontSize() / 10.0);
+								else
+									Uwid = qMax(style.font().strokeWidth(style.fontSize() / 10.0), 1.0);
+							}
+							else
+							{
+								Upos = style.font().strikeoutPos(style.fontSize() / 10.0);
+								Uwid = qMax(style.font().strokeWidth(style.fontSize() / 10.0), 1.0);
+							}
+							if (style.baselineOffset() != 0)
+								Upos += (style.fontSize() / 10.0) * hl->glyph.scaleV * (style.baselineOffset() / 1000.0);
+							if (style.fillColor() != CommonStrings::None)
+							if (style.fillColor() != CommonStrings::None)
+							{
+								SetColor(style.fillColor(), style.fillShade(), &h, &s, &v, &k, gcr);
+								PS_setcmykcolor_stroke(h / 255.0, s / 255.0, v / 255.0, k / 255.0);
+							}
+							PS_setlinewidth(Uwid);
+							PS_moveto(hl->glyph.xoffset     , Upos);
+							PS_lineto(hl->glyph.xoffset+Ulen, Upos);
+							putColor(style.fillColor(), style.fillShade(), false);
+							PS_restore();
+						}
+						PS_restore();
+					}
+				}
+	#endif
+				PS_restore();
+			}
 			if (!success)
 				break;
 		}
@@ -2984,6 +3452,8 @@
 			if (item->LayerID != layer.ID)
 				continue;
 			if ((!page->pageName().isEmpty()) && (item->asTextFrame()))
+				continue;
+			if ((!page->pageName().isEmpty()) && (item->asPathText()))
 				continue;
 			if ((!page->pageName().isEmpty()) && (item->asImageFrame()) && ((sep) || (!farb)))
 				continue;
@@ -3022,6 +3492,8 @@
 		if (item->LayerID != layer.ID)
 			continue;
 		if ((!page->pageName().isEmpty()) && (item->asTextFrame()))
+			continue;
+		if ((!page->pageName().isEmpty()) && (item->asPathText()))
 			continue;
 		if ((!page->pageName().isEmpty()) && (item->asImageFrame()) && ((sep) || (!farb)))
 			continue;

Modified: trunk/Scribus/scribus/scribusview.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17023&path=/trunk/Scribus/scribus/scribusview.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusview.cpp (original)
+++ trunk/Scribus/scribus/scribusview.cpp Fri Nov 25 18:14:01 2011
@@ -3433,14 +3433,14 @@
 
 			if (currItem->asPathText())
 			{
-				for (int a = 0; a < currItem->itemText.length(); ++a)
+				for (int a = 0; a < currItem->asPathText()->itemRenderText.length(); ++a)
 				{
 					pts.resize(0);
 					x = 0.0;
 					y = 0.0;
-					ScText * hl = currItem->itemText.item(a);
-					const CharStyle& charStyle(currItem->itemText.charStyle(a));
-					chstr = currItem->itemText.text(a,1);
+					ScText * hl = currItem->asPathText()->itemRenderText.item(a);
+					const CharStyle& charStyle(currItem->asPathText()->itemRenderText.charStyle(a));
+					chstr = currItem->asPathText()->itemRenderText.text(a,1);
 					if ((chstr == QChar(13)) || (chstr == QChar(29)))
 						continue;
 					if (chstr == QChar(30))
@@ -3492,8 +3492,8 @@
 					chma.scale(hl->glyph.scaleH * charStyle.fontSize() / 100.00, hl->glyph.scaleV * charStyle.fontSize() / 100.0);
 					if (currItem->reversed())
 					{
-						if (a < currItem->itemText.length()-1)
-							wide = hl->font().charWidth(chstr[0], hl->fontSize(), currItem->itemText.text(a+1));
+						if (a < currItem->asPathText()->itemRenderText.length()-1)
+							wide = hl->font().charWidth(chstr[0], hl->fontSize(), currItem->asPathText()->itemRenderText.text(a+1));
 						else
 							wide = hl->font().charWidth(chstr[0], hl->fontSize());
 						chma3.scale(-1, 1);
@@ -3602,7 +3602,7 @@
 							bb->PoLine.map(finalMat * shmap);
 							bb->setFillColor(hl->strokeColor());
 							bb->setFillShade(hl->strokeShade());
-							if (currItem->itemText.charStyle(a).effects() & ScStyle_Outline)
+							if (currItem->asPathText()->itemRenderText.charStyle(a).effects() & ScStyle_Outline)
 							{
 								bb->setLineColor(hl->strokeColor());
 								bb->setLineShade(hl->strokeShade());
@@ -3636,7 +3636,7 @@
 							bb->setRotation(currItem->rotation());
 						bb->setFillColor(hl->fillColor());
 						bb->setFillShade(hl->fillShade());
-						if (currItem->itemText.charStyle(a).effects() & ScStyle_Outline)
+						if (currItem->asPathText()->itemRenderText.charStyle(a).effects() & ScStyle_Outline)
 						{
 							bb->setLineColor(hl->strokeColor());
 							bb->setLineShade(hl->strokeShade());




More information about the scribus-commit mailing list