r18987 by avox - ScText hl begone (refactoring)

scribus-commit scribus-commit at lists.scribus.net
Thu Apr 3 15:08:24 UTC 2014


Author: avox
Date: Thu Apr  3 15:08:24 2014
New Revision: 18987

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=18987
Log:
ScText hl begone (refactoring)

Modified:
    trunk/Scribus/Scribus.pro
    trunk/Scribus/scribus/canvasmode.cpp
    trunk/Scribus/scribus/pageitem.cpp
    trunk/Scribus/scribus/pageitem.h
    trunk/Scribus/scribus/pageitem_pathtext.cpp
    trunk/Scribus/scribus/pageitem_textframe.cpp
    trunk/Scribus/scribus/pdflib_core.cpp
    trunk/Scribus/scribus/pdflib_core.h
    trunk/Scribus/scribus/plugins/scriptplugin/cmdtext.cpp
    trunk/Scribus/scribus/plugins/svgexplugin/svgexplugin.cpp
    trunk/Scribus/scribus/plugins/svgexplugin/svgexplugin.h
    trunk/Scribus/scribus/plugins/xpsexport/xpsexplugin.cpp
    trunk/Scribus/scribus/plugins/xpsexport/xpsexplugin.h
    trunk/Scribus/scribus/pslib.cpp
    trunk/Scribus/scribus/pslib.h
    trunk/Scribus/scribus/scpageoutput.cpp
    trunk/Scribus/scribus/scribusdoc.cpp
    trunk/Scribus/scribus/scribusdoc.h
    trunk/Scribus/scribus/scribusview.cpp
    trunk/Scribus/scribus/sctextstruct.h
    trunk/Scribus/scribus/text/CMakeLists.txt
    trunk/Scribus/scribus/text/storytext.cpp
    trunk/Scribus/scribus/text/storytext.h
    trunk/Scribus/scribus/ui/search.cpp
    trunk/Scribus/scribus/ui/storyeditor.cpp
    trunk/Scribus/xcode/Scribus/Scribus.xcodeproj/project.pbxproj

Modified: trunk/Scribus/Scribus.pro
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18987&path=/trunk/Scribus/Scribus.pro
==============================================================================
--- trunk/Scribus/Scribus.pro (original)
+++ trunk/Scribus/Scribus.pro Thu Apr  3 15:08:24 2014
@@ -410,7 +410,8 @@
            scribus/text/sctext_shared.h \
            scribus/text/specialchars.h \
            scribus/text/storytext.h \
-           scribus/ui/about.h \
+		   scribus/text/textlayout.h \
+		   scribus/ui/about.h \
            scribus/ui/aboutplugins.h \
            scribus/ui/AdapterWidget.h \
            scribus/ui/adjustcmsdialog.h \
@@ -1425,7 +1426,8 @@
            scribus/text/sctext_shared.cpp \
            scribus/text/specialchars.cpp \
            scribus/text/storytext.cpp \
-           scribus/ui/about.cpp \
+		   scribus/text/textlayout.cpp \
+		   scribus/ui/about.cpp \
            scribus/ui/aboutplugins.cpp \
            scribus/ui/AdapterWidget.cpp \
            scribus/ui/adjustcmsdialog.cpp \

Modified: trunk/Scribus/scribus/canvasmode.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18987&path=/trunk/Scribus/scribus/canvasmode.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode.cpp (original)
+++ trunk/Scribus/scribus/canvasmode.cpp Thu Apr  3 15:08:24 2014
@@ -1003,12 +1003,12 @@
 		if (textCursorChar == SpecialChars::PARSEP || textCursorChar == SpecialChars::LINEBREAK)
 		{
 			// The cursor must be moved to the beginning of the next line
-			FRect bbox = textframe->itemText.boundingBox ( textCursorPos );
+			FRect bbox = textframe->textLayout.boundingBox ( textCursorPos );
 			double lineSpacing(textframe->itemText.paragraphStyle(textCursorPos).lineSpacing());
 
 			// take care if cursor is not in first column
 			int curCol(1);
-			double ccPos(textframe->itemText.boundingBox ( textCursorPos ).x());
+			double ccPos(textframe->textLayout.boundingBox ( textCursorPos ).x());
 			double leftOffset(textframe->textToFrameDistLeft());
 			for(int ci(1); ci <= textframe->columns(); ++ci)
 			{
@@ -1037,7 +1037,7 @@
 			// We want to position the cursor at the beginning of the next column, if any.
 			// At first we need to know in which column the cursor is.
 			int curCol(1);
-			double ccPos(textframe->itemText.boundingBox ( textCursorPos ).x());
+			double ccPos(textframe->textLayout.boundingBox ( textCursorPos ).x());
 			double leftOffset(textframe->textToFrameDistLeft());
 			for(int ci(1); ci <= textframe->columns(); ++ci)
 			{
@@ -1053,11 +1053,11 @@
 			{
 				dx = (textframe->columnWidth() * curCol) + (textframe->columnGap() * curCol)  + leftOffset;
 				dy = textframe->textToFrameDistTop();
-				dy1 = textframe->textToFrameDistTop() + textframe->itemText.boundingBox ( textCursorPos ).height();
+				dy1 = textframe->textToFrameDistTop() + textframe->textLayout.boundingBox ( textCursorPos ).height();
 			}
 			else // there is no column after the current column
 			{
-				FRect bbox = textframe->itemText.boundingBox ( textCursorPos );
+				FRect bbox = textframe->textLayout.boundingBox ( textCursorPos );
 				dx = bbox.x();
 				dy = bbox.y();
                 dx += textframe->itemText.getGlyphs(textCursorPos)->wide();
@@ -1069,7 +1069,7 @@
 		}
 		else
 		{
-			FRect bbox = textframe->itemText.boundingBox ( textCursorPos );
+			FRect bbox = textframe->textLayout.boundingBox ( textCursorPos );
 			dx = bbox.x();
 			dy = bbox.y();
             dx += textframe->itemText.getGlyphs(textCursorPos)->wide();
@@ -1083,7 +1083,7 @@
 	}
 	else
 	{
-		FRect bbox = textframe->itemText.boundingBox ( textCursorPos );
+		FRect bbox = textframe->textLayout.boundingBox ( textCursorPos );
 		dx = bbox.x();
 		dy = bbox.y();
 		if ( bbox.height() <= 2 )

Modified: trunk/Scribus/scribus/pageitem.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18987&path=/trunk/Scribus/scribus/pageitem.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem.cpp (original)
+++ trunk/Scribus/scribus/pageitem.cpp Thu Apr  3 15:08:24 2014
@@ -176,6 +176,7 @@
 	CurX(other.CurX),
 	CurY(other.CurY),
 	itemText(other.itemText),
+	textLayout(&itemText, this),
 	isBookmark(other.isBookmark),
 	HasSel(other.HasSel),
 	isAutoText(other.isAutoText),
@@ -393,6 +394,7 @@
 	OverrideCompressionQuality(false),
 	CompressionQualityIndex(0),
 	itemText(pa),
+	textLayout(&itemText, this),
 	undoManager(UndoManager::instance()),
 	lineShadeVal(100),
 	fillShadeVal(100),
@@ -2410,12 +2412,12 @@
     sets xadvance to the advance width without kerning. If more than one glyph
     is generated, kerning is included in all but the last xadvance.
 */
-double PageItem::layoutGlyphs(const CharStyle& style, const QString& chars, GlyphLayout& layout)
+double PageItem::layoutGlyphs(const CharStyle& style, const QString& chars, LayoutFlags flags, GlyphLayout& layout)
 {
 	double retval = 0.0;
 	const ScFace font = style.font();
 	double asce = font.ascent(style.fontSize() / 10.0);
-	int chst = style.effects() & 1919;
+	int chst = style.effects() & ScStyle_UserStyles;
 /*	if (chars[0] == SpecialChars::ZWSPACE ||
 		chars[0] == SpecialChars::ZWNBSPACE ||
 		chars[0] == SpecialChars::NBSPACE ||
@@ -2434,7 +2436,7 @@
 		layout.glyph = font.char2CMap(chars[0].unicode());
 	}
 	double tracking = 0.0;
-	if ( (style.effects() & ScLayout_StartOfLine) == 0)
+	if ( (flags & ScLayout_StartOfLine) == 0)
 		tracking = style.fontSize() * style.tracking() / 10000.0;
 
 	layout.xoffset = tracking;
@@ -2503,7 +2505,7 @@
 
 	if (chars.length() > 1) {
 		layout.grow();
-		layoutGlyphs(style, chars.mid(1), *layout.more);
+		layoutGlyphs(style, chars.mid(1), ScLayout_None, *layout.more);
 		layout.xadvance += font.glyphKerning(layout.glyph, layout.more->glyph, style.fontSize() / 10) * layout.scaleH;
 		if (layout.more->yadvance > layout.yadvance)
 			layout.yadvance = layout.more->yadvance;
@@ -2514,7 +2516,7 @@
 	return retval;
 }
 
-void PageItem::drawGlyphs(ScPainter *p, const CharStyle& style, GlyphLayout& glyphs)
+void PageItem::drawGlyphs(ScPainter *p, const CharStyle& style, LayoutFlags flags, GlyphLayout& glyphs)
 {
 	uint glyph = glyphs.glyph;
 	const ScFace font = style.font();
@@ -2590,7 +2592,7 @@
 		points.map(chma * chma4);
 		p->setupPolygon(&points, true);
 		QColor oldBrush = p->brush();
-		p->setBrush( (style.effects() & ScLayout_SuppressSpace) ? Qt::green
+		p->setBrush( (flags & ScLayout_SuppressSpace) ? Qt::green
 					: PrefsManager::instance()->appPrefs.displayPrefs.controlCharColor);
 		if (stroke)
 		{
@@ -2609,7 +2611,7 @@
 		if (glyphs.more)
 		{
 			p->translate(glyphs.xadvance, 0);
-			drawGlyphs(p, style, *glyphs.more);
+			drawGlyphs(p, style, ScLayout_None, *glyphs.more);
 		}			
 		return;
 	}
@@ -2625,7 +2627,7 @@
 		if (glyphs.more)
 		{
 			p->translate(glyphs.xadvance, 0);
-			drawGlyphs(p, style, *glyphs.more);
+			drawGlyphs(p, style, ScLayout_None, *glyphs.more);
 		}			
 		return;
 	}
@@ -2707,7 +2709,7 @@
 				if (glyphs.more)
 				{
 					p->translate(glyphs.xadvance, 0);
-					drawGlyphs(p, style, *glyphs.more);
+					drawGlyphs(p, style, ScLayout_None, *glyphs.more);
 				}
 				return;
 			}
@@ -2790,7 +2792,7 @@
 	if (glyphs.more)
 	{
 		p->translate(glyphs.xadvance, 0);
-		drawGlyphs(p, style, *glyphs.more);
+		drawGlyphs(p, style, ScLayout_None, *glyphs.more);
 	}
 }
 

Modified: trunk/Scribus/scribus/pageitem.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18987&path=/trunk/Scribus/scribus/pageitem.h
==============================================================================
--- trunk/Scribus/scribus/pageitem.h (original)
+++ trunk/Scribus/scribus/pageitem.h Thu Apr  3 15:08:24 2014
@@ -46,6 +46,7 @@
 #include "margins.h"
 #include "sctextstruct.h"
 #include "text/storytext.h"
+#include "text/textlayout.h"
 #include "undoobject.h"
 #include "vgradient.h"
 #include "mesh.h"
@@ -392,9 +393,9 @@
 	/// Return current text properties (current char + paragraph properties)
 	void currentTextProps(ParagraphStyle& parStyle) const;
 	// deprecated:
-	double layoutGlyphs(const CharStyle& style, const QString& chars, GlyphLayout& layout);
+	double layoutGlyphs(const CharStyle& style, const QString& chars, LayoutFlags flags, GlyphLayout& layout);
 	void SetQColor(QColor *tmp, QString farbe, double shad);
-	void drawGlyphs(ScPainter *p, const CharStyle& style, GlyphLayout& glyphs );
+	void drawGlyphs(ScPainter *p, const CharStyle& style, LayoutFlags flags, GlyphLayout& glyphs );
 	void DrawPolyL(QPainter *p, QPolygon pts);
 	QString ExpandToken(uint base);
 	const FPointArray shape() const { return PoLine; }
@@ -1269,7 +1270,8 @@
 	double BBoxH; ///< Bounding Box-H
 	double CurX; ///< Zeichen X-Position
 	double CurY; ///< Zeichen Y-Position
-	StoryText itemText; ///< Text des Elements
+	StoryText itemText; ///< Text of element
+	TextLayout textLayout;
 	bool isBookmark; ///< Flag for PDF Bookmark
 	bool Dirty; ///< Flag for redraw in EditMode
 	bool invalid; ///< Flag indicates that layout has changed (eg. for textlayout)

Modified: trunk/Scribus/scribus/pageitem_pathtext.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18987&path=/trunk/Scribus/scribus/pageitem_pathtext.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem_pathtext.cpp (original)
+++ trunk/Scribus/scribus/pageitem_pathtext.cpp Thu Apr  3 15:08:24 2014
@@ -196,6 +196,7 @@
 		}
 		chstr.clear();
 	}
+	textLayout.setStory(&itemRenderText);
 	int spaceCount = 0;
 	double wordExtra = 0;
 	for (a = firstChar; a < itemRenderText.length(); ++a)
@@ -210,7 +211,7 @@
 		if (a < itemRenderText.length()-1)
 			chstr += itemRenderText.text(a+1, 1);
         glyphs->yadvance = 0;
-        layoutGlyphs(itemRenderText.charStyle(a), chstr, *glyphs);
+        layoutGlyphs(itemRenderText.charStyle(a), chstr, itemRenderText.flags(a), *glyphs);
         glyphs->shrink();
         if (itemRenderText.hasObject(a))
             totalTextLen += (itemRenderText.object(a)->width() + itemRenderText.object(a)->lineWidth()) * glyphs->scaleH;
@@ -253,20 +254,21 @@
 	for (a = firstChar; a < itemRenderText.length(); ++a)
 	{
 		CurY = 0;
-        ScText* hl = itemRenderText.item_p(a);
+		GlyphLayout* glyphs = itemRenderText.getGlyphs(a);
+		PathData* pdata = & (textLayout.point(a));
         chstr = itemRenderText.text(a,1);
 		if (chstr[0] == SpecialChars::PAGENUMBER || chstr[0] == SpecialChars::PARSEP || chstr[0] == SpecialChars::PAGECOUNT
 			|| chstr[0] == SpecialChars::TAB || chstr[0] == SpecialChars::LINEBREAK)
 			continue;
 		if (a < itemRenderText.length()-1)
 			chstr += itemRenderText.text(a+1, 1);
-		hl->glyph.yadvance = 0;
-		layoutGlyphs(itemRenderText.charStyle(a), chstr, hl->glyph);
-		hl->glyph.shrink();                                                           // HACK
+		glyphs->yadvance = 0;
+		layoutGlyphs(itemRenderText.charStyle(a), chstr, itemRenderText.flags(a), *glyphs);
+		glyphs->shrink();                                                           // HACK
         if (itemRenderText.hasObject(a))
-            dx = (itemRenderText.object(a)->width() + itemRenderText.object(a)->lineWidth()) * hl->glyph.scaleH / 2.0;
+			dx = (itemRenderText.object(a)->width() + itemRenderText.object(a)->lineWidth()) * glyphs->scaleH / 2.0;
 		else
-			dx = hl->glyph.wide() / 2.0;
+			dx = glyphs->wide() / 2.0;
 		CurX += dx;
 
 		double currPerc = currPath.percentAtLength(CurX);
@@ -290,11 +292,11 @@
 		QPointF currPoint = currPath.pointAtPercent(currPerc);
 		tangent = FPoint(cos(currAngle * M_PI / 180.0), sin(currAngle * M_PI / 180.0));
 		point = FPoint(currPoint.x(), currPoint.y());
-		hl->glyph.xoffset = 0;
-		hl->PtransX = point.x();
-		hl->PtransY = point.y();
-		hl->PRot    = currAngle * M_PI / 180.0;
-		hl->PDx     = dx;
+		glyphs->xoffset = 0;
+		pdata->PtransX = point.x();
+		pdata->PtransY = point.y();
+		pdata->PRot    = currAngle * M_PI / 180.0;
+		pdata->PDx     = dx;
 		QTransform trafo = QTransform( 1, 0, 0, -1, -dx, 0 );
 		if (textPathFlipped)
 			trafo *= QTransform(1, 0, 0, -1, 0, 0);
@@ -356,18 +358,18 @@
             if (itemRenderText.hasObject(a))
                 DrawObj_Embedded(p, cullingArea, itemRenderText.charStyle(a), itemRenderText.object(a));
 			else
-				drawGlyphs(p, itemRenderText.charStyle(a), hl->glyph);
+				drawGlyphs(p, itemRenderText.charStyle(a), itemRenderText.flags(a), *glyphs);
 		}
 		p->setWorldMatrix(savWM);
 		p->restore();
 		MaxChars = a+1;
 		CurX -= dx;
         if (itemRenderText.hasObject(a))
-            CurX += (itemRenderText.object(a)->width() + itemRenderText.object(a)->lineWidth()) * hl->glyph.scaleH + extraOffset;
+			CurX += (itemRenderText.object(a)->width() + itemRenderText.object(a)->lineWidth()) * glyphs->scaleH + extraOffset;
         else if (chstr[0] == SpecialChars::BLANK)
-            CurX += hl->glyph.wide()+itemRenderText.charStyle(a).fontSize() * itemRenderText.charStyle(a).tracking() / 10000.0 + wordExtra + extraOffset;
+			CurX += glyphs->wide()+itemRenderText.charStyle(a).fontSize() * itemRenderText.charStyle(a).tracking() / 10000.0 + wordExtra + extraOffset;
 		else
-            CurX += hl->glyph.wide()+itemRenderText.charStyle(a).fontSize() *itemRenderText.charStyle(a).tracking() / 10000.0 + extraOffset;
+			CurX += glyphs->wide()+itemRenderText.charStyle(a).fontSize() *itemRenderText.charStyle(a).tracking() / 10000.0 + extraOffset;
 	}
 }
 
@@ -405,7 +407,7 @@
 	
 	linesCT->setText(tr("Lines: "));
 	infoGroupLayout->addWidget( linesCT, 2, 0, Qt::AlignRight );
-	linesT->setText(QString::number(itemText.lines()));
+	linesT->setText(QString::number(textLayout.lines()));
 	infoGroupLayout->addWidget( linesT, 2, 1 );
 	
 	

Modified: trunk/Scribus/scribus/pageitem_textframe.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18987&path=/trunk/Scribus/scribus/pageitem_textframe.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem_textframe.cpp (original)
+++ trunk/Scribus/scribus/pageitem_textframe.cpp Thu Apr  3 15:08:24 2014
@@ -842,7 +842,7 @@
 				asce = (itemText.object(line.firstItem+zc)->height() + itemText.object(line.firstItem+zc)->lineWidth()) * scaleV + offset;
 				desc = 0.0;
 			}
-			else //if ((itemText.charStyle(current.line.firstItem+zc).effects() & ScLayout_DropCap) == 0)
+			else //if ((itemText.flags(current.line.firstItem+zc) & ScLayout_DropCap) == 0)
 			{
 				asce = cStyle.font().realCharAscent(ch, cStyle.fontSize() / 10.0) * scaleV + offset;
 				desc = cStyle.font().realCharDescent(ch, cStyle.fontSize() / 10.0) * scaleV - offset;
@@ -1089,7 +1089,7 @@
 //static double opticalLeftMargin(const StoryText& itemText, const LineSpec& line)
 //{
 //	int b = line.firstItem;
-//	while (b < line.lastItem && (itemText.item(b)->effects() & ScLayout_SuppressSpace))
+//	while (b < line.lastItem && (itemText.flags(b)) & ScLayout_SuppressSpace))
 //		   ++b;
 //
 //	double chs = itemText.charStyle(b).fontSize() * (itemText.charStyle(b).scaleH() / 1000.0);
@@ -1224,12 +1224,12 @@
 	PageItem_TextFrame* prev = dynamic_cast<PageItem_TextFrame*>(BackBox);
 	if (!prev) return false;
 	if (!prev->incompleteLines) return false;   // no incomplete lines - nothing to do
-	int pos = itemText.lastInFrame();
+	int pos = textLayout.endOfFrame()-1;
 	QChar lastChar = itemText.text (pos);
 	// qDebug()<<"pos is"<<pos<<", length is"<<itemText.length()<<", incomplete is "<<prev->incompleteLines;
 	if ((pos != itemText.length()-1) && (!SpecialChars::isBreak (lastChar, true)))
 		return false;  // the paragraph isn't ending yet
-	int lines = itemText.lines();  // lines added to the current frame
+	int lines = textLayout.lines();  // lines added to the current frame
 
 	ParagraphStyle style = itemText.paragraphStyle (pos);
 	int need = style.keepLinesEnd () + 1;
@@ -1248,7 +1248,7 @@
 	// Okay, move the starting/ending character
 	int startingPos = prev->incompletePositions[prev->incompleteLines - pull];
 	for (int i = 0; i < pull; ++i)
-		prev->itemText.removeLastLine();
+		prev->textLayout.removeLastLine();
 	firstChar = prev->MaxChars = startingPos;
 	// keep the remaining incomplete lines flagged as such
 	// this ensures that if pulling one line won't be enough, the subsequent call to layout() will pull more
@@ -1261,7 +1261,7 @@
 void PageItem_TextFrame::adjustParagraphEndings ()
 {
 	// More text to go - let's apply paragraph flowing options - orphans/widows, etc
-	int pos = itemText.lastInFrame();
+	int pos = textLayout.endOfFrame() - 1;
 	if (pos >= itemText.length() - 1) return;
 
 	ParagraphStyle style = itemText.paragraphStyle (pos);
@@ -1271,11 +1271,11 @@
 	if (keepWithNext || (!SpecialChars::isBreak (lastChar, true))) {
 		// paragraph continues in the next frame, or needs to be kept with the next one
 		// check how many lines are in this frame
-		int lineStart = itemText.startOfLine (pos);
+		int lineStart = textLayout.startOfLine (pos);
 		incompleteLines = 1;
 		incompletePositions.prepend (lineStart);
 		while (lineStart > paragraphStart) {
-			lineStart = itemText.startOfLine (lineStart - 1);
+			lineStart = textLayout.startOfLine (lineStart - 1);
 			incompleteLines++;
 			incompletePositions.prepend (lineStart);
 		}
@@ -1290,8 +1290,8 @@
 		if (pull) {
 			// push this paragraph to the next frame
 			for (int i = 0; i < pull; ++i)
-				itemText.removeLastLine();
-			MaxChars = itemText.lastInFrame() + 1;
+				textLayout.removeLastLine();
+			MaxChars = textLayout.endOfFrame();
 			incompleteLines = 0;
 			incompletePositions.clear();
 		}
@@ -1359,7 +1359,7 @@
 	int    DropLines = 0;
 	int    DropLinesCount = 0;
 
-	itemText.clearLines();
+	textLayout.clear();
 	incompleteLines = 0;
 	incompletePositions.clear();
 
@@ -1787,7 +1787,7 @@
 				itemText.clearFlag(a, ScLayout_StartOfLine);
 			}
 			glyphs->yadvance = 0;
-			layoutGlyphs(charStyle, chstr, *glyphs);
+			layoutGlyphs(charStyle, chstr, itemText.flags(a), *glyphs);
 
 			// find out width, ascent and descent of char
 			if (HasObject)
@@ -2829,7 +2829,7 @@
 						}
 						fillInTabLeaders(itemText, current.line);
 						//if right margin is set we temporally save line, not append it
-						itemText.appendLine(current.line);
+						textLayout.appendLine(current.line);
 						setMaxY(maxYDesc);
 						current.restartIndex = current.line.lastItem +1;
 						a = current.restartIndex -1;
@@ -3031,7 +3031,7 @@
 			current.startOfCol = false;
 			goNextColumn = false;
 
-			itemText.appendLine(current.line);
+			textLayout.appendLine(current.line);
 			setMaxY(maxYDesc);
 			current.startOfCol = false;
 
@@ -3667,9 +3667,9 @@
 		assert( firstInFrame() >= 0 );
 		assert( lastInFrame() < itemText.length() );
 		LineSpec ls;
-		for (uint ll=0; ll < itemText.lines(); ++ll)
-		{
-			ls = itemText.line(ll);
+		for (uint ll=0; ll < textLayout.lines(); ++ll)
+		{
+			ls = textLayout.line(ll);
 			double CurX = ls.x;
 
 			// Draw text selection rectangles
@@ -3821,10 +3821,10 @@
 							if (m_Doc->guidesPrefs().showControls && itemText.hasMark(a) && (glyphs->glyph != SpecialChars::OBJECT))
 							{
 								GlyphLayout markGlyph;
-								layoutGlyphs(charStyle,SpecialChars::OBJECT, markGlyph);
-								drawGlyphs(p, charStyle, markGlyph);
+								layoutGlyphs(charStyle, SpecialChars::OBJECT, ScLayout_None, markGlyph);
+								drawGlyphs(p, charStyle, ScLayout_None, markGlyph);
 							}
-							drawGlyphs(p, charStyle, *glyphs);
+							drawGlyphs(p, charStyle, itemText.flags(a), *glyphs);
 						}
 						p->restore();//RE4
 					}
@@ -4241,12 +4241,12 @@
 			pos = len-1;
 		if ( (buttonModifiers & Qt::ControlModifier) == 0 )
 		{
-			pos = itemText.startOfLine(pos);
+			pos = textLayout.startOfLine(pos);
 		}
 		else
 		{
 			//Control Home for start of frame text
-			pos = itemText.startOfFrame(pos);
+			pos = textLayout.startOfFrame();
 		}
 		itemText.setCursorPosition(pos);
 		if ( buttonModifiers & Qt::ShiftModifier )
@@ -4262,12 +4262,12 @@
 			break; // at end of frame
 		if ( (buttonModifiers & Qt::ControlModifier) == 0 )
 		{
-			itemText.setCursorPosition( itemText.endOfLine(itemText.cursorPosition()) );
+			itemText.setCursorPosition( textLayout.endOfLine(itemText.cursorPosition()) );
 		}
 		else
 		{
 			//Control End for end of frame text
-			itemText.setCursorPosition( itemText.endOfFrame(itemText.cursorPosition()) );
+			itemText.setCursorPosition( textLayout.endOfFrame() );
 		}
 		if ( buttonModifiers & Qt::ShiftModifier )
 			ExpandSel(1, oldPos);
@@ -4288,7 +4288,7 @@
 		{
 			if (itemText.cursorPosition() <= lastInFrame())
 			{
-				itemText.setCursorPosition( itemText.nextLine(itemText.cursorPosition()) );
+				itemText.setCursorPosition( textLayout.nextLine(itemText.cursorPosition()) );
 				if ( buttonModifiers & Qt::ShiftModifier )
 				{
 					if ( buttonModifiers & Qt::AltModifier )
@@ -4296,7 +4296,7 @@
 					ExpandSel(1, oldPos);
 				}
 				else
-					if ((itemText.lines() > 0) && (oldPos >= itemText.line(itemText.lines()-1).firstItem) && (itemText.cursorPosition() >= lastInFrame()) && (NextBox != 0))
+					if ((textLayout.lines() > 0) && (oldPos >= textLayout.line(textLayout.lines()-1).firstItem) && (itemText.cursorPosition() >= lastInFrame()) && (NextBox != 0))
 					{
 						if (NextBox->frameDisplays(itemText.cursorPosition()))
 						{
@@ -4339,7 +4339,7 @@
 			{
 				if (itemText.cursorPosition() > lastInFrame() || itemText.cursorPosition() >= itemText.length())
 					itemText.setCursorPosition(lastInFrame());
-				itemText.setCursorPosition( itemText.prevLine(itemText.cursorPosition()) );
+				itemText.setCursorPosition( textLayout.prevLine(itemText.cursorPosition()) );
 				if ( buttonModifiers & Qt::ShiftModifier )
 				{
 					if ( buttonModifiers & Qt::AltModifier )
@@ -4347,7 +4347,7 @@
 					ExpandSel(-1, oldPos);
 				}
 				else
-					if ((itemText.lines() > 0) && (oldPos <= itemText.line(0).lastItem) && (itemText.cursorPosition()  == firstInFrame()) && (BackBox != 0))
+					if ((textLayout.lines() > 0) && (oldPos <= textLayout.line(0).lastItem) && (itemText.cursorPosition()  == firstInFrame()) && (BackBox != 0))
 					{
 						view->Deselect(true);
 						// TODO position at the right place in previous frame
@@ -4379,7 +4379,7 @@
 			//currItem = currItem->BackBox;
 		}
 		else
-			itemText.setCursorPosition( itemText.startOfFrame(itemText.cursorPosition()) );
+			itemText.setCursorPosition( textLayout.startOfFrame() );
 		if ( buttonModifiers & Qt::ShiftModifier )
 			ExpandSel(-1, oldPos);
 		m_Doc->scMW()->setTBvals(this);
@@ -4393,7 +4393,7 @@
 			//currItem = currItem->BackBox;
 		}
 		else
-			itemText.setCursorPosition( itemText.endOfFrame(itemText.cursorPosition()) );
+			itemText.setCursorPosition( textLayout.endOfFrame() );
 		if ( buttonModifiers & Qt::ShiftModifier )
 			ExpandSel(1, oldPos);
 		m_Doc->scMW()->setTBvals(this);
@@ -4430,10 +4430,10 @@
 		if ((itemText.cursorPosition() > 0) && (itemText.cursorPosition() >= lastInFrame())) // I do not see how its possible, may be dead code - pm
 		{
 			itemText.setCursorPosition( lastInFrame() );
-//			if (itemText.charStyle(CPos-1).effects() & ScLayout_SuppressSpace)
+//			if (itemText.flags(CPos-1) & ScLayout_SuppressSpace)
 //			{
 //				--CPos;
-				while ((itemText.cursorPosition() > 1) && (itemText.charStyle().effects() & ScLayout_SuppressSpace) && (itemText.charStyle(itemText.cursorPosition() - 1).effects() & ScLayout_SuppressSpace))
+				while ((itemText.cursorPosition() > 1) && (itemText.flags(itemText.cursorPosition() - 1) & ScLayout_SuppressSpace))
 				{
 					itemText.setCursorPosition(-1, true);
 					if (itemText.cursorPosition() == 0)
@@ -4443,7 +4443,7 @@
 		}
 		else
 		{
-			while ((itemText.cursorPosition() > 1) && (itemText.charStyle().effects() & ScLayout_SuppressSpace) && (itemText.charStyle(itemText.cursorPosition() - 1).effects() & ScLayout_SuppressSpace))
+			while ((itemText.cursorPosition() > 1) && (itemText.flags(itemText.cursorPosition() - 1) & ScLayout_SuppressSpace))
 			{
 				itemText.setCursorPosition(-1, true);
 				if (itemText.cursorPosition() == 0)
@@ -5192,7 +5192,7 @@
 
 	linesCT->setText(tr("Lines: "));
 	infoGroupLayout->addWidget( linesCT, 2, 0, Qt::AlignRight );
-	linesT->setText(QString::number(itemText.lines()));
+	linesT->setText(QString::number(textLayout.lines()));
 	infoGroupLayout->addWidget( linesT, 2, 1 );
 
 
@@ -5266,7 +5266,7 @@
 		actionList << "itemConvertToPolygon";
 	}
 	actionList << "itemConvertToOutlines";
-	if (itemText.lines() != 0)
+	if (textLayout.lines() != 0)
 	{
 		actionList << "editClearContents";
 		actionList << "itemAdjustFrameHeightToText";

Modified: trunk/Scribus/scribus/pdflib_core.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18987&path=/trunk/Scribus/scribus/pdflib_core.cpp
==============================================================================
--- trunk/Scribus/scribus/pdflib_core.cpp (original)
+++ trunk/Scribus/scribus/pdflib_core.cpp Thu Apr  3 15:08:24 2014
@@ -5098,107 +5098,112 @@
 	// Loop over each character (!) in the pageItem...
 	if (ite->itemType() == PageItem::TextFrame)
 	{
+		PathData straightPath;
+		straightPath.PtransX = 0;
+		straightPath.PtransY = 0;
+		straightPath.PRot = 0;
+		straightPath.PDx = 0;
 		tmp += "BT\n";
-		for (uint ll=0; ll < ite->itemText.lines(); ++ll)
-		{
-			LineSpec ls = ite->itemText.line(ll);
+		for (uint ll=0; ll < ite->textLayout.lines(); ++ll)
+		{
+			LineSpec ls = ite->textLayout.line(ll);
 			tabDist = ls.x;
 			double CurX = ls.x;
 			for (int d = ls.firstItem; d <= ls.lastItem; ++d)
 			{
-				ScText *hl = ite->itemText.item_p(d);
-				const QChar ch = hl->ch;
+				GlyphLayout* glyphs = ite->itemText.getGlyphs(d);
+				PathData* pdata = &straightPath;
+				const QChar ch = ite->itemText.text(d);
 				const CharStyle& chstyle(ite->itemText.charStyle(d));
 				const ParagraphStyle& pstyle(ite->itemText.paragraphStyle(d));
 				if (SpecialChars::isBreak(ch, true) || (ch == QChar(10)))
 					continue;
-				if (chstyle.effects() & ScLayout_SuppressSpace)
+				if (ite->itemText.hasFlag(d, ScLayout_SuppressSpace))
 					continue;
 				tTabValues = pstyle.tabValues();
-				if (chstyle.effects() & ScLayout_StartOfLine)
+				if (ite->itemText.hasFlag(d, ScLayout_StartOfLine))
 					tabCc = 0;
 				if ((ch == SpecialChars::TAB) && (tTabValues.count() != 0))
 				{
 					QChar tabFillChar;
-					const TabLayout* tabLayout = dynamic_cast<const TabLayout*>(hl->glyph.more);
+					const TabLayout* tabLayout = dynamic_cast<const TabLayout*>(glyphs->more);
 					if (tabLayout)
 						tabFillChar = tabLayout->fillChar;
 					if (!tabFillChar.isNull())
 					{
-						ScText hl2;
-						static_cast<CharStyle&>(hl2) = static_cast<const CharStyle&>(*hl);
-						const GlyphLayout * const gl = hl->glyph.more;
+						GlyphLayout gl2;
+						CharStyle cl2(chstyle);
+						const GlyphLayout * const gl = glyphs->more;
 						double scale = gl ? gl->scaleV : 1.0;
 						double wt    = chstyle.font().charWidth(tabFillChar, chstyle.fontSize() * scale / 10.0);
-						double len   = hl->glyph.xadvance;
+						double len   = glyphs->xadvance;
 						int coun     = static_cast<int>(len / wt);
 						// #6728 : update code according to fillInTabLeaders() and PageItem::layout() - JG
 						double sPos  = 0.0 /*CurX - len + chstyle.fontSize() / 10.0 * 0.7 + 1*/;
-						hl2.ch = tTabValues[tabCc].tabFillChar;
-						hl2.setTracking(0);
-						hl2.setScaleH(1000);
-						hl2.setScaleV(1000);
-						hl2.glyph.glyph   = chstyle.font().char2CMap(tabFillChar);
-						hl2.glyph.yoffset = hl->glyph.yoffset;
+						//hl2.ch = tTabValues[tabCc].tabFillChar;
+						cl2.setTracking(0);
+						cl2.setScaleH(1000);
+						cl2.setScaleV(1000);
+						gl2.glyph   = chstyle.font().char2CMap(tabFillChar);
+						gl2.yoffset = glyphs->yoffset;
 						for (int cx = 0; cx < coun; ++cx)
 						{
-							hl2.glyph.xoffset =  sPos + wt * cx;
+							gl2.xoffset =  sPos + wt * cx;
 							if ((chstyle.effects() & ScStyle_Shadowed) && (chstyle.strokeColor() != CommonStrings::None))
 							{
-								ScText hl3;
-								static_cast<CharStyle&>(hl3) = static_cast<const CharStyle&>(hl2);
+								GlyphLayout gl3;
+								CharStyle cl3(cl2);
 								//<< HACK to fix Bug #8446
-								hl3.setEffects(hl3.effects() & (~(ScStyle_Outline)));
+								cl3.setEffects(cl3.effects() & (~(ScStyle_Outline)));
 								//>>
-								hl3.ch = hl2.ch;
-								hl3.glyph.glyph = hl2.glyph.glyph;
-								hl3.setFillColor(hl2.strokeColor());
-								hl3.setFillShade(hl2.strokeShade());
-								hl3.glyph.yoffset = hl2.glyph.yoffset - (chstyle.fontSize() * chstyle.shadowYOffset() / 10000.0);
-								hl3.glyph.xoffset = hl2.glyph.xoffset + (chstyle.fontSize() * chstyle.shadowXOffset() / 10000.0);
-								setTextCh(ite, PNr, CurX, ls.y, d, tmp, tmp2, &hl3, pstyle, pag);
+								gl3.glyph = gl2.glyph;
+								cl3.setFillColor(cl2.strokeColor());
+								cl3.setFillShade(cl2.strokeShade());
+								gl3.yoffset = gl2.yoffset - (chstyle.fontSize() * chstyle.shadowYOffset() / 10000.0);
+								gl3.xoffset = gl2.xoffset + (chstyle.fontSize() * chstyle.shadowXOffset() / 10000.0);
+								setTextCh(ite, PNr, CurX, ls.y, d, tmp, tmp2, cl3, &gl3, pdata, pstyle, pag);
 							}
-							setTextCh(ite, PNr, CurX, ls.y, d, tmp, tmp2, &hl2, pstyle, pag);
+							setTextCh(ite, PNr, CurX, ls.y, d, tmp, tmp2, cl2, &gl2, pdata, pstyle, pag);
 						}
 					}
 					tabCc++;
 				}
 				if (ch == SpecialChars::TAB)
 				{
-					CurX += hl->glyph.wide();
+					CurX += glyphs->wide();
 					continue;
 				}
 				if ((chstyle.effects() & ScStyle_Shadowed) && (chstyle.strokeColor() != CommonStrings::None))
 				{
-					ScText hl2;
-					hl2.ch = ch;
-					hl2.glyph.glyph = hl->glyph.glyph;
-					const GlyphLayout *gl1 = &hl->glyph;
-					GlyphLayout	*gl2 = &hl2.glyph;
+					GlyphLayout gl2(*glyphs);
+					gl2.glyph = glyphs->glyph;
+					const GlyphLayout *gl1 = glyphs;
+					GlyphLayout* glx = &gl2;
 					while (gl1->more)
 					{
-						gl2->more = new GlyphLayout(*gl1->more);
-						gl2->more->yoffset -= (chstyle.fontSize() * chstyle.shadowYOffset() / 10000.0);
-						gl2->more->xoffset += (chstyle.fontSize() * chstyle.shadowXOffset() / 10000.0);
-						gl2->more->more = NULL;
+						glx->more = new GlyphLayout(*gl1->more);
+						glx->more->yoffset -= (chstyle.fontSize() * chstyle.shadowYOffset() / 10000.0);
+						glx->more->xoffset += (chstyle.fontSize() * chstyle.shadowXOffset() / 10000.0);
+						glx->more->more = NULL;
 						gl1 = gl1->more;
-						gl2 = gl2->more;
+						glx = glx->more;
 					}
-					static_cast<CharStyle&>(hl2) = static_cast<const CharStyle&>(*hl);
+					CharStyle cl2(chstyle);
 					//<< HACK to fix Bug #8446
-					hl2.setEffects(hl2.effects() & (~(ScStyle_Outline)));
+					cl2.setEffects(cl2.effects() & (~(ScStyle_Outline)));
 					//>>
-					hl2.setFillColor(hl->strokeColor());
-					hl2.setFillShade(hl->strokeShade());
-					hl2.glyph.xadvance = hl->glyph.xadvance;
-					hl2.glyph.yadvance = hl->glyph.yadvance;
-					hl2.glyph.yoffset = hl->glyph.yoffset - (chstyle.fontSize() * chstyle.shadowYOffset() / 10000.0);
-					hl2.glyph.xoffset = hl->glyph.xoffset + (chstyle.fontSize() * chstyle.shadowXOffset() / 10000.0);
-					hl2.glyph.scaleH = hl->glyph.scaleH;
-					hl2.glyph.scaleV = hl->glyph.scaleV;
-					setTextCh(ite, PNr, CurX, ls.y, d, tmp, tmp2, &hl2, pstyle, pag);
-				}
-				setTextCh(ite, PNr, CurX, ls.y, d, tmp, tmp2, hl, pstyle, pag);
+					cl2.setFillColor(chstyle.strokeColor());
+					cl2.setFillShade(chstyle.strokeShade());
+					gl2.xadvance = glyphs->xadvance;
+					gl2.yadvance = glyphs->yadvance;
+					gl2.yoffset = glyphs->yoffset - (chstyle.fontSize() * chstyle.shadowYOffset() / 10000.0);
+					gl2.xoffset = glyphs->xoffset + (chstyle.fontSize() * chstyle.shadowXOffset() / 10000.0);
+					gl2.scaleH = glyphs->scaleH;
+					gl2.scaleV = glyphs->scaleV;
+					setTextCh(ite, PNr, CurX, ls.y, d, tmp, tmp2, cl2, &gl2, pdata, pstyle, pag);
+					gl2.shrink();
+				}
+				setTextCh(ite, PNr, CurX, ls.y, d, tmp, tmp2, chstyle, glyphs, pdata, pstyle, pag);
 				// Unneeded now that glyph xadvance is set appropriately for inline objects by PageItem_TextFrame::layout() - JG
 				/*if (hl->ch == SpecialChars::OBJECT)
 				{
@@ -5206,7 +5211,7 @@
 					CurX += (embedded.getItem()->gWidth + embedded.getItem()->lineWidth()) * hl->glyph.scaleH;
 				}
 				else*/
-				CurX += hl->glyph.wide();
+				CurX += glyphs->wide();
 				tabDist = CurX;
 			}
 		}
@@ -5219,51 +5224,51 @@
 		double CurX = 0;
 		for (int d = 0; d < ite->maxCharsInFrame(); ++d)
 		{
-			ScText *hl = ite->asPathText()->itemRenderText.item_p(d);
-			const QChar ch = hl->ch;
+			GlyphLayout* glyphs = ite->asPathText()->itemRenderText.getGlyphs(d);
+			PathData* pdata = &ite->textLayout.point(d);
+			const QChar ch = ite->asPathText()->itemRenderText.text(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() & ScLayout_SuppressSpace)
+			if (ite->asPathText()->itemRenderText.hasFlag(d,  ScLayout_SuppressSpace))
 				continue;
 			tTabValues = pstyle.tabValues();
-			if (chstyle.effects() & ScLayout_StartOfLine)
+			if (ite->asPathText()->itemRenderText.hasFlag(d,  ScLayout_StartOfLine))
 				tabCc = 0;
 			if ((ch == SpecialChars::TAB) && (tTabValues.count() != 0))
 			{
 				if ((tabCc < tTabValues.count()) && (!tTabValues[tabCc].tabFillChar.isNull()))
 				{
-					ScText hl2;
-					static_cast<CharStyle&>(hl2) = static_cast<const CharStyle&>(*hl);
+					GlyphLayout gl2;
+					CharStyle cl2(chstyle);
 					double wt = chstyle.font().charWidth(tTabValues[tabCc].tabFillChar, chstyle.fontSize());
-					int coun = static_cast<int>((CurX+hl->glyph.xoffset - tabDist) / wt);
+					int coun = static_cast<int>((CurX+ glyphs->xoffset - tabDist) / wt);
 					// #6728 : update code according to fillInTabLeaders() and PageItem::layout() - JG
 					double sPos = 0.0 /* CurX+hl->glyph.xoffset - (CurX+hl->glyph.xoffset - tabDist) + 1 */;
-					hl2.ch = tTabValues[tabCc].tabFillChar;
-					hl2.setTracking(0);
-					hl2.setScaleH(1000);
-					hl2.setScaleV(1000);
-					hl2.glyph.yoffset = hl->glyph.yoffset;
+					gl2.glyph = chstyle.font().char2CMap(tTabValues[tabCc].tabFillChar);
+					cl2.setTracking(0);
+					cl2.setScaleH(1000);
+					cl2.setScaleV(1000);
+					gl2.yoffset = glyphs->yoffset;
 					for (int cx = 0; cx < coun; ++cx)
 					{
-						hl2.glyph.xoffset =  sPos + wt * cx;
+						glyphs->xoffset =  sPos + wt * cx;
 						if ((chstyle.effects() & ScStyle_Shadowed) && (chstyle.strokeColor() != CommonStrings::None))
 						{
-							ScText hl3;
-							static_cast<CharStyle&>(hl3) = static_cast<const CharStyle&>(hl2);
+							GlyphLayout gl3;
+							CharStyle cl3(cl2);
 							//<< HACK to fix Bug #8446
-							hl3.setEffects(hl3.effects() & (~(ScStyle_Outline)));
+							cl3.setEffects(cl3.effects() & (~(ScStyle_Outline)));
 							//>>
-							hl3.ch = hl2.ch;
-							hl3.glyph.glyph = hl2.glyph.glyph;
-							hl3.setFillColor(hl2.strokeColor());
-							hl3.setFillShade(hl2.strokeShade());
-							hl3.glyph.yoffset = hl2.glyph.yoffset - (chstyle.fontSize() * chstyle.shadowYOffset() / 10000.0);
-							hl3.glyph.xoffset = hl2.glyph.xoffset + (chstyle.fontSize() * chstyle.shadowXOffset() / 10000.0);
-							setTextCh(ite, PNr, 0, 0, d, tmp, tmp2, &hl3, pstyle, pag);
+							gl3.glyph = gl2.glyph;
+							cl3.setFillColor(cl2.strokeColor());
+							cl3.setFillShade(cl2.strokeShade());
+							gl3.yoffset = gl2.yoffset - (chstyle.fontSize() * chstyle.shadowYOffset() / 10000.0);
+							gl3.xoffset = gl2.xoffset + (chstyle.fontSize() * chstyle.shadowXOffset() / 10000.0);
+							setTextCh(ite, PNr, 0, 0, d, tmp, tmp2, cl3, &gl3, pdata, pstyle, pag);
 						}
-						setTextCh(ite, PNr, 0, 0, d, tmp, tmp2, &hl2, pstyle, pag);
+						setTextCh(ite, PNr, 0, 0, d, tmp, tmp2, cl2, &gl2, pdata, pstyle, pag);
 					}
 					tabCc++;
 				}
@@ -5274,32 +5279,27 @@
 			}
 			if (ch == SpecialChars::TAB)
 			{
-				CurX += hl->glyph.wide();
+				CurX += glyphs->wide();
 				continue;
 			}
 			if ((chstyle.effects() & ScStyle_Shadowed) && (chstyle.strokeColor() != CommonStrings::None))
 			{
-				ScText hl2;
-				hl2.ch = ch;
-				hl2.glyph.glyph = hl->glyph.glyph;
-				static_cast<CharStyle&>(hl2) = static_cast<const CharStyle&>(*hl);
+				GlyphLayout gl2;
+				gl2.glyph = glyphs->glyph;
+				CharStyle cl2(chstyle);
 				//<< HACK to fix Bug #8446
-				hl2.setEffects(hl2.effects() & (~(ScStyle_Outline)));
+				cl2.setEffects(cl2.effects() & (~(ScStyle_Outline)));
 				//>>
-				hl2.setFillColor(hl->strokeColor());
-				hl2.setFillShade(hl->strokeShade());
-				hl2.glyph.yoffset = hl->glyph.yoffset - (chstyle.fontSize() * chstyle.shadowYOffset() / 10000.0);
-				hl2.glyph.xoffset = hl->glyph.xoffset + (chstyle.fontSize() * chstyle.shadowXOffset() / 10000.0);
-				hl2.glyph.scaleH = hl->glyph.scaleH;
-				hl2.glyph.scaleV = hl->glyph.scaleV;
-				hl2.PtransX = hl->PtransX;
-				hl2.PtransY = hl->PtransY;
-				hl2.PRot = hl->PRot;
-				hl2.PDx = hl->PDx;
-				setTextCh(ite, PNr, 0, 0, d, tmp, tmp2, &hl2, pstyle, pag);
-			}
-			setTextCh(ite, PNr, 0, 0, d, tmp, tmp2, hl, pstyle, pag);
-			CurX += hl->glyph.wide();
+				cl2.setFillColor(chstyle.strokeColor());
+				cl2.setFillShade(chstyle.strokeShade());
+				gl2.yoffset = glyphs->yoffset - (chstyle.fontSize() * chstyle.shadowYOffset() / 10000.0);
+				gl2.xoffset = glyphs->xoffset + (chstyle.fontSize() * chstyle.shadowXOffset() / 10000.0);
+				gl2.scaleH = glyphs->scaleH;
+				gl2.scaleV = glyphs->scaleV;
+				setTextCh(ite, PNr, 0, 0, d, tmp, tmp2, cl2, &gl2, pdata, pstyle, pag);
+			}
+			setTextCh(ite, PNr, 0, 0, d, tmp, tmp2, chstyle, glyphs, pdata, pstyle, pag);
+			CurX += glyphs->wide();
 			tabDist = CurX;
 		}
 	}
@@ -5308,7 +5308,7 @@
 	return tmp;
 }
 
-bool PDFLibCore::setTextCh(PageItem *ite, uint PNr, double x, double y, uint d, QString &tmp, QString &tmp2, ScText *hl, const ParagraphStyle& pstyle, const ScPage* pag)
+bool PDFLibCore::setTextCh(PageItem *ite, uint PNr, double x, double y, uint d, QString &tmp, QString &tmp2, const CharStyle& style, GlyphLayout *glyphs, PathData* pdata, const ParagraphStyle& pstyle, const ScPage* pag)
 {
 	QString output;
 	QString FillColor = "";
@@ -5316,14 +5316,14 @@
 	if (ite->asPathText())
 	{
 		tmp += "q\n";
-		QPointF tangt = QPointF( cos(hl->PRot), sin(hl->PRot) );
-		QTransform trafo = QTransform( 1, 0, 0, -1, -hl->PDx, 0 );
+		QPointF tangt = QPointF( cos(pdata->PRot), sin(pdata->PRot) );
+		QTransform trafo = QTransform( 1, 0, 0, -1, -pdata->PDx, 0 );
 		if (ite->textPathFlipped)
 			trafo *= QTransform(1, 0, 0, -1, 0, 0);
 		if (ite->textPathType == 0)
-			trafo *= QTransform( tangt.x(), -tangt.y(), -tangt.y(), -tangt.x(), hl->PtransX, -hl->PtransY );
+			trafo *= QTransform( tangt.x(), -tangt.y(), -tangt.y(), -tangt.x(), pdata->PtransX, -pdata->PtransY );
 		else if (ite->textPathType == 1)
-			trafo *= QTransform(1, 0, 0, -1, hl->PtransX, -hl->PtransY );
+			trafo *= QTransform(1, 0, 0, -1, pdata->PtransX, -pdata->PtransY );
 		else if (ite->textPathType == 2)
 		{
 			double a = 1;
@@ -5334,21 +5334,20 @@
 				b = 1;
 			}
 			if (fabs(tangt.x()) > 0.1)
-				trafo *= QTransform( a, (tangt.y() / tangt.x()) * b, 0, -1, hl->PtransX, -hl->PtransY ); // ID's Skew mode
+				trafo *= QTransform( a, (tangt.y() / tangt.x()) * b, 0, -1, pdata->PtransX, -pdata->PtransY ); // ID's Skew mode
 			else
-				trafo *= QTransform( a, 6 * b, 0, -1, hl->PtransX, -hl->PtransY );
+				trafo *= QTransform( a, 6 * b, 0, -1, pdata->PtransX, -pdata->PtransY );
 		}
 		tmp += FToStr(trafo.m11())+" "+FToStr(trafo.m12())+" "+FToStr(trafo.m21())+" "+FToStr(trafo.m22())+" "+FToStr(trafo.dx())+" "+FToStr(trafo.dy())+" cm\n";
 		if (ite->BaseOffs != 0)
 			tmp += "1 0 0 1 0 "+ FToStr( -ite->BaseOffs)+" cm\n";
-		if (hl->glyph.xoffset != 0.0 || hl->glyph.yoffset != 0.0)
-			tmp += "1 0 0 1 " + FToStr( hl->glyph.xoffset)+ " " + FToStr( -hl->glyph.yoffset)+" cm\n";
-		if (hl->ch != SpecialChars::OBJECT)
+		if (glyphs->xoffset != 0.0 || glyphs->yoffset != 0.0)
+			tmp += "1 0 0 1 " + FToStr( glyphs->xoffset)+ " " + FToStr( -glyphs->yoffset)+" cm\n";
+		if (ite->itemText.text(d) != SpecialChars::OBJECT)
 			tmp += "BT\n";
 	}
-	double tsz = hl->fontSize();
-	QChar chstr = hl->ch;
-	const CharStyle& style(*hl);
+	QChar chstr = ite->itemText.text(d);
+	double tsz = style.fontSize();
 
 /*	if (hl->effects() & ScStyle_DropCap)
 	{
@@ -5366,14 +5365,14 @@
 		}
 	}
 	*/
-	if (hl->hasObject(&doc))
+	if (ite->itemText.hasObject(d))
 	{
 		if (!ite->asPathText())
 		{
 			tmp += "ET\n"+tmp2;
 			tmp2 = "";
 		}
-		PageItem* embedded = hl->getItem(&doc);
+		PageItem* embedded = ite->itemText.object(d);
 		tmp2 += "q\n";
 		if (ite->asPathText())
 			tmp2 +=  FToStr(style.scaleH() / 1000.0)+" 0 0 "+FToStr(style.scaleV() / 1000.0)+" "+FToStr(embedded->gXpos * (style.scaleH() / 1000.0))+" "+FToStr((embedded->height() * (style.scaleV() / 1000.0)) - embedded->gYpos * (style.scaleV() / 1000.0)+embedded->gHeight * (style.baselineOffset() / 1000.0))+" cm\n";
@@ -5382,16 +5381,16 @@
 			if (d == 0 || ite->itemText.text(d-1) == SpecialChars::PARSEP)
 			{
 				if ((style.baselineOffset() != 0) && (!pstyle.hasDropCap()))
-					tmp2 +=  FToStr(style.scaleH() / 1000.0)+" 0 0 "+FToStr(style.scaleV() / 1000.0)+" "+FToStr(x+hl->glyph.xoffset + embedded->gXpos * (style.scaleH() / 1000.0))+" "+FToStr(-y-hl->glyph.yoffset + (embedded->height() * (style.scaleV() / 1000.0)) - embedded->gYpos * (style.scaleV() / 1000.0)+embedded->height() * (style.baselineOffset() / 1000.0))+" cm\n";
+					tmp2 +=  FToStr(style.scaleH() / 1000.0)+" 0 0 "+FToStr(style.scaleV() / 1000.0)+" "+FToStr(x + glyphs->xoffset + embedded->gXpos * (style.scaleH() / 1000.0))+" "+FToStr(-y- glyphs->yoffset + (embedded->height() * (style.scaleV() / 1000.0)) - embedded->gYpos * (style.scaleV() / 1000.0)+embedded->height() * (style.baselineOffset() / 1000.0))+" cm\n";
 				else
-					tmp2 +=  FToStr(style.scaleH() / 1000.0)+" 0 0 "+FToStr(style.scaleV() / 1000.0)+" "+FToStr(x+hl->glyph.xoffset + embedded->gXpos * (style.scaleH() / 1000.0))+" "+FToStr(-y-hl->glyph.yoffset + (embedded->height() * (style.scaleV() / 1000.0)) - embedded->gYpos * (style.scaleV() / 1000.0))+" cm\n";
+					tmp2 +=  FToStr(style.scaleH() / 1000.0)+" 0 0 "+FToStr(style.scaleV() / 1000.0)+" "+FToStr(x+ glyphs->xoffset + embedded->gXpos * (style.scaleH() / 1000.0))+" "+FToStr(-y- glyphs->yoffset + (embedded->height() * (style.scaleV() / 1000.0)) - embedded->gYpos * (style.scaleV() / 1000.0))+" cm\n";
 			}
 			else
 			{
 				if (style.baselineOffset() != 0)
-					tmp2 +=  FToStr(style.scaleH() / 1000.0)+" 0 0 "+FToStr(style.scaleV() / 1000.0)+" "+FToStr(x+hl->glyph.xoffset + embedded->gXpos * (style.scaleH() / 1000.0))+" "+FToStr(-y-hl->glyph.yoffset + (embedded->height() * (style.scaleV() / 1000.0)) - embedded->gYpos * (style.scaleV() / 1000.0)+embedded->height() * (style.baselineOffset() / 1000.0))+" cm\n";
+					tmp2 +=  FToStr(style.scaleH() / 1000.0)+" 0 0 "+FToStr(style.scaleV() / 1000.0)+" "+FToStr(x+ glyphs->xoffset + embedded->gXpos * (style.scaleH() / 1000.0))+" "+FToStr(-y- glyphs->yoffset + (embedded->height() * (style.scaleV() / 1000.0)) - embedded->gYpos * (style.scaleV() / 1000.0)+embedded->height() * (style.baselineOffset() / 1000.0))+" cm\n";
 				else
-					tmp2 +=  FToStr(style.scaleH() / 1000.0)+" 0 0 "+FToStr(style.scaleV() / 1000.0)+" "+FToStr(x+hl->glyph.xoffset + embedded->gXpos * (style.scaleH() / 1000.0))+" "+FToStr(-y-hl->glyph.yoffset + (embedded->height() * (style.scaleV() / 1000.0)) - embedded->gYpos * (style.scaleV() / 1000.0))+" cm\n";
+					tmp2 +=  FToStr(style.scaleH() / 1000.0)+" 0 0 "+FToStr(style.scaleV() / 1000.0)+" "+FToStr(x+ glyphs->xoffset + embedded->gXpos * (style.scaleH() / 1000.0))+" "+FToStr(-y- glyphs->yoffset + (embedded->height() * (style.scaleV() / 1000.0)) - embedded->gYpos * (style.scaleV() / 1000.0))+" cm\n";
 			}
 		}
 		if (!PDF_ProcessItem(output, embedded, pag, PNr, true))
@@ -5407,7 +5406,7 @@
 		return true;
 	}
 
-	uint glyph = hl->glyph.glyph;
+	uint glyph = glyphs->glyph;
 
 	if (glyph == (ScFace::CONTROL_GLYPHS + SpecialChars::NBSPACE.unicode()) ||
 		glyph == (ScFace::CONTROL_GLYPHS + 32))
@@ -5436,7 +5435,7 @@
 		if (((style.effects() & ScStyle_Underline) && (chstr != SpecialChars::PARSEP))  || ((style.effects() & ScStyle_UnderlineWords) && (!chstr.isSpace())))
 		{
 			//		double Ulen = style.font().charWidth(chstr, style.fontSize()) * (hl->glyph.scaleH);
-			double Ulen = hl->glyph.xadvance;
+			double Ulen = glyphs->xadvance;
 			double Upos, Uwid;
 			if ((style.underlineOffset() != -1) || (style.underlineWidth() != -1))
 			{
@@ -5455,7 +5454,7 @@
 				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);
+				Upos += (style.fontSize() / 10.0) * glyphs->scaleV * (style.baselineOffset() / 1000.0);
 			if (style.fillColor() != CommonStrings::None)
 				tmp2 += putColor(style.fillColor(), style.fillShade(), false);
 			tmp2 += FToStr(Uwid)+" w\n";
@@ -5463,26 +5462,26 @@
 			{
 				if (style.effects() & ScStyle_Subscript)
 				{
-					tmp2 += FToStr(x+hl->glyph.xoffset)     +" "+FToStr(-y+Upos)+" m\n";
-					tmp2 += FToStr(x+hl->glyph.xoffset+Ulen)+" "+FToStr(-y+Upos)+" l\n";
+					tmp2 += FToStr(x+ glyphs->xoffset)     +" "+FToStr(-y+Upos)+" m\n";
+					tmp2 += FToStr(x+ glyphs->xoffset+Ulen)+" "+FToStr(-y+Upos)+" l\n";
 				}
 				else
 				{
-					tmp2 += FToStr(x+hl->glyph.xoffset)     +" "+FToStr(-y+hl->glyph.yoffset+Upos)+" m\n";
-					tmp2 += FToStr(x+hl->glyph.xoffset+Ulen)+" "+FToStr(-y+hl->glyph.yoffset+Upos)+" l\n";
+					tmp2 += FToStr(x+ glyphs->xoffset)     +" "+FToStr(-y+ glyphs->yoffset+Upos)+" m\n";
+					tmp2 += FToStr(x+ glyphs->xoffset+Ulen)+" "+FToStr(-y+ glyphs->yoffset+Upos)+" l\n";
 				}
 			}
 			else
 			{
 				if (style.effects() & ScStyle_Subscript)
 				{
-					tmp2 += FToStr(x+hl->glyph.xoffset)     +" "+FToStr(-y-hl->glyph.yoffset+Upos)+" m\n";
-					tmp2 += FToStr(x+hl->glyph.xoffset+Ulen)+" "+FToStr(-y-hl->glyph.yoffset+Upos)+" l\n";
+					tmp2 += FToStr(x+ glyphs->xoffset)     +" "+FToStr(-y- glyphs->yoffset+Upos)+" m\n";
+					tmp2 += FToStr(x+ glyphs->xoffset+Ulen)+" "+FToStr(-y- glyphs->yoffset+Upos)+" l\n";
 				}
 				else
 				{
-					tmp2 += FToStr(x+hl->glyph.xoffset)     +" "+FToStr(-y+Upos)+" m\n";
-					tmp2 += FToStr(x+hl->glyph.xoffset+Ulen)+" "+FToStr(-y+Upos)+" l\n";
+					tmp2 += FToStr(x+ glyphs->xoffset)     +" "+FToStr(-y+Upos)+" m\n";
+					tmp2 += FToStr(x+ glyphs->xoffset+Ulen)+" "+FToStr(-y+Upos)+" l\n";
 				}
 			}
 			tmp2 += "S\n";
@@ -5516,15 +5515,15 @@
 				{
 					if (ite->reversed())
 					{
-						double wid = style.font().charWidth(chstr, style.fontSize()) * (hl->glyph.scaleH);
-						tmp2 += "1 0 0 1 "+FToStr(x+hl->glyph.xoffset)+" "+FToStr((y+hl->glyph.yoffset - (tsz / 10.0)) * -1 + ((tsz / 10.0) * (style.baselineOffset() / 1000.0)))+" cm\n";
+						double wid = style.font().charWidth(chstr, style.fontSize()) * (glyphs->scaleH);
+						tmp2 += "1 0 0 1 "+FToStr(x+ glyphs->xoffset)+" "+FToStr((y+ glyphs->yoffset - (tsz / 10.0)) * -1 + ((tsz / 10.0) * (style.baselineOffset() / 1000.0)))+" cm\n";
 						tmp2 += "-1 0 0 1 0 0 cm\n";
 						tmp2 += "1 0 0 1 "+FToStr(-wid)+" 0 cm\n";
 						tmp2 += FToStr(tsz / 10.0)+" 0 0 "+FToStr(tsz / 10.0)+" 0 0 cm\n";
 					}
 					else
 					{
-						tmp2 += FToStr(tsz / 10.0)+" 0 0 "+FToStr(tsz / 10.0)+" "+FToStr(x+hl->glyph.xoffset)+" "+FToStr((y+hl->glyph.yoffset - (tsz / 10.0)) * -1 + ((tsz / 10.0) * (style.baselineOffset() / 1000.0)))+" cm\n";
+						tmp2 += FToStr(tsz / 10.0)+" 0 0 "+FToStr(tsz / 10.0)+" "+FToStr(x+ glyphs->xoffset)+" "+FToStr((y+ glyphs->yoffset - (tsz / 10.0)) * -1 + ((tsz / 10.0) * (style.baselineOffset() / 1000.0)))+" cm\n";
 					}
 				}
 				else
@@ -5533,9 +5532,9 @@
 						tmp2 += "1 0 0 1 0 "+FToStr( -ite->BaseOffs)+" cm\n";
 					tmp2 += FToStr(tsz / 10.0)+" 0 0 "+FToStr(tsz / 10.0)+" 0 "+FToStr(tsz / 10.0)+" cm\n";
 				}
-				if (hl->glyph.scaleV != 1.0)
-					tmp2 += "1 0 0 1 0 "+FToStr( (((tsz / 10.0) - (tsz / 10.0) * (hl->glyph.scaleV)) / (tsz / 10.0)) * -1)+" cm\n";
-				tmp2 += FToStr(qMax(hl->glyph.scaleH, 0.1))+" 0 0 "+FToStr(qMax(hl->glyph.scaleV, 0.1))+" 0 0 cm\n";
+				if (glyphs->scaleV != 1.0)
+					tmp2 += "1 0 0 1 0 "+FToStr( (((tsz / 10.0) - (tsz / 10.0) * (glyphs->scaleV)) / (tsz / 10.0)) * -1)+" cm\n";
+				tmp2 += FToStr(qMax(glyphs->scaleH, 0.1))+" 0 0 "+FToStr(qMax(glyphs->scaleV, 0.1))+" 0 0 cm\n";
 				if (style.fillColor() != CommonStrings::None)
 					tmp2 += "/"+style.font().psName().replace( QRegExp("[\\s\\/\\{\\[\\]\\}\\<\\>\\(\\)\\%]"), "_" )+QString::number(glyph)+" Do\n";
 				if (style.effects() & ScStyle_Outline)
@@ -5589,7 +5588,7 @@
 			}
 			if (glyph != style.font().char2CMap(QChar(' ')))
 			{
-				uint idx = hl->glyph.glyph;
+				uint idx = glyphs->glyph;
 				uint idx1;
 				if (Options.SubsetList.contains(style.font().replacementName()))
 					idx1 = Type3Fonts[UsedFontsP[style.font().replacementName()]][idx] / 256;
@@ -5627,24 +5626,24 @@
 					{
 						if (ite->reversed())
 						{
-							double wid = style.font().charWidth(chstr, style.fontSize()) * (hl->glyph.scaleH);
-							tmp2 += "1 0 0 1 "+FToStr(x+hl->glyph.xoffset)+" "+FToStr((y+hl->glyph.yoffset - (tsz / 10.0)) * -1 + ((tsz / 10.0) * (style.baselineOffset() / 1000.0)))+" cm\n";
+							double wid = style.font().charWidth(chstr, style.fontSize()) * (glyphs->scaleH);
+							tmp2 += "1 0 0 1 "+FToStr(x+ glyphs->xoffset)+" "+FToStr((y+ glyphs->yoffset - (tsz / 10.0)) * -1 + ((tsz / 10.0) * (style.baselineOffset() / 1000.0)))+" cm\n";
 							tmp2 += "-1 0 0 1 0 0 cm\n";
 							tmp2 += "1 0 0 1 "+FToStr(-wid)+" 0 cm\n";
 							tmp2 += FToStr(tsz / 10.0)+" 0 0 "+FToStr(tsz / 10.0)+" 0 0 cm\n";
 						}
 						else
 						{
-							tmp2 += FToStr(tsz / 10.0)+" 0 0 "+FToStr(tsz / 10.0)+" "+FToStr(x+hl->glyph.xoffset)+" "+FToStr((y+hl->glyph.yoffset - (tsz / 10.0)) * -1 + ((tsz / 10.0) * (style.baselineOffset() / 1000.0)))+" cm\n";
+							tmp2 += FToStr(tsz / 10.0)+" 0 0 "+FToStr(tsz / 10.0)+" "+FToStr(x+ glyphs->xoffset)+" "+FToStr((y+ glyphs->yoffset - (tsz / 10.0)) * -1 + ((tsz / 10.0) * (style.baselineOffset() / 1000.0)))+" cm\n";
 						}
 					}
 					else
 					{
 						tmp2 += FToStr(tsz / 10.0)+" 0 0 "+FToStr(tsz / 10.0)+" 0 "+FToStr(tsz / 10.0)+" cm\n";
 					}
-					if (hl->glyph.scaleV != 1.0)
-						tmp2 += "1 0 0 1 0 "+FToStr( (((tsz / 10.0) - (tsz / 10.0) * (hl->glyph.scaleV)) / (tsz / 10.0)) * -1)+" cm\n";
-					tmp2 += FToStr(qMax(hl->glyph.scaleH, 0.1))+" 0 0 "+FToStr(qMax(hl->glyph.scaleV, 0.1))+" 0 0 cm\n";
+					if (glyphs->scaleV != 1.0)
+						tmp2 += "1 0 0 1 0 "+FToStr( (((tsz / 10.0) - (tsz / 10.0) * (glyphs->scaleV)) / (tsz / 10.0)) * -1)+" cm\n";
+					tmp2 += FToStr(qMax(glyphs->scaleH, 0.1))+" 0 0 "+FToStr(qMax(glyphs->scaleV, 0.1))+" 0 0 cm\n";
 					FPointArray gly = style.font().glyphOutline(glyph);
 					QTransform mat;
 					mat.scale(0.1, 0.1);
@@ -5689,14 +5688,14 @@
 				{
 					if (ite->reversed())
 					{
-						double wtr = hl->glyph.xadvance;
-						tmp +=  FToStr(-qMax(hl->glyph.scaleH, 0.1))+" 0 0 "+FToStr(qMax(hl->glyph.scaleV, 0.1)) +" "+FToStr(x+hl->glyph.xoffset+wtr)+" "+FToStr(-y-hl->glyph.yoffset+(style.fontSize() / 10.0) * (style.baselineOffset() / 1000.0))+" Tm\n";
+						double wtr = glyphs->xadvance;
+						tmp +=  FToStr(-qMax(glyphs->scaleH, 0.1))+" 0 0 "+FToStr(qMax(glyphs->scaleV, 0.1)) +" "+FToStr(x+ glyphs->xoffset+wtr)+" "+FToStr(-y- glyphs->yoffset+(style.fontSize() / 10.0) * (style.baselineOffset() / 1000.0))+" Tm\n";
 					}
 					else
-						tmp +=  FToStr(qMax(hl->glyph.scaleH, 0.1))+" 0 0 "+FToStr(qMax(hl->glyph.scaleV, 0.1))+" "+FToStr(x+hl->glyph.xoffset)+" "+FToStr(-y-hl->glyph.yoffset+(style.fontSize() / 10.0) * (style.baselineOffset() / 1000.0))+" Tm\n";
+						tmp +=  FToStr(qMax(glyphs->scaleH, 0.1))+" 0 0 "+FToStr(qMax(glyphs->scaleV, 0.1))+" "+FToStr(x+ glyphs->xoffset)+" "+FToStr(-y- glyphs->yoffset+(style.fontSize() / 10.0) * (style.baselineOffset() / 1000.0))+" Tm\n";
 				}
 				else
-					tmp += FToStr(qMax(hl->glyph.scaleH, 0.1))+" 0 0 "+FToStr(qMax(hl->glyph.scaleV, 0.1))+" 0 0 Tm\n";
+					tmp += FToStr(qMax(glyphs->scaleH, 0.1))+" 0 0 "+FToStr(qMax(glyphs->scaleV, 0.1))+" 0 0 Tm\n";
 				uchar idx2;
 				if (Options.SubsetList.contains(style.font().replacementName()))
 				{
@@ -5725,7 +5724,7 @@
 		if ((style.effects() & ScStyle_Strikethrough) && (chstr != SpecialChars::PARSEP))
 		{
 			//		double Ulen = style.font().charWidth(chstr, style.fontSize()) * (hl->glyph.scaleH);
-			double Ulen = hl->glyph.xadvance;
+			double Ulen = glyphs->xadvance;
 			double Upos, Uwid;
 			if ((style.strikethruOffset() != -1) || (style.strikethruWidth() != -1))
 			{
@@ -5744,19 +5743,19 @@
 				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);
+				Upos += (style.fontSize() / 10.0) * glyphs->scaleV * (style.baselineOffset() / 1000.0);
 			if (style.fillColor() != CommonStrings::None)
 				tmp2 += putColor(style.fillColor(), style.fillShade(), false);
 			tmp2 += FToStr(Uwid)+" w\n";
 			if (ite->itemType() == PageItem::PathText)
 			{
-				tmp2 += FToStr(x+hl->glyph.xoffset)     +" "+FToStr(-y+Upos)+" m\n";
-				tmp2 += FToStr(x+hl->glyph.xoffset+Ulen)+" "+FToStr(-y+Upos)+" l\n";
+				tmp2 += FToStr(x+ glyphs->xoffset)     +" "+FToStr(-y+Upos)+" m\n";
+				tmp2 += FToStr(x+ glyphs->xoffset+Ulen)+" "+FToStr(-y+Upos)+" l\n";
 			}
 			else
 			{
-				tmp2 += FToStr(x+hl->glyph.xoffset)     +" "+FToStr(-y-hl->glyph.yoffset+Upos)+" m\n";
-				tmp2 += FToStr(x+hl->glyph.xoffset+Ulen)+" "+FToStr(-y-hl->glyph.yoffset+Upos)+" l\n";
+				tmp2 += FToStr(x+ glyphs->xoffset)     +" "+FToStr(-y- glyphs->yoffset+Upos)+" m\n";
+				tmp2 += FToStr(x+ glyphs->xoffset+Ulen)+" "+FToStr(-y- glyphs->yoffset+Upos)+" l\n";
 			}
 			tmp2 += "S\n";
 		}
@@ -5766,14 +5765,14 @@
 			tmp2 = "";
 		}
 	}
-	if (hl->glyph.more) {
-		// ugly hack until setTextCh interface is changed
-		ScText hl2(*hl);
-		hl2.glyph = *(hl->glyph.more);
-		if (!setTextCh(ite, PNr, x + hl->glyph.xadvance, y, d, tmp, tmp2, &hl2, pstyle, pag))
+	if (glyphs->more) {
+//		// ugly hack until setTextCh interface is changed
+//		ScText hl2(*hl);
+//		hl2.glyph = *(hl->glyph.more);
+		if (!setTextCh(ite, PNr, x + glyphs->xadvance, y, d, tmp, tmp2, style, glyphs->more, pdata, pstyle, pag))
 			return false;
-		// don't let hl2's destructor delete these!
-		hl2.glyph.more = 0;
+//		// don't let hl2's destructor delete these!
+//		hl2.glyph.more = 0;
 	}
 	return true;
 }

Modified: trunk/Scribus/scribus/pdflib_core.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18987&path=/trunk/Scribus/scribus/pdflib_core.h
==============================================================================
--- trunk/Scribus/scribus/pdflib_core.h (original)
+++ trunk/Scribus/scribus/pdflib_core.h Thu Apr  3 15:08:24 2014
@@ -130,7 +130,7 @@
 	QString putColorUncached(const QString& color, int Shade, bool fill);
 	QString Write_TransparencyGroup(double trans, int blend, QString &data, PageItem *controlItem = 0);
 	QString setTextSt(PageItem *ite, uint PNr, const ScPage* pag);
-	bool    setTextCh(PageItem *ite, uint PNr, double x, double y, uint d,  QString &tmp, QString &tmp2, ScText *hl, const ParagraphStyle& pstyle, const ScPage* pag);
+	bool    setTextCh(PageItem *ite, uint PNr, double x, double y, uint d,  QString &tmp, QString &tmp2, const CharStyle& cstyle, GlyphLayout *glyphs, PathData* pdata, const ParagraphStyle& pstyle, const ScPage* pag);
 	void    getBleeds(const ScPage* page, double &left, double &right);
 	void    getBleeds(const ScPage* page, double &left, double &right, double &bottom, double& top);
 

Modified: trunk/Scribus/scribus/plugins/scriptplugin/cmdtext.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18987&path=/trunk/Scribus/scribus/plugins/scriptplugin/cmdtext.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/scriptplugin/cmdtext.cpp (original)
+++ trunk/Scribus/scribus/plugins/scriptplugin/cmdtext.cpp Thu Apr  3 15:08:24 2014
@@ -127,7 +127,7 @@
 		PyErr_SetString(WrongFrameTypeError, QObject::tr("Cannot get number of lines of non-text frame.","python error").toLocal8Bit().constData());
 		return NULL;
 	}
-	return PyInt_FromLong(static_cast<long>(i->itemText.lines()));
+	return PyInt_FromLong(static_cast<long>(i->textLayout.lines()));
 }
 
 PyObject *scribus_getcolumns(PyObject* /* self */, PyObject* args)

Modified: trunk/Scribus/scribus/plugins/svgexplugin/svgexplugin.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18987&path=/trunk/Scribus/scribus/plugins/svgexplugin/svgexplugin.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/svgexplugin/svgexplugin.cpp (original)
+++ trunk/Scribus/scribus/plugins/svgexplugin/svgexplugin.cpp Thu Apr  3 15:08:24 2014
@@ -1166,21 +1166,25 @@
 	}
 	double x, y, wide;
 	QString chstr;
-	for (uint ll=0; ll < Item->itemText.lines(); ++ll)
-	{
-		LineSpec ls = Item->itemText.line(ll);
+	for (uint ll=0; ll < Item->textLayout.lines(); ++ll)
+	{
+		LineSpec ls = Item->textLayout.line(ll);
 		double CurX = ls.x;
 		for (int a = ls.firstItem; a <= ls.lastItem; ++a)
 		{
 			x = 0.0;
 			y = 0.0;
-			ScText * hl = Item->itemText.item_p(a);
+			//ScText * hl = Item->itemText.item_p(a);
 			const CharStyle& charStyle(Item->itemText.charStyle(a));
+            const GlyphLayout* glyphs = Item->itemText.getGlyphs(a);
+            PageItem* embItem = Item->itemText.hasObject(a)? Item->itemText.object(a) : NULL;
+            LayoutFlags flags = Item->itemText.flags(a);
+            
 			chstr = Item->itemText.text(a,1);
 			if ((chstr == QChar(13)) || (chstr == QChar(29)))
 			{
 				if (chstr == QChar(29))
-					CurX += hl->glyph.wide();
+					CurX += glyphs->wide();
 				continue;
 			}
 			if (chstr == QChar(30))
@@ -1188,20 +1192,20 @@
 				chstr = Item->ExpandToken(a);
 				if (chstr == QChar(32))
 				{
-					CurX += hl->glyph.wide();
+					CurX += glyphs->wide();
 					continue;
 				}
 			}
 			double chs = charStyle.fontSize();
-			if (hl->effects() & ScStyle_SmallCaps)
+			if (charStyle.effects() & ScStyle_SmallCaps)
 			{
 				if (chstr.toUpper() != chstr)
 				{
-					chs = qMax(static_cast<int>(hl->fontSize() * m_Doc->typographicPrefs().valueSmallCaps / 100), 1);
+					chs = qMax(static_cast<int>(charStyle.fontSize() * m_Doc->typographicPrefs().valueSmallCaps / 100), 1);
 					chstr = chstr.toUpper();
 				}
 			}
-			else if (hl->effects() & ScStyle_AllCaps)
+			else if (charStyle.effects() & ScStyle_AllCaps)
 				chstr = chstr.toUpper();
 			uint chr = chstr[0].unicode();
 			QTransform chma, chma2, chma3, chma4, chma6;
@@ -1212,20 +1216,20 @@
 				sca.translate(-Item->xPos(), -Item->yPos());
 				trafo *= sca;
 			}
-			chma.scale(hl->glyph.scaleH * charStyle.fontSize() / 100.00, hl->glyph.scaleV * charStyle.fontSize() / 100.0);
+			chma.scale(glyphs->scaleH * charStyle.fontSize() / 100.00, glyphs->scaleV * charStyle.fontSize() / 100.0);
 			if (Item->reversed())
 			{
 				if (a < Item->itemText.length()-1)
-					wide = hl->font().charWidth(chstr[0], hl->fontSize(), Item->itemText.text(a+1));
+					wide = charStyle.font().charWidth(chstr[0], charStyle.fontSize(), Item->itemText.text(a+1));
 				else
-					wide = hl->font().charWidth(chstr[0], hl->fontSize());
+					wide = charStyle.font().charWidth(chstr[0], charStyle.fontSize());
 				chma3.scale(-1, 1);
 				chma3.translate(-wide, 0);
 			}
-			chma4.translate(0, Item->BaseOffs - (charStyle.fontSize() / 10.0) * hl->glyph.scaleV);
+			chma4.translate(0, Item->BaseOffs - (charStyle.fontSize() / 10.0) * glyphs->scaleV);
 			if (charStyle.effects() & (ScStyle_Subscript | ScStyle_Superscript | ScLayout_DropCap))
-				chma6.translate(0, hl->glyph.yoffset);
-			if (hl->baselineOffset() != 0)
+				chma6.translate(0, glyphs->yoffset);
+			if (charStyle.baselineOffset() != 0)
 				chma6.translate(0, (-charStyle.fontSize() / 10.0) * (charStyle.baselineOffset() / 1000.0));
 			QTransform finalMat = chma * chma2 * chma3 * chma4 * chma6 * trafo;
 			if (Item->rotation() != 0)
@@ -1234,16 +1238,16 @@
 				sca.translate(Item->xPos(), Item->yPos());
 				finalMat *= sca;
 			}
-			if (hl->hasObject(m_Doc))
-			{
-				ob.appendChild(processInlineItem(CurX + hl->glyph.xoffset, ls.y + hl->glyph.yoffset, finalMat, hl, false, trans));
-				CurX += (hl->getItem(m_Doc)->width() + hl->getItem(m_Doc)->lineWidth()) * hl->glyph.scaleH;
+			if (embItem != NULL)
+			{
+				ob.appendChild(processInlineItem(CurX + glyphs->xoffset, ls.y + glyphs->yoffset, finalMat, embItem, charStyle, false, trans));
+				CurX += (embItem->width() + embItem->lineWidth()) * glyphs->scaleH;
 			}
 			else
 			{
 				QString glName;
 				if (chstr > QChar(32))
-					glName = handleGlyph(chr, hl);
+					glName = handleGlyph(chr, charStyle);
 				if ((charStyle.effects() & ScStyle_Shadowed) && (charStyle.strokeColor() != CommonStrings::None) && (chstr > QChar(32)))
 				{
 					QTransform sha = finalMat;
@@ -1253,18 +1257,18 @@
 					QDomElement ob2 = docu.createElement("use");
 					ob2.setAttribute("xlink:href", "#" + glName);
 					ob2.setAttribute("transform", MatrixToStr(sha));
-					ob2.setAttribute("style", "fill:"+SetColor(hl->strokeColor(), hl->strokeShade())+";" + "stroke:none;");
+					ob2.setAttribute("style", "fill:"+SetColor(charStyle.strokeColor(), charStyle.strokeShade())+";" + "stroke:none;");
 					ob.appendChild(ob2);
 				}
-				QChar chstc = hl->ch;
-				if (((charStyle.effects() & ScStyle_Underline) && !SpecialChars::isBreak(chstc))
-					|| ((charStyle.effects() & ScStyle_UnderlineWords) && !chstc.isSpace() && !SpecialChars::isBreak(chstc)))
+				
+				if (((charStyle.effects() & ScStyle_Underline) && !SpecialChars::isBreak(chstr[0]))
+					|| ((charStyle.effects() & ScStyle_UnderlineWords) && !chstr[0].isSpace() && !SpecialChars::isBreak(chstr[0])))
 				{
 					x = CurX;
 					y = ls.y;
-					double Ulen = hl->glyph.xadvance;
+					double Ulen = glyphs->xadvance;
 					double Upos, lw, kern;
-					if (charStyle.effects() & ScLayout_StartOfLine)
+					if (flags & ScLayout_StartOfLine)
 						kern = 0;
 					else
 						kern = charStyle.fontSize() * charStyle.tracking() / 10000.0;
@@ -1288,9 +1292,9 @@
 						Upos += (charStyle.fontSize() / 10.0) * (charStyle.baselineOffset() / 1000.0);
 					QDomElement ob6 = docu.createElement("path");
 					if (charStyle.effects() & ScStyle_Subscript)
-						ob6.setAttribute("d", QString("M %1 %2 L%3 %4").arg(x + hl->glyph.xoffset-kern).arg(y + hl->glyph.yoffset - Upos).arg(x + hl->glyph.xoffset+Ulen).arg(y + hl->glyph.yoffset - Upos));
+						ob6.setAttribute("d", QString("M %1 %2 L%3 %4").arg(x + glyphs->xoffset-kern).arg(y + glyphs->yoffset - Upos).arg(x + glyphs->xoffset+Ulen).arg(y + glyphs->yoffset - Upos));
 					else
-						ob6.setAttribute("d", QString("M %1 %2 L%3 %4").arg(x + hl->glyph.xoffset-kern).arg(y - Upos).arg(x + hl->glyph.xoffset+Ulen).arg(y - Upos));
+						ob6.setAttribute("d", QString("M %1 %2 L%3 %4").arg(x + glyphs->xoffset-kern).arg(y - Upos).arg(x + glyphs->xoffset+Ulen).arg(y - Upos));
 					QString sT = "stroke:none;";
 					if (charStyle.fillColor() != CommonStrings::None)
 					{
@@ -1305,12 +1309,12 @@
 					QDomElement ob3 = docu.createElement("use");
 					ob3.setAttribute("xlink:href", "#" + glName);
 					ob3.setAttribute("transform", MatrixToStr(finalMat));
-					QString fT = "fill:"+SetColor(hl->fillColor(), hl->fillShade())+";";
+					QString fT = "fill:"+SetColor(charStyle.fillColor(), charStyle.fillShade())+";";
 					QString sT = "stroke:none;";
 					if (charStyle.effects() & ScStyle_Outline)
 					{
-						sT = "stroke:"+SetColor(hl->strokeColor(), hl->strokeShade())+";";
-						sT += " stroke-width:"+FToStr(chs * hl->outlineWidth() / 10000.0)+";";
+						sT = "stroke:"+SetColor(charStyle.strokeColor(), charStyle.strokeShade())+";";
+						sT += " stroke-width:"+FToStr(chs * charStyle.outlineWidth() / 10000.0)+";";
 					}
 					ob3.setAttribute("style", fT + sT);
 					ob.appendChild(ob3);
@@ -1319,9 +1323,9 @@
 				{
 					x = CurX;
 					y = ls.y;
-					double Ulen = hl->glyph.xadvance;
+					double Ulen = glyphs->xadvance;
 					double Upos, lw, kern;
-					if (charStyle.effects() & ScLayout_StartOfLine)
+					if (flags & ScLayout_StartOfLine)
 						kern = 0;
 					else
 						kern = charStyle.fontSize() * charStyle.tracking() / 10000.0;
@@ -1342,9 +1346,9 @@
 						lw = qMax(charStyle.font().strokeWidth(charStyle.fontSize() / 10.0), 1.0);
 					}
 					if (charStyle.baselineOffset() != 0)
-						Upos += (charStyle.fontSize() / 10.0) * hl->glyph.scaleV * (charStyle.baselineOffset() / 1000.0);
+						Upos += (charStyle.fontSize() / 10.0) * glyphs->scaleV * (charStyle.baselineOffset() / 1000.0);
 					QDomElement ob7 = docu.createElement("path");
-					ob7.setAttribute("d", QString("M %1 %2 L%3 %4").arg(x + hl->glyph.xoffset-kern).arg(y + hl->glyph.yoffset - Upos).arg(x + hl->glyph.xoffset+Ulen).arg(y + hl->glyph.yoffset - Upos));
+					ob7.setAttribute("d", QString("M %1 %2 L%3 %4").arg(x + glyphs->xoffset-kern).arg(y + glyphs->yoffset - Upos).arg(x + glyphs->xoffset+Ulen).arg(y + glyphs->yoffset - Upos));
 					QString sT = "stroke:none;";
 					if (charStyle.fillColor() != CommonStrings::None)
 					{
@@ -1354,7 +1358,7 @@
 					ob7.setAttribute("style", "fill:none;" + sT);
 					ob.appendChild(ob7);
 				}
-				CurX += hl->glyph.wide();
+				CurX += glyphs->wide();
 			}
 		}
 	}
@@ -1417,10 +1421,15 @@
 	QString chstr;
 	for (int a = 0; a < Item->asPathText()->itemRenderText.length(); ++a)
 	{
-		ScText *hl = Item->asPathText()->itemRenderText.item_p(a);
+		//ScText *hl = Item->asPathText()->itemRenderText.item_p(a);
 		const CharStyle& charStyle(Item->asPathText()->itemRenderText.charStyle(a));
+		const GlyphLayout* glyphs = Item->asPathText()->itemRenderText.getGlyphs(a);
+        const PathData* pdata = &(Item->textLayout.point(a));
+        PageItem* embItem = Item->itemText.hasObject(a)? Item->itemText.object(a) : NULL;
+        LayoutFlags flags = Item->itemText.flags(a);
+        
 		chstr = Item->asPathText()->itemRenderText.text(a,1);
-		if ((chstr == QChar(13)) || (chstr == QChar(29)))
+        if ((chstr == QChar(13)) || (chstr == QChar(29)))
 			continue;
 		if (chstr == QChar(30))
 		{
@@ -1429,26 +1438,27 @@
 				continue;
 		}
 		double chs = charStyle.fontSize();
-		if (hl->effects() & ScStyle_SmallCaps)
+		if (charStyle.effects() & ScStyle_SmallCaps)
 		{
 			if (chstr.toUpper() != chstr)
 			{
-				chs = qMax(static_cast<int>(hl->fontSize() * m_Doc->typographicPrefs().valueSmallCaps / 100), 1);
+				chs = qMax(static_cast<int>(charStyle.fontSize() * m_Doc->typographicPrefs().valueSmallCaps / 100), 1);
 				chstr = chstr.toUpper();
 			}
 		}
-		else if (hl->effects() & ScStyle_AllCaps)
+		else if (charStyle.effects() & ScStyle_AllCaps)
 			chstr = chstr.toUpper();
 		uint chr = chstr[0].unicode();
-		QPointF tangt = QPointF( cos(hl->PRot), sin(hl->PRot) );
+        
+		QPointF tangt = QPointF( cos(pdata->PRot), sin(pdata->PRot) );
 		QTransform chma, chma2, chma3, chma4, chma6;
-		QTransform trafo = QTransform( 1, 0, 0, -1, -hl->PDx, 0 );
+		QTransform trafo = QTransform( 1, 0, 0, -1, -pdata->PDx, 0 );
 		if (Item->textPathFlipped)
 			trafo *= QTransform(1, 0, 0, -1, 0, 0);
 		if (Item->textPathType == 0)
-			trafo *= QTransform( tangt.x(), tangt.y(), tangt.y(), -tangt.x(), hl->PtransX, hl->PtransY );
+			trafo *= QTransform( tangt.x(), tangt.y(), tangt.y(), -tangt.x(), pdata->PtransX, pdata->PtransY );
 		else if (Item->textPathType == 1)
-			trafo *= QTransform(1, 0, 0, -1, hl->PtransX, hl->PtransY );
+			trafo *= QTransform(1, 0, 0, -1, pdata->PtransX, pdata->PtransY );
 		else if (Item->textPathType == 2)
 		{
 			double a = 1;
@@ -1459,14 +1469,14 @@
 				b = 1;
 			}
 			if (fabs(tangt.x()) > 0.1)
-				trafo *= QTransform( a, (tangt.y() / tangt.x()) * b, 0, -1, hl->PtransX, hl->PtransY ); // ID's Skew mode
+				trafo *= QTransform( a, (tangt.y() / tangt.x()) * b, 0, -1, pdata->PtransX, pdata->PtransY ); // ID's Skew mode
 			else
-				trafo *= QTransform( a, 6 * b, 0, -1, hl->PtransX, hl->PtransY );
-		}
-		if (hl->hasObject(m_Doc))
+				trafo *= QTransform( a, 6 * b, 0, -1, pdata->PtransX, pdata->PtransY );
+		}
+		if (embItem != NULL)
 		{
 			QTransform finalMat = chma * chma2 * chma3 * chma4 * chma6 * trafo;
-			ob.appendChild(processInlineItem(0, 0, finalMat, hl, true, trans));
+			ob.appendChild(processInlineItem(0, 0, finalMat, embItem, charStyle, true, trans));
 		}
 		else
 		{
@@ -1476,20 +1486,20 @@
 				sca.translate(-Item->xPos(), -Item->yPos());
 				trafo *= sca;
 			}
-			chma.scale(hl->glyph.scaleH * charStyle.fontSize() / 100.00, hl->glyph.scaleV * charStyle.fontSize() / 100.0);
+			chma.scale(glyphs->scaleH * charStyle.fontSize() / 100.00, glyphs->scaleV * charStyle.fontSize() / 100.0);
 			if (Item->reversed())
 			{
 				if (a < Item->itemText.length()-1)
-					wide = hl->font().charWidth(chstr[0], hl->fontSize(), Item->itemText.text(a+1));
+					wide = charStyle.font().charWidth(chstr[0], charStyle.fontSize(), Item->itemText.text(a+1));
 				else
-					wide = hl->font().charWidth(chstr[0], hl->fontSize());
+					wide = charStyle.font().charWidth(chstr[0], charStyle.fontSize());
 				chma3.scale(-1, 1);
 				chma3.translate(-wide, 0);
 			}
-			chma4.translate(0, Item->BaseOffs - (charStyle.fontSize() / 10.0) * hl->glyph.scaleV);
+			chma4.translate(0, Item->BaseOffs - (charStyle.fontSize() / 10.0) * glyphs->scaleV);
 			if (charStyle.effects() & (ScStyle_Subscript | ScStyle_Superscript | ScLayout_DropCap))
-				chma6.translate(0, hl->glyph.yoffset);
-			if (hl->baselineOffset() != 0)
+				chma6.translate(0, glyphs->yoffset);
+			if (charStyle.baselineOffset() != 0)
 				chma6.translate(0, (-charStyle.fontSize() / 10.0) * (charStyle.baselineOffset() / 1000.0));
 			QTransform finalMat = chma * chma2 * chma3 * chma4 * chma6 * trafo;
 			if (Item->rotation() != 0)
@@ -1498,9 +1508,9 @@
 				sca.translate(Item->xPos(), Item->yPos());
 				finalMat *= sca;
 			}
-			QChar chstc = hl->ch;
-			if (((charStyle.effects() & ScStyle_Underline) && !SpecialChars::isBreak(chstc))
-				|| ((charStyle.effects() & ScStyle_UnderlineWords) && !chstc.isSpace() && !SpecialChars::isBreak(chstc)))
+
+			if (((charStyle.effects() & ScStyle_Underline) && !SpecialChars::isBreak(chstr[0]))
+				|| ((charStyle.effects() & ScStyle_UnderlineWords) && !chstr[0].isSpace() && !SpecialChars::isBreak(chstr[0])))
 			{
 				QTransform stro = chma2 * chma3 * chma6 * trafo;
 				if (Item->rotation() != 0)
@@ -1509,9 +1519,9 @@
 					sca.translate(Item->xPos(), Item->yPos());
 					stro *= sca;
 				}
-				double Ulen = hl->glyph.xadvance;
+				double Ulen = glyphs->xadvance;
 				double Upos, Uwid, kern;
-				if (hl->effects() & ScLayout_StartOfLine)
+				if (flags & ScLayout_StartOfLine)
 					kern = 0;
 				else
 					kern = charStyle.fontSize() * charStyle.tracking() / 10000.0;
@@ -1536,9 +1546,9 @@
 				QDomElement ob8 = docu.createElement("path");
 				ob8.setAttribute("transform", MatrixToStr(stro));
 				if (charStyle.effects() & ScStyle_Subscript)
-					ob8.setAttribute("d", QString("M %1 %2 L%3 %4").arg(hl->glyph.xoffset-kern).arg(-Upos).arg(hl->glyph.xoffset+Ulen).arg(-Upos));
+					ob8.setAttribute("d", QString("M %1 %2 L%3 %4").arg(glyphs->xoffset-kern).arg(-Upos).arg(glyphs->xoffset+Ulen).arg(-Upos));
 				else
-					ob8.setAttribute("d", QString("M %1 %2 L%3 %4").arg(hl->glyph.xoffset-kern).arg(-(Upos + hl->glyph.yoffset)).arg(hl->glyph.xoffset+Ulen).arg(-(Upos + hl->glyph.yoffset)));
+					ob8.setAttribute("d", QString("M %1 %2 L%3 %4").arg(glyphs->xoffset-kern).arg(-(Upos + glyphs->yoffset)).arg(glyphs->xoffset+Ulen).arg(-(Upos + glyphs->yoffset)));
 				QString sT = "stroke:none;";
 				if (charStyle.fillColor() != CommonStrings::None)
 				{
@@ -1550,7 +1560,7 @@
 			}
 			if (chstr > QChar(32))
 			{
-				QString glName = handleGlyph(chr, hl);
+				QString glName = handleGlyph(chr, charStyle);
 				if ((charStyle.effects() & ScStyle_Shadowed) && (charStyle.strokeColor() != CommonStrings::None))
 				{
 					QTransform sha = finalMat;
@@ -1560,18 +1570,18 @@
 					QDomElement ob2 = docu.createElement("use");
 					ob2.setAttribute("xlink:href", "#" + glName);
 					ob2.setAttribute("transform", MatrixToStr(sha));
-					ob2.setAttribute("style", "fill:"+SetColor(hl->strokeColor(), hl->strokeShade())+";" + "stroke:none;");
+					ob2.setAttribute("style", "fill:"+SetColor(charStyle.strokeColor(), charStyle.strokeShade())+";" + "stroke:none;");
 					ob.appendChild(ob2);
 				}
 				QDomElement ob1 = docu.createElement("use");
 				ob1.setAttribute("xlink:href", "#" + glName);
 				ob1.setAttribute("transform", MatrixToStr(finalMat));
-				QString fT = "fill:"+SetColor(hl->fillColor(), hl->fillShade())+";";
+				QString fT = "fill:"+SetColor(charStyle.fillColor(), charStyle.fillShade())+";";
 				QString sT = "stroke:none;";
 				if (charStyle.effects() & ScStyle_Outline)
 				{
-					sT = "stroke:"+SetColor(hl->strokeColor(), hl->strokeShade())+";";
-					sT += " stroke-width:"+FToStr(chs * hl->outlineWidth() / 10000.0)+";";
+					sT = "stroke:"+SetColor(charStyle.strokeColor(), charStyle.strokeShade())+";";
+					sT += " stroke-width:"+FToStr(chs * charStyle.outlineWidth() / 10000.0)+";";
 				}
 				ob1.setAttribute("style", fT + sT);
 				ob.appendChild(ob1);
@@ -1585,9 +1595,9 @@
 					sca.translate(Item->xPos(), Item->yPos());
 					stro *= sca;
 				}
-				double Ulen = hl->glyph.xadvance;
+				double Ulen = glyphs->xadvance;
 				double Upos, Uwid, kern;
-				if (hl->effects() & ScLayout_StartOfLine)
+				if (flags & ScLayout_StartOfLine)
 					kern = 0;
 				else
 					kern = charStyle.fontSize() * charStyle.tracking() / 10000.0;
@@ -1611,7 +1621,7 @@
 					Upos += (charStyle.fontSize() / 10.0) * (charStyle.baselineOffset() / 1000.0);
 				QDomElement ob7 = docu.createElement("path");
 				ob7.setAttribute("transform", MatrixToStr(stro));
-				ob7.setAttribute("d", QString("M %1 %2 L%3 %4").arg(hl->glyph.xoffset-kern).arg(-Upos).arg(hl->glyph.xoffset+Ulen).arg(-Upos));
+				ob7.setAttribute("d", QString("M %1 %2 L%3 %4").arg(glyphs->xoffset-kern).arg(-Upos).arg(glyphs->xoffset+Ulen).arg(-Upos));
 				QString sT = "stroke:none;";
 				if (charStyle.fillColor() != CommonStrings::None)
 				{
@@ -1626,10 +1636,14 @@
 	return ob;
 }
 
-QDomElement SVGExPlug::processInlineItem(double xpos, double ypos, QTransform &finalMat, ScText *hl, bool pathT, QString trans)
-{
-	const CharStyle & charStyle(*hl);
-	QList<PageItem*> emG = hl->getGroupedItems(m_Doc);
+QDomElement SVGExPlug::processInlineItem(double xpos, double ypos, QTransform &finalMat, PageItem* embItem, const CharStyle & charStyle, bool pathT, QString trans)
+{
+	QList<PageItem*> emG;
+    if (embItem->isGroup())
+        emG = embItem->getItemList();
+    else 
+        emG.append(embItem);
+    
 	QDomElement layerGroup = docu.createElement("g");
 	if (pathT)
 		layerGroup.setAttribute("transform", MatrixToStr(finalMat));
@@ -1687,15 +1701,15 @@
 	return layerGroup;
 }
 
-QString SVGExPlug::handleGlyph(uint chr, ScText *hl)
+QString SVGExPlug::handleGlyph(uint chr, const CharStyle& cStyle)
 {
 	if (chr == 32)
 		return "SPACE";
-	QString glName = QString("Gl%1%2").arg(hl->font().psName().simplified().replace(QRegExp("[\\s\\/\\{\\[\\]\\}\\<\\>\\(\\)\\%]"), "_" )).arg(chr);
+	QString glName = QString("Gl%1%2").arg(cStyle.font().psName().simplified().replace(QRegExp("[\\s\\/\\{\\[\\]\\}\\<\\>\\(\\)\\%]"), "_" )).arg(chr);
 	if (glyphNames.contains(glName))
 		return glName;
-	uint gl = hl->font().char2CMap(chr);
-	FPointArray pts = hl->font().glyphOutline(gl);
+	uint gl = cStyle.font().char2CMap(chr);
+	FPointArray pts = cStyle.font().glyphOutline(gl);
 	QDomElement ob = docu.createElement("path");
 	ob.setAttribute("d", SetClipPath(&pts, true));
 	ob.setAttribute("id", glName);

Modified: trunk/Scribus/scribus/plugins/svgexplugin/svgexplugin.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18987&path=/trunk/Scribus/scribus/plugins/svgexplugin/svgexplugin.h
==============================================================================
--- trunk/Scribus/scribus/plugins/svgexplugin/svgexplugin.h (original)
+++ trunk/Scribus/scribus/plugins/svgexplugin/svgexplugin.h Thu Apr  3 15:08:24 2014
@@ -91,8 +91,8 @@
 	QDomElement processImageItem(PageItem *Item, QString trans, QString fill, QString stroke);
 	QDomElement processTextItem(PageItem *Item, QString trans, QString fill, QString stroke);
 	QDomElement processPathTextItem(PageItem *Item, QString trans, QString stroke);
-	QDomElement processInlineItem(double xpos, double ypos, QTransform &finalMat, ScText *hl, bool pathT, QString trans);
-	QString handleGlyph(uint chr, ScText *hl);
+	QDomElement processInlineItem(double xpos, double ypos, QTransform &finalMat, PageItem* embItem, const CharStyle& cStyle, bool pathT, QString trans);
+	QString handleGlyph(uint chr, const CharStyle& cStyle);
 	QDomElement processArrows(PageItem *Item, QDomElement line, QString trans);
 	QString handleMask(PageItem *Item, double xOffset, double yOffset);
 	QString getFillStyle(PageItem *Item);

Modified: trunk/Scribus/scribus/plugins/xpsexport/xpsexplugin.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18987&path=/trunk/Scribus/scribus/plugins/xpsexport/xpsexplugin.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/xpsexport/xpsexplugin.cpp (original)
+++ trunk/Scribus/scribus/plugins/xpsexport/xpsexplugin.cpp Thu Apr  3 15:08:24 2014
@@ -874,45 +874,50 @@
 			grp.appendChild(ob);
 		}
 	}
-	for (uint ll=0; ll < Item->itemText.lines(); ++ll)
-	{
-		LineSpec ls = Item->itemText.line(ll);
+	for (uint ll=0; ll < Item->textLayout.lines(); ++ll)
+	{
+		LineSpec ls = Item->textLayout.line(ll);
 		QList<txtRunItem> current_run;
 		QList<QList<txtRunItem> > textRuns;
 		QList<txtRunItem> specialText;
 		double CurX = ls.x;
 		for (int a = ls.firstItem; a <= ls.lastItem; ++a)
 		{
-			ScText *hl = Item->itemText.item_p(a);
+			//ScText *hl = Item->itemText.item_p(a);
+            QChar chr = Item->itemText.text(a);
 			CharStyle charStyle = Item->itemText.charStyle(a);
+			GlyphLayout* glyphs = Item->itemText.getGlyphs(a);
+            LayoutFlags flags = Item->itemText.flags(a);
 			const ScFace* font = &charStyle.font();
 			txtRunItem txItem;
-			txItem.hl = hl;
+            txItem.chr = chr;
+			txItem.glyphs = glyphs;
 			txItem.style = charStyle;
 			txItem.index = a;
 			txItem.CurX = CurX;
+            txItem.embItem = Item->itemText.hasObject(a)? Item->itemText.object(a) : NULL;
 			if (!((font->type() == ScFace::TTF) || (font->type() == ScFace::OTF)))
 			{
 				specialText.append(txItem);
 				textRuns.append(current_run);
 				current_run.clear();
-				CurX += txItem.hl->glyph.wide();
+				CurX += txItem.glyphs->wide();
 				continue;
 			}
-			if (SpecialChars::isBreak(hl->ch, true) || (hl->ch == QChar(10)))
+			if (SpecialChars::isBreak(chr, true) || (chr == QChar(10)))
 			{
 				continue;
 			}
-			if (charStyle.effects() & ScLayout_SuppressSpace)
+			if (flags & ScLayout_SuppressSpace)
 			{
 				continue;
 			}
-			if ((hl->ch == SpecialChars::OLD_NBSPACE) || (hl->ch == SpecialChars::OBJECT) || (hl->effects() & ScStyle_UserStyles))
+			if ((chr == SpecialChars::OLD_NBSPACE) || (chr == SpecialChars::OBJECT) || (charStyle.effects() & ScStyle_UserStyles))
 			{
 				specialText.append(txItem);
 				textRuns.append(current_run);
 				current_run.clear();
-				CurX += txItem.hl->glyph.wide();
+				CurX += txItem.glyphs->wide();
 				continue;
 			}
 			QString guidFont;
@@ -928,13 +933,13 @@
 			else
 			{
 				txtRunItem txItemL = current_run.last();
-				double chl = (txItemL.style.fontSize() / 10.0) * qMax(txItemL.hl->glyph.scaleV, txItemL.hl->glyph.scaleH) * conversionFactor;
+				double chl = (txItemL.style.fontSize() / 10.0) * qMax(txItemL.glyphs->scaleV, txItemL.glyphs->scaleH) * conversionFactor;
 				const ScFace* fontL = &txItemL.style.font();
 				QString guidFontL = xps_fontMap[fontL->replacementName()];
 				StyleFlag old_sty = txItemL.style.effects();
 				int old_shade = txItemL.style.fillShade();
 				QString old_fill = txItemL.style.fillColor();
-				double chs = (charStyle.fontSize() / 10.0) * qMax(hl->glyph.scaleV, hl->glyph.scaleH) * conversionFactor;
+				double chs = (charStyle.fontSize() / 10.0) * qMax(glyphs->scaleV, glyphs->scaleH) * conversionFactor;
 				if ((chs != chl) || (guidFont != guidFontL) || (charStyle.effects() != old_sty) || (charStyle.fillColor() != old_fill) || (charStyle.fillShade() != old_shade))
 				{
 					textRuns.append(current_run);
@@ -942,7 +947,7 @@
 				}
 				current_run.append(txItem);
 			}
-			CurX += txItem.hl->glyph.wide();
+			CurX += txItem.glyphs->wide();
 		}
 		textRuns.append(current_run);
 		for (int txr = 0; txr < textRuns.count(); txr++)
@@ -954,11 +959,11 @@
 				continue;
 			double StartX = current_run[0].CurX;
 			CurX = current_run[0].CurX;
-			double chs = (current_run[0].style.fontSize() / 10.0) * qMax(current_run[0].hl->glyph.scaleV, current_run[0].hl->glyph.scaleH) * conversionFactor;
+			double chs = (current_run[0].style.fontSize() / 10.0) * qMax(current_run[0].glyphs->scaleV, current_run[0].glyphs->scaleH) * conversionFactor;
 			for (int cr = 0; cr < current_run.count(); cr++)
 			{
 				txtRunItem txItem = current_run[cr];
-				if ((txItem.hl->ch == SpecialChars::PAGENUMBER) || (txItem.hl->ch == SpecialChars::PAGECOUNT))
+				if ((txItem.chr == SpecialChars::PAGENUMBER) || (txItem.chr == SpecialChars::PAGECOUNT))
 				{
 					QString exString = Item->ExpandToken(txItem.index);
 					for (int ex = 0; ex < exString.count(); ex++)
@@ -967,20 +972,20 @@
 					}
 					uniString += exString;
 				}
-				else if ((SpecialChars::isBreakingSpace(txItem.hl->ch)) || (SpecialChars::isExpandingSpace(txItem.hl->ch)) || (txItem.hl->ch.isSpace()))
+				else if ((SpecialChars::isBreakingSpace(txItem.chr)) || (SpecialChars::isExpandingSpace(txItem.chr)) || (txItem.chr.isSpace()))
 				{
-					indString += QString(",%1;").arg((txItem.hl->glyph.wide() * conversionFactor) / chs * 100);
+					indString += QString(",%1;").arg((txItem.glyphs->wide() * conversionFactor) / chs * 100);
 					uniString += " ";
 				}
 				else
 				{
-					uniString += txItem.hl->ch;
-					if ((txItem.hl->glyph.xoffset != 0) || (txItem.hl->glyph.yoffset != 0))
-						indString += QString(",%1,%2,%3;").arg((txItem.hl->glyph.wide() * conversionFactor) / chs * 100).arg((txItem.hl->glyph.xoffset * conversionFactor) / chs * 100).arg((-txItem.hl->glyph.yoffset * conversionFactor) / chs * 100);
+					uniString += txItem.chr;
+					if ((txItem.glyphs->xoffset != 0) || (txItem.glyphs->yoffset != 0))
+						indString += QString(",%1,%2,%3;").arg((txItem.glyphs->wide() * conversionFactor) / chs * 100).arg((txItem.glyphs->xoffset * conversionFactor) / chs * 100).arg((-txItem.glyphs->yoffset * conversionFactor) / chs * 100);
 					else
-						indString += QString(",%1;").arg((txItem.hl->glyph.wide() * conversionFactor) / chs * 100);
+						indString += QString(",%1;").arg((txItem.glyphs->wide() * conversionFactor) / chs * 100);
 				}
-				CurX += txItem.hl->glyph.wide();
+				CurX += txItem.glyphs->wide();
 			}
 			if (!indString.isEmpty())
 				indString.chop(1);
@@ -994,8 +999,8 @@
 			gly.setAttribute("UnicodeString", uniString);
 			if (current_run.count() == 1)
 			{
-				gly.setAttribute("OriginX", FToStr((StartX + current_run[0].hl->glyph.xoffset) * conversionFactor));
-				gly.setAttribute("OriginY", FToStr((ls.y + current_run[0].hl->glyph.yoffset) * conversionFactor));
+				gly.setAttribute("OriginX", FToStr((StartX + current_run[0].glyphs->xoffset) * conversionFactor));
+				gly.setAttribute("OriginY", FToStr((ls.y + current_run[0].glyphs->yoffset) * conversionFactor));
 			}
 			else
 			{
@@ -1009,13 +1014,13 @@
 		{
 			txtRunItem txItem = specialText[cr];
 			CurX = txItem.CurX;
-			if (txItem.hl->ch == SpecialChars::OBJECT)
-			{
-				if (txItem.hl->getItem(m_Doc))
+			if (txItem.chr == SpecialChars::OBJECT)
+			{
+				if (txItem.embItem != NULL)
 				{
 					QDomElement obO = p_docu.createElement("Canvas");
 					QTransform mm;
-					mm.translate(CurX * conversionFactor, (ls.y - (txItem.hl->getItem(m_Doc)->height() * (txItem.style.scaleV() / 1000.0))) * conversionFactor);
+					mm.translate(CurX * conversionFactor, (ls.y - (txItem.embItem->height() * (txItem.style.scaleV() / 1000.0))) * conversionFactor);
 					if (txItem.style.baselineOffset() != 0)
 						mm.translate(0, (txItem.style.baselineOffset() / 1000.0) * conversionFactor);
 					if (txItem.style.scaleH() != 1000)
@@ -1023,8 +1028,12 @@
 					if (txItem.style.scaleV() != 1000)
 						mm.scale(1, txItem.style.scaleV() / 1000.0);
 					obO.setAttribute("RenderTransform", MatrixToStr(mm));
-					QList<PageItem*> emG = txItem.hl->getGroupedItems(m_Doc);
-					for (int em = 0; em < emG.count(); ++em)
+					QList<PageItem*> emG;
+                    if (txItem.embItem->isGroup())
+                        emG = txItem.embItem->getItemList();
+                    else
+                        emG.append(txItem.embItem);
+                    for (int em = 0; em < emG.count(); ++em)
 					{
 						PageItem* embed = emG.at(em);
 						writeItemOnPage(embed->gXpos, embed->gYpos, embed, obO, rel_root);
@@ -1033,19 +1042,19 @@
 				}
 				continue;
 			}
-			QString chstr = txItem.hl->ch;
-			if ((txItem.hl->ch == SpecialChars::PAGENUMBER) || (txItem.hl->ch == SpecialChars::PAGECOUNT))
+			QString chstr = txItem.chr;
+			if ((txItem.chr == SpecialChars::PAGENUMBER) || (txItem.chr == SpecialChars::PAGECOUNT))
 				chstr = Item->ExpandToken(txItem.index);
 			double chs = txItem.style.fontSize();
-			if (txItem.hl->effects() & ScStyle_SmallCaps)
+			if (txItem.style.effects() & ScStyle_SmallCaps)
 			{
 				if (chstr.toUpper() != chstr)
 				{
-					chs = qMax(static_cast<int>(txItem.hl->fontSize() * m_Doc->typographicPrefs().valueSmallCaps / 100), 1);
+					chs = qMax(static_cast<int>(txItem.style.fontSize() * m_Doc->typographicPrefs().valueSmallCaps / 100), 1);
 					chstr = chstr.toUpper();
 				}
 			}
-			else if (txItem.hl->effects() & ScStyle_AllCaps)
+			else if (txItem.style.effects() & ScStyle_AllCaps)
 				chstr = chstr.toUpper();
 			for (int cx = 0; cx < chstr.count(); cx++)
 			{
@@ -1060,15 +1069,15 @@
 					if (pts.size() < 4)
 						continue;
 					chma = QTransform();
-					chma.scale(txItem.hl->glyph.scaleH * txItem.style.fontSize() / 100.00, txItem.hl->glyph.scaleV * txItem.style.fontSize() / 100.0);
+					chma.scale(txItem.glyphs->scaleH * txItem.style.fontSize() / 100.00, txItem.glyphs->scaleV * txItem.style.fontSize() / 100.0);
 					pts.map(chma);
-					if (txItem.hl->effects() & (ScStyle_Subscript | ScStyle_Superscript))
-						pts.translate(0, -(chs / 10.0 * txItem.hl->glyph.scaleV));
+					if (txItem.style.effects() & (ScStyle_Subscript | ScStyle_Superscript))
+						pts.translate(0, -(chs / 10.0 * txItem.glyphs->scaleV));
 					else
 						pts.translate(0, -(chs / 10.0));
 					pts.translate(CurX, ls.y);
-					if (txItem.hl->effects() & (ScStyle_Subscript | ScStyle_Superscript))
-						pts.translate(0, txItem.hl->glyph.yoffset);
+					if (txItem.style.effects() & (ScStyle_Subscript | ScStyle_Superscript))
+						pts.translate(0, txItem.glyphs->yoffset);
 					if ((txItem.style.effects() & ScStyle_Shadowed) && (txItem.style.strokeColor() != CommonStrings::None))
 					{
 						FPointArray ptsS = pts.copy();
@@ -1085,7 +1094,7 @@
 					QDomElement gly = p_docu.createElement("Path");
 					gly.setAttribute("Data", pa);
 					gly.setAttribute("Fill", SetColor(txItem.style.fillColor(), txItem.style.fillShade(), 0));
-					if (txItem.hl->effects() & ScStyle_Outline)
+					if (txItem.style.effects() & ScStyle_Outline)
 					{
 						gly.setAttribute("StrokeThickness", FToStr((chs * txItem.style.outlineWidth() / 10000.0) * conversionFactor));
 						gly.setAttribute("Stroke", SetColor(txItem.style.strokeColor(), txItem.style.strokeShade(), 0));
@@ -1112,12 +1121,12 @@
 						lw = qMax(txItem.style.font().strokeWidth(txItem.style.fontSize() / 10.0), 1.0);
 					}
 					if (txItem.style.baselineOffset() != 0)
-						st += (txItem.style.fontSize() / 10.0) * txItem.hl->glyph.scaleV * (txItem.style.baselineOffset() / 1000.0);
+						st += (txItem.style.fontSize() / 10.0) * txItem.glyphs->scaleV * (txItem.style.baselineOffset() / 1000.0);
 					QDomElement gly = p_docu.createElement("Path");
 					if (txItem.style.effects() & ScStyle_Subscript)
-						gly.setAttribute("Data", QString("M%1,%2 L%3,%4").arg((CurX + txItem.hl->glyph.xoffset) * conversionFactor).arg((ls.y + txItem.hl->glyph.yoffset - st) * conversionFactor).arg((CurX + txItem.hl->glyph.xoffset + txItem.hl->glyph.xadvance) * conversionFactor).arg((ls.y + txItem.hl->glyph.yoffset - st) * conversionFactor));
+						gly.setAttribute("Data", QString("M%1,%2 L%3,%4").arg((CurX + txItem.glyphs->xoffset) * conversionFactor).arg((ls.y + txItem.glyphs->yoffset - st) * conversionFactor).arg((CurX + txItem.glyphs->xoffset + txItem.glyphs->xadvance) * conversionFactor).arg((ls.y + txItem.glyphs->yoffset - st) * conversionFactor));
 					else
-						gly.setAttribute("Data", QString("M%1,%2 L%3,%4").arg((CurX + txItem.hl->glyph.xoffset) * conversionFactor).arg((ls.y - st) * conversionFactor).arg((CurX + txItem.hl->glyph.xoffset + txItem.hl->glyph.xadvance) * conversionFactor).arg((ls.y - st) * conversionFactor));
+						gly.setAttribute("Data", QString("M%1,%2 L%3,%4").arg((CurX + txItem.glyphs->xoffset) * conversionFactor).arg((ls.y - st) * conversionFactor).arg((CurX + txItem.glyphs->xoffset + txItem.glyphs->xadvance) * conversionFactor).arg((ls.y - st) * conversionFactor));
 					gly.setAttribute("Stroke", SetColor(txItem.style.fillColor(), txItem.style.fillShade(), 0));
 					gly.setAttribute("StrokeThickness", FToStr(lw * conversionFactor));
 					grp.appendChild(gly);
@@ -1142,9 +1151,9 @@
 						lw = qMax(txItem.style.font().strokeWidth(txItem.style.fontSize() / 10.0), 1.0);
 					}
 					if (txItem.style.baselineOffset() != 0)
-						st += (txItem.style.fontSize() / 10.0) * txItem.hl->glyph.scaleV * (txItem.style.baselineOffset() / 1000.0);
+						st += (txItem.style.fontSize() / 10.0) * txItem.glyphs->scaleV * (txItem.style.baselineOffset() / 1000.0);
 					QDomElement gly = p_docu.createElement("Path");
-					gly.setAttribute("Data", QString("M%1,%2 L%3,%4").arg((CurX + txItem.hl->glyph.xoffset) * conversionFactor).arg((ls.y - st) * conversionFactor).arg((CurX + txItem.hl->glyph.xoffset + txItem.hl->glyph.xadvance) * conversionFactor).arg((ls.y - st) * conversionFactor));
+					gly.setAttribute("Data", QString("M%1,%2 L%3,%4").arg((CurX + txItem.glyphs->xoffset) * conversionFactor).arg((ls.y - st) * conversionFactor).arg((CurX + txItem.glyphs->xoffset + txItem.glyphs->xadvance) * conversionFactor).arg((ls.y - st) * conversionFactor));
 					gly.setAttribute("Stroke", SetColor(txItem.style.fillColor(), txItem.style.fillShade(), 0));
 					gly.setAttribute("StrokeThickness", FToStr(lw * conversionFactor));
 					grp.appendChild(gly);
@@ -1253,8 +1262,13 @@
 	QString chstr;
 	for (int a = 0; a < Item->asPathText()->itemRenderText.length(); ++a)
 	{
-		ScText *hl = Item->asPathText()->itemRenderText.item_p(a);
+		//ScText *hl = Item->asPathText()->itemRenderText.item_p(a);
 		const CharStyle& charStyle(Item->asPathText()->itemRenderText.charStyle(a));
+		const PathData* pdata = &(Item->asPathText()->textLayout.point(a));
+		const GlyphLayout* glyphs = Item->asPathText()->itemRenderText.getGlyphs(a);
+        PageItem* embItem = Item->asPathText()->itemRenderText.hasObject(a)?
+                                  Item->asPathText()->itemRenderText.object(a) : NULL;
+        
 		chstr = Item->asPathText()->itemRenderText.text(a,1);
 		if ((chstr == QChar(13)) || (chstr == QChar(29)))
 			continue;
@@ -1265,53 +1279,57 @@
 				continue;
 		}
 		double chs = charStyle.fontSize();
-		if (hl->effects() & ScStyle_SmallCaps)
+		if (charStyle.effects() & ScStyle_SmallCaps)
 		{
 			if (chstr.toUpper() != chstr)
 			{
-				chs = qMax(static_cast<int>(hl->fontSize() * m_Doc->typographicPrefs().valueSmallCaps / 100), 1);
+				chs = qMax(static_cast<int>(charStyle.fontSize() * m_Doc->typographicPrefs().valueSmallCaps / 100), 1);
 				chstr = chstr.toUpper();
 			}
 		}
-		else if (hl->effects() & ScStyle_AllCaps)
+		else if (charStyle.effects() & ScStyle_AllCaps)
 			chstr = chstr.toUpper();
 		uint chr = chstr[0].unicode();
-		QPointF tangt = QPointF( cos(hl->PRot), sin(hl->PRot) );
-		QTransform trafo = QTransform( 1, 0, 0, -1, -hl->PDx * conversionFactor, 0 );
+		QPointF tangt = QPointF( cos(pdata->PRot), sin(pdata->PRot) );
+		QTransform trafo = QTransform( 1, 0, 0, -1, -pdata->PDx * conversionFactor, 0 );
 		if (Item->textPathFlipped)
 			trafo *= QTransform(1, 0, 0, -1, 0, 0);
 		if (Item->textPathType == 0)
-			trafo *= QTransform( tangt.x(), tangt.y(), tangt.y(), -tangt.x(), hl->PtransX * conversionFactor, hl->PtransY * conversionFactor );
+			trafo *= QTransform( tangt.x(), tangt.y(), tangt.y(), -tangt.x(), pdata->PtransX * conversionFactor, pdata->PtransY * conversionFactor );
 		else if (Item->textPathType == 1)
-			trafo *= QTransform(1, 0, 0, -1, hl->PtransX * conversionFactor, hl->PtransY * conversionFactor );
+			trafo *= QTransform(1, 0, 0, -1, pdata->PtransX * conversionFactor, pdata->PtransY * conversionFactor );
 		else if (Item->textPathType == 2)
 		{
 			double a = 1;
 			if (tangt.x() < 0)
 				a = -1;
 			if (fabs(tangt.x()) > 0.1)
-				trafo *= QTransform( a, (tangt.y() / tangt.x()) * a, 0, -1, hl->PtransX * conversionFactor, hl->PtransY * conversionFactor ); // ID's Skew mode
-			else
-				trafo *= QTransform( a, 4 * a, 0, -1, hl->PtransX * conversionFactor, hl->PtransY * conversionFactor );
-		}
-		if (hl->baselineOffset() != 0)
+				trafo *= QTransform( a, (tangt.y() / tangt.x()) * a, 0, -1, pdata->PtransX * conversionFactor, pdata->PtransY * conversionFactor ); // ID's Skew mode
+			else
+				trafo *= QTransform( a, 4 * a, 0, -1, pdata->PtransX * conversionFactor, pdata->PtransY * conversionFactor );
+		}
+		if (charStyle.baselineOffset() != 0)
 			trafo.translate(0, (-charStyle.fontSize() / 10.0) * (charStyle.baselineOffset() / 1000.0));
 		trafo.translate(0, Item->BaseOffs);
 		QTransform finalMat = trafo;
-		if (hl->ch == SpecialChars::OBJECT)
-		{
-			if (hl->getItem(m_Doc))
+		if (chr == SpecialChars::OBJECT)
+		{
+			if (embItem != NULL)
 			{
 				QDomElement obO = p_docu.createElement("Canvas");
 				QTransform mm = finalMat;
-				mm.translate(0, (-(hl->getItem(m_Doc)->height() * (charStyle.scaleV() / 1000.0))) * conversionFactor);
+				mm.translate(0, (-(embItem->height() * (charStyle.scaleV() / 1000.0))) * conversionFactor);
 				if (charStyle.scaleH() != 1000)
 					mm.scale(charStyle.scaleH() / 1000.0, 1);
 				if (charStyle.scaleV() != 1000)
 					mm.scale(1, charStyle.scaleV() / 1000.0);
 				obO.setAttribute("RenderTransform", MatrixToStr(mm));
-				QList<PageItem*> emG = hl->getGroupedItems(m_Doc);
-				for (int em = 0; em < emG.count(); ++em)
+				QList<PageItem*> emG;
+                if (embItem->isGroup())
+                    emG = embItem->getItemList();
+                else
+                    emG.append(embItem);
+                for (int em = 0; em < emG.count(); ++em)
 				{
 					PageItem* embed = emG.at(em);
 					writeItemOnPage(embed->gXpos, embed->gYpos, embed, obO, rel_root);
@@ -1328,14 +1346,14 @@
 		if (pts.size() < 4)
 			continue;
 		chma = QTransform();
-		chma.scale(hl->glyph.scaleH * charStyle.fontSize() / 100.00, hl->glyph.scaleV * charStyle.fontSize() / 100.0);
+		chma.scale(glyphs->scaleH * charStyle.fontSize() / 100.00, glyphs->scaleV * charStyle.fontSize() / 100.0);
 		pts.map(chma);
-		if (hl->effects() & (ScStyle_Subscript | ScStyle_Superscript))
-			pts.translate(0, -(chs / 10.0 * hl->glyph.scaleV));
+		if (charStyle.effects() & (ScStyle_Subscript | ScStyle_Superscript))
+			pts.translate(0, -(chs / 10.0 * glyphs->scaleV));
 		else
 			pts.translate(0, -(chs / 10.0));
-		if (hl->effects() & (ScStyle_Subscript | ScStyle_Superscript))
-			pts.translate(0, hl->glyph.yoffset);
+		if (charStyle.effects() & (ScStyle_Subscript | ScStyle_Superscript))
+			pts.translate(0, glyphs->yoffset);
 		if ((charStyle.effects() & ScStyle_Shadowed) && (charStyle.strokeColor() != CommonStrings::None))
 		{
 			FPointArray ptsS = pts.copy();
@@ -1352,7 +1370,7 @@
 		QDomElement gly = p_docu.createElement("Path");
 		gly.setAttribute("Data", pa);
 		gly.setAttribute("Fill", SetColor(charStyle.fillColor(), charStyle.fillShade(), 0));
-		if (hl->effects() & ScStyle_Outline)
+		if (charStyle.effects() & ScStyle_Outline)
 		{
 			gly.setAttribute("StrokeThickness", FToStr((chs * charStyle.outlineWidth() / 10000.0) * conversionFactor));
 			gly.setAttribute("Stroke", SetColor(charStyle.strokeColor(), charStyle.strokeShade(), 0));
@@ -1378,18 +1396,18 @@
 				lw = qMax(charStyle.font().strokeWidth(charStyle.fontSize() / 10.0), 1.0);
 			}
 			if (charStyle.baselineOffset() != 0)
-				st += (charStyle.fontSize() / 10.0) * hl->glyph.scaleV * (charStyle.baselineOffset() / 1000.0);
+				st += (charStyle.fontSize() / 10.0) * glyphs->scaleV * (charStyle.baselineOffset() / 1000.0);
 			FPointArray ptsS;
 			ptsS.svgInit();
 			if (charStyle.effects() & ScStyle_Subscript)
 			{
-				ptsS.svgMoveTo(hl->glyph.xoffset, hl->glyph.yoffset - st);
-				ptsS.svgLineTo(hl->glyph.xoffset + hl->glyph.xadvance, hl->glyph.yoffset - st);
-			}
-			else
-			{
-				ptsS.svgMoveTo(hl->glyph.xoffset, -st);
-				ptsS.svgLineTo(hl->glyph.xoffset + hl->glyph.xadvance, -st);
+				ptsS.svgMoveTo(glyphs->xoffset, glyphs->yoffset - st);
+				ptsS.svgLineTo(glyphs->xoffset + glyphs->xadvance, glyphs->yoffset - st);
+			}
+			else
+			{
+				ptsS.svgMoveTo(glyphs->xoffset, -st);
+				ptsS.svgLineTo(glyphs->xoffset + glyphs->xadvance, -st);
 			}
 			ptsS.map(finalMat);
 			QString paS = SetClipPath(&ptsS, true);
@@ -1419,11 +1437,11 @@
 				lw = qMax(charStyle.font().strokeWidth(charStyle.fontSize() / 10.0), 1.0);
 			}
 			if (charStyle.baselineOffset() != 0)
-				st += (charStyle.fontSize() / 10.0) * hl->glyph.scaleV * (charStyle.baselineOffset() / 1000.0);
+				st += (charStyle.fontSize() / 10.0) * glyphs->scaleV * (charStyle.baselineOffset() / 1000.0);
 			FPointArray ptsS;
 			ptsS.svgInit();
-			ptsS.svgMoveTo(hl->glyph.xoffset, -st);
-			ptsS.svgLineTo(hl->glyph.xoffset + hl->glyph.xadvance, -st);
+			ptsS.svgMoveTo(glyphs->xoffset, -st);
+			ptsS.svgLineTo(glyphs->xoffset + glyphs->xadvance, -st);
 			ptsS.map(finalMat);
 			QString paS = SetClipPath(&ptsS, true);
 			QDomElement gly = p_docu.createElement("Path");

Modified: trunk/Scribus/scribus/plugins/xpsexport/xpsexplugin.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18987&path=/trunk/Scribus/scribus/plugins/xpsexport/xpsexplugin.h
==============================================================================
--- trunk/Scribus/scribus/plugins/xpsexport/xpsexplugin.h (original)
+++ trunk/Scribus/scribus/plugins/xpsexport/xpsexplugin.h Thu Apr  3 15:08:24 2014
@@ -119,10 +119,12 @@
 	QMap<QString, QString> xps_fontMap;
 	struct txtRunItem
 	{
-		ScText* hl;
+        QChar chr;
+        GlyphLayout* glyphs;
 		CharStyle style;
 		int index;
 		double CurX;
+        PageItem* embItem;
 	};
 	double m_dpi;
 };

Modified: trunk/Scribus/scribus/pslib.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18987&path=/trunk/Scribus/scribus/pslib.cpp
==============================================================================
--- trunk/Scribus/scribus/pslib.cpp (original)
+++ trunk/Scribus/scribus/pslib.cpp Thu Apr  3 15:08:24 2014
@@ -1672,7 +1672,7 @@
 	int h, s, v, k;
 	int d;
 	int savedOwnPage;
-	ScText *hl;
+	//ScText *hl;
 	QVector<double> dum;
 	QChar chstr;
 	QString tmps;
@@ -2165,23 +2165,29 @@
 			c->OwnPage = savedOwnPage;
 			for (d = 0; d < c->maxCharsInFrame(); ++d)
 			{
-                hl = c->asPathText()->itemRenderText.item_p(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)))
+                // hl = c->asPathText()->itemRenderText.item_p(d);
+				chstr = c->asPathText()->itemRenderText.text(d);
+				if ((chstr == QChar(13)) || (chstr == QChar(30)) || (chstr == QChar(9)) || (chstr == QChar(28)))
 					continue;
-				QPointF tangt = QPointF( cos(hl->PRot), sin(hl->PRot) );
+                
+                const CharStyle & style(c->asPathText()->itemRenderText.charStyle(d));
+				const PathData& pdata(c->textLayout.point(d));
+                const GlyphLayout* glyphs(c->asPathText()->itemRenderText.getGlyphs(d));
+                PageItem* embItem = c->asPathText()->itemRenderText.hasObject(d)?
+                                          c->asPathText()->itemRenderText.object(d) : NULL;
+                
+				QPointF tangt = QPointF( cos(pdata.PRot), sin(pdata.PRot) );
 				tsz = style.fontSize();
-				chstr = hl->ch;
-				if (hl->ch == QChar(29))
+				if (chstr == QChar(29))
 					chstr = ' ';
-				if (hl->ch == QChar(0xA0))
+				if (chstr == QChar(0xA0))
 					chstr = ' ';
-				if (style.effects() & 32)
+				if (style.effects() & ScStyle_AllCaps)
 				{
 					if (chstr.toUpper() != chstr)
 						chstr = chstr.toUpper();
 				}
-				if (style.effects() & 64)
+				if (style.effects() & ScStyle_SmallCaps)
 				{
 					if (chstr.toUpper() != chstr)
 					{
@@ -2189,28 +2195,28 @@
 						chstr = chstr.toUpper();
 					}
 				}
-				if (style.effects() & 1)
+				if (style.effects() & ScStyle_Superscript)
 					tsz = style.fontSize() * Doc->typographicPrefs().scalingSuperScript / 100;
-				if (style.effects() & 2)
+				if (style.effects() & ScStyle_Subscript)
 					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(Doc))
+				if (embItem != NULL)
 				{
 					PS_save();
-					PutStream( MatrixToStr(1.0, 0.0, 0.0, -1.0, -hl->PDx, 0.0) + "\n");
+					PutStream( MatrixToStr(1.0, 0.0, 0.0, -1.0, -pdata.PDx, 0.0) + "\n");
 					if (c->textPathFlipped)
 					{
 						PutStream("[1 0 0 -1 0 0]\n");
 						PutStream("[0 0 0  0 0 0] concatmatrix\n"); //???????
 					}
 					if (c->textPathType == 0)
-						PutStream( MatrixToStr(tangt.x(), -tangt.y(), -tangt.y(), -tangt.x(), hl->PtransX, -hl->PtransY) + "\n");
+						PutStream( MatrixToStr(tangt.x(), -tangt.y(), -tangt.y(), -tangt.x(), pdata.PtransX, -pdata.PtransY) + "\n");
 					else if (c->textPathType == 1)
-						PutStream( MatrixToStr(1.0, 0.0, 0.0, -1.0, hl->PtransX, -hl->PtransY) + "\n");
+						PutStream( MatrixToStr(1.0, 0.0, 0.0, -1.0, pdata.PtransX, -pdata.PtransY) + "\n");
 					else if (c->textPathType == 2)
 					{
 						double a = 1;
@@ -2221,9 +2227,9 @@
 							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");
+							PutStream( MatrixToStr(a, (tangt.y() / tangt.x()) * b, 0.0, -1.0, pdata.PtransX, -pdata.PtransY) + "\n");
 						else
-							PutStream( MatrixToStr(a, 4.0, 0.0, -1.0, hl->PtransX, -hl->PtransY) + "\n");
+							PutStream( MatrixToStr(a, 4.0, 0.0, -1.0, pdata.PtransX, -pdata.PtransY) + "\n");
 					}
 					PutStream("[0.0 0.0 0.0 0.0 0.0 0.0] concatmatrix\nconcat\n");
 //					PS_translate(0, (tsz / 10.0));
@@ -2231,7 +2237,11 @@
 						PS_translate(0, -c->BaseOffs);
 					if (style.scaleH() != 1000)
 						PS_scale(style.scaleH() / 1000.0, 1);
-					QList<PageItem*> emG = hl->getGroupedItems(Doc);
+					QList<PageItem*> emG;
+                    if (embItem->isGroup())
+                        emG = embItem->getItemList();
+                    else
+                        emG.append(embItem);
 					for (int em = 0; em < emG.count(); ++em)
 					{
 						PageItem* embedded = emG.at(em);
@@ -2259,16 +2269,16 @@
 						PS_save();
 						if (style.fillColor() != CommonStrings::None)
 						{
-							PutStream( MatrixToStr(1.0, 0.0, 0.0, -1.0, -hl->PDx, 0.0) + "\n");
+							PutStream( MatrixToStr(1.0, 0.0, 0.0, -1.0, -pdata.PDx, 0.0) + "\n");
 							if (c->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 (c->textPathType == 0)
-								PutStream( MatrixToStr(tangt.x(), -tangt.y(), -tangt.y(), -tangt.x(), hl->PtransX, -hl->PtransY) + "\n");
+								PutStream( MatrixToStr(tangt.x(), -tangt.y(), -tangt.y(), -tangt.x(), pdata.PtransX, -pdata.PtransY) + "\n");
 							else if (c->textPathType == 1)
-								PutStream( MatrixToStr(1.0, 0.0, 0.0, -1.0, hl->PtransX, -hl->PtransY) + "\n");
+								PutStream( MatrixToStr(1.0, 0.0, 0.0, -1.0, pdata.PtransX, -pdata.PtransY) + "\n");
 							else if (c->textPathType == 2)
 							{
 								double a = 1;
@@ -2279,16 +2289,16 @@
 									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");
+									PutStream( MatrixToStr(a, (tangt.y() / tangt.x()) * b, 0.0, -1.0, pdata.PtransX, -pdata.PtransY) + "\n");
 								else
-									PutStream( MatrixToStr(a, 4.0, 0.0, -1.0, hl->PtransX, -hl->PtransY) + "\n");
+									PutStream( MatrixToStr(a, 4.0, 0.0, -1.0, pdata.PtransX, -pdata.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 (c->BaseOffs != 0)
 								PS_translate(0, -c->BaseOffs);
-							if (hl->glyph.xoffset !=0 || hl->glyph.yoffset != 0)
-								PS_translate(hl->glyph.xoffset, -hl->glyph.yoffset);
+							if (glyphs->xoffset !=0 || glyphs->yoffset != 0)
+								PS_translate(glyphs->xoffset, -glyphs->yoffset);
 							if (style.scaleH() != 1000)
 								PS_scale(style.scaleH() / 1000.0, 1);
 							if (((style.effects() & ScStyle_Underline) && !SpecialChars::isBreak(chstr)) //FIXME && (chstr != QChar(13)))  
@@ -2296,7 +2306,7 @@
 							{
 								PS_save();
 								PS_translate(0, -(tsz / 10.0));
-								double Ulen = hl->glyph.xadvance;
+								double Ulen = glyphs->xadvance;
 								double Upos, Uwid;
 								if ((style.underlineOffset() != -1) || (style.underlineWidth() != -1))
 								{
@@ -2315,7 +2325,7 @@
 									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);
+									Upos += (style.fontSize() / 10.0) * glyphs->scaleV * (style.baselineOffset() / 1000.0);
 								if (style.fillColor() != CommonStrings::None)
 								{
 									SetColor(style.fillColor(), style.fillShade(), &h, &s, &v, &k, gcr);
@@ -2324,13 +2334,13 @@
 								PS_setlinewidth(Uwid);
 								if (style.effects() & ScStyle_Subscript)
 								{
-									PS_moveto(hl->glyph.xoffset     , Upos);
-									PS_lineto(hl->glyph.xoffset+Ulen, Upos);
+									PS_moveto(glyphs->xoffset     , Upos);
+									PS_lineto(glyphs->xoffset+Ulen, Upos);
 								}
 								else
 								{
-									PS_moveto(hl->glyph.xoffset     , hl->glyph.yoffset+Upos);
-									PS_lineto(hl->glyph.xoffset+Ulen, hl->glyph.yoffset+Upos);
+									PS_moveto(glyphs->xoffset     , glyphs->yoffset+Upos);
+									PS_lineto(glyphs->xoffset+Ulen, glyphs->yoffset+Upos);
 								}
 								putColor(style.fillColor(), style.fillShade(), false);
 								PS_restore();
@@ -2363,7 +2373,7 @@
 							{
 								PS_save();
 								PS_translate(0, -(tsz / 10.0));
-								double Ulen = hl->glyph.xadvance;
+								double Ulen = glyphs->xadvance;
 								double Upos, Uwid;
 								if ((style.strikethruOffset() != -1) || (style.strikethruWidth() != -1))
 								{
@@ -2382,15 +2392,15 @@
 									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);
+									Upos += (style.fontSize() / 10.0) * glyphs->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);
+								PS_moveto(glyphs->xoffset     , Upos);
+								PS_lineto(glyphs->xoffset+Ulen, Upos);
 								putColor(style.fillColor(), style.fillShade(), false);
 								PS_restore();
 							}
@@ -2400,19 +2410,19 @@
 				}
 				else
 				{
-					uint glyph = hl->glyph.glyph;
+					uint glyph = glyphs->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");
+					PutStream( MatrixToStr(1.0, 0.0, 0.0, -1.0, -pdata.PDx, 0.0) + "\n");
 					if (c->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 (c->textPathType == 0)
-						PutStream( MatrixToStr(tangt.x(), -tangt.y(), -tangt.y(), -tangt.x(), hl->PtransX, -hl->PtransY) + "\n");
+						PutStream( MatrixToStr(tangt.x(), -tangt.y(), -tangt.y(), -tangt.x(), pdata.PtransX, -pdata.PtransY) + "\n");
 					else if (c->textPathType == 1)
-						PutStream( MatrixToStr(1.0, 0.0, 0.0, -1.0, hl->PtransX, -hl->PtransY) + "\n");
+						PutStream( MatrixToStr(1.0, 0.0, 0.0, -1.0, pdata.PtransX, -pdata.PtransY) + "\n");
 					else if (c->textPathType == 2)
 					{
 						double a = 1;
@@ -2423,20 +2433,20 @@
 							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");
+							PutStream( MatrixToStr(a, (tangt.y() / tangt.x()) * b, 0.0, -1.0, pdata.PtransX, -pdata.PtransY) + "\n");
 						else
-							PutStream( MatrixToStr(a, 4.0, 0.0, -1.0, hl->PtransX, -hl->PtransY) + "\n");
+							PutStream( MatrixToStr(a, 4.0, 0.0, -1.0, pdata.PtransX, -pdata.PtransY) + "\n");
 					}
 					PutStream("[0.0 0.0 0.0 0.0 0.0 0.0] concatmatrix\nconcat\n");
 					if (c->BaseOffs != 0)
 						PS_translate(0, -c->BaseOffs);
-					if (hl->glyph.xoffset !=0 || hl->glyph.yoffset != 0)
-						PS_translate(hl->glyph.xoffset, -hl->glyph.yoffset);
+					if (glyphs->xoffset !=0 || glyphs->yoffset != 0)
+						PS_translate(glyphs->xoffset, -glyphs->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 Ulen = glyphs->xadvance;
 						double Upos, Uwid;
 						if ((style.underlineOffset() != -1) || (style.underlineWidth() != -1))
 						{
@@ -2455,7 +2465,7 @@
 							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);
+							Upos += (style.fontSize() / 10.0) * glyphs->scaleV * (style.baselineOffset() / 1000.0);
 						if (style.fillColor() != CommonStrings::None)
 						{
 							SetColor(style.fillColor(), style.fillShade(), &h, &s, &v, &k, gcr);
@@ -2464,13 +2474,13 @@
 						PS_setlinewidth(Uwid);
 						if (style.effects() & ScStyle_Subscript)
 						{
-							PS_moveto(hl->glyph.xoffset     , Upos);
-							PS_lineto(hl->glyph.xoffset+Ulen, Upos);
+							PS_moveto(glyphs->xoffset     , Upos);
+							PS_lineto(glyphs->xoffset+Ulen, Upos);
 						}
 						else
 						{
-							PS_moveto(hl->glyph.xoffset     , hl->glyph.yoffset+Upos);
-							PS_lineto(hl->glyph.xoffset+Ulen, hl->glyph.yoffset+Upos);
+							PS_moveto(glyphs->xoffset     , glyphs->yoffset+Upos);
+							PS_lineto(glyphs->xoffset+Ulen, glyphs->yoffset+Upos);
 						}
 						putColor(style.fillColor(), style.fillShade(), false);
 						PS_restore();
@@ -2509,7 +2519,7 @@
 					if ((style.effects() & ScStyle_Strikethrough) && (chstr != SpecialChars::PARSEP))
 					{
 						PS_save();
-						double Ulen = hl->glyph.xadvance;
+						double Ulen = glyphs->xadvance;
 						double Upos, Uwid;
 						if ((style.strikethruOffset() != -1) || (style.strikethruWidth() != -1))
 						{
@@ -2528,7 +2538,7 @@
 							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);
+							Upos += (style.fontSize() / 10.0) * glyphs->scaleV * (style.baselineOffset() / 1000.0);
 						if (style.fillColor() != CommonStrings::None)
 						if (style.fillColor() != CommonStrings::None)
 						{
@@ -2536,8 +2546,8 @@
 							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);
+						PS_moveto(glyphs->xoffset     , Upos);
+						PS_lineto(glyphs->xoffset+Ulen, Upos);
 						putColor(style.fillColor(), style.fillShade(), false);
 						PS_restore();
 					}
@@ -3216,7 +3226,7 @@
 			{
 				double tsz;
 				int d;
-				ScText *hl;
+				//ScText *hl;
 				QChar chstr;
 				PS_save();
 				PS_translate(ite->xPos() - mPage->xOffset(), mPage->height() - (ite->yPos() - mPage->yOffset()));
@@ -3269,23 +3279,28 @@
 				ite->OwnPage = savedOwnPage;
 				for (d = 0; d < ite->maxCharsInFrame(); ++d)
 				{
-                    hl = ite->asPathText()->itemRenderText.item_p(d);
+                    //hl = ite->asPathText()->itemRenderText.item_p(d);
+					chstr = ite->asPathText()->itemRenderText.text(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)))
+					if ((chstr == QChar(13)) || (chstr == QChar(30)) || (chstr == QChar(9)) || (chstr == QChar(28)))
 						continue;
-					QPointF tangt = QPointF( cos(hl->PRot), sin(hl->PRot) );
+                    const PathData& pdata(ite->textLayout.point(d));
+                    const GlyphLayout* glyphs(ite->asPathText()->itemRenderText.getGlyphs(d));
+                    PageItem* embItem = ite->asPathText()->itemRenderText.hasObject(d)?
+                                              ite->asPathText()->itemRenderText.object(d) : NULL;
+                    
+					QPointF tangt = QPointF( cos(pdata.PRot), sin(pdata.PRot) );
 					tsz = style.fontSize();
-					chstr = hl->ch;
-					if (hl->ch == QChar(29))
+					if (chstr == QChar(29))
 						chstr = ' ';
-					if (hl->ch == QChar(0xA0))
+					if (chstr == QChar(0xA0))
 						chstr = ' ';
-					if (style.effects() & 32)
+					if (style.effects() & ScStyle_AllCaps)
 					{
 						if (chstr.toUpper() != chstr)
 							chstr = chstr.toUpper();
 					}
-					if (style.effects() & 64)
+					if (style.effects() & ScStyle_SmallCaps)
 					{
 						if (chstr.toUpper() != chstr)
 						{
@@ -3293,28 +3308,28 @@
 							chstr = chstr.toUpper();
 						}
 					}
-					if (style.effects() & 1)
+					if (style.effects() & ScStyle_Superscript)
 						tsz = style.fontSize() * Doc->typographicPrefs().scalingSuperScript / 100;
-					if (style.effects() & 2)
+					if (style.effects() & ScStyle_Subscript)
 						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(Doc))
+					if (embItem != NULL)
 					{
 						PS_save();
-						PutStream( MatrixToStr(1.0, 0.0, 0.0, -1.0, -hl->PDx, 0.0) + "\n");
+						PutStream( MatrixToStr(1.0, 0.0, 0.0, -1.0, -pdata.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");
+							PutStream( MatrixToStr(tangt.x(), -tangt.y(), -tangt.y(), -tangt.x(), pdata.PtransX, -pdata.PtransY) + "\n");
 						else if (ite->textPathType == 1)
-							PutStream( MatrixToStr(1.0, 0.0, 0.0, -1.0, hl->PtransX, -hl->PtransY) + "\n");
+							PutStream( MatrixToStr(1.0, 0.0, 0.0, -1.0, pdata.PtransX, -pdata.PtransY) + "\n");
 						else if (ite->textPathType == 2)
 						{
 							double a = 1;
@@ -3325,9 +3340,9 @@
 								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");
+								PutStream( MatrixToStr(a, (tangt.y() / tangt.x()) * b, 0.0, -1.0, pdata.PtransX, -pdata.PtransY) + "\n");
 							else
-								PutStream( MatrixToStr(a, 4.0, 0.0, -1.0, hl->PtransX, -hl->PtransY) + "\n");
+								PutStream( MatrixToStr(a, 4.0, 0.0, -1.0, pdata.PtransX, -pdata.PtransY) + "\n");
 						}
 						PutStream("[0.0 0.0 0.0 0.0 0.0 0.0] concatmatrix\nconcat\n");
 	//					PS_translate(0, (tsz / 10.0));
@@ -3335,8 +3350,12 @@
 							PS_translate(0, -ite->BaseOffs);
 						if (style.scaleH() != 1000)
 							PS_scale(style.scaleH() / 1000.0, 1);
-						QList<PageItem*> emG = hl->getGroupedItems(Doc);
-						for (int em = 0; em < emG.count(); ++em)
+						QList<PageItem*> emG;
+                        if (embItem->isGroup())
+                            emG = embItem->getItemList();
+                        else
+                            emG.append(embItem);
+                        for (int em = 0; em < emG.count(); ++em)
 						{
 							PageItem* embedded = emG.at(em);
 							PS_save();
@@ -3363,16 +3382,16 @@
 							PS_save();
 							if (style.fillColor() != CommonStrings::None)
 							{
-								PutStream( MatrixToStr(1.0, 0.0, 0.0, -1.0, -hl->PDx, 0.0) + "\n");
+								PutStream( MatrixToStr(1.0, 0.0, 0.0, -1.0, -pdata.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");
+									PutStream( MatrixToStr(tangt.x(), -tangt.y(), -tangt.y(), -tangt.x(), pdata.PtransX, -pdata.PtransY) + "\n");
 								else if (ite->textPathType == 1)
-									PutStream( MatrixToStr(1.0, 0.0, 0.0, -1.0, hl->PtransX, -hl->PtransY) + "\n");
+									PutStream( MatrixToStr(1.0, 0.0, 0.0, -1.0, pdata.PtransX, -pdata.PtransY) + "\n");
 								else if (ite->textPathType == 2)
 								{
 									double a = 1;
@@ -3383,16 +3402,16 @@
 										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");
+										PutStream( MatrixToStr(a, (tangt.y() / tangt.x()) * b, 0.0, -1.0, pdata.PtransX, -pdata.PtransY) + "\n");
 									else
-										PutStream( MatrixToStr(a, 4.0, 0.0, -1.0, hl->PtransX, -hl->PtransY) + "\n");
+										PutStream( MatrixToStr(a, 4.0, 0.0, -1.0, pdata.PtransX, -pdata.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 (glyphs->xoffset !=0 || glyphs->yoffset != 0)
+									PS_translate(glyphs->xoffset, -glyphs->yoffset);
 								if (style.scaleH() != 1000)
 									PS_scale(style.scaleH() / 1000.0, 1);
 								if (((style.effects() & ScStyle_Underline) && !SpecialChars::isBreak(chstr)) //FIXME && (chstr != QChar(13)))
@@ -3400,7 +3419,7 @@
 								{
 									PS_save();
 									PS_translate(0, -(tsz / 10.0));
-									double Ulen = hl->glyph.xadvance;
+									double Ulen = glyphs->xadvance;
 									double Upos, Uwid;
 									if ((style.underlineOffset() != -1) || (style.underlineWidth() != -1))
 									{
@@ -3419,7 +3438,7 @@
 										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);
+										Upos += (style.fontSize() / 10.0) * glyphs->scaleV * (style.baselineOffset() / 1000.0);
 									if (style.fillColor() != CommonStrings::None)
 									{
 										SetColor(style.fillColor(), style.fillShade(), &h, &s, &v, &k, gcr);
@@ -3428,13 +3447,13 @@
 									PS_setlinewidth(Uwid);
 									if (style.effects() & ScStyle_Subscript)
 									{
-										PS_moveto(hl->glyph.xoffset     , Upos);
-										PS_lineto(hl->glyph.xoffset+Ulen, Upos);
+										PS_moveto(glyphs->xoffset     , Upos);
+										PS_lineto(glyphs->xoffset+Ulen, Upos);
 									}
 									else
 									{
-										PS_moveto(hl->glyph.xoffset     , hl->glyph.yoffset+Upos);
-										PS_lineto(hl->glyph.xoffset+Ulen, hl->glyph.yoffset+Upos);
+										PS_moveto(glyphs->xoffset     , glyphs->yoffset+Upos);
+										PS_lineto(glyphs->xoffset+Ulen, glyphs->yoffset+Upos);
 									}
 									putColor(style.fillColor(), style.fillShade(), false);
 									PS_restore();
@@ -3467,7 +3486,7 @@
 								{
 									PS_save();
 									PS_translate(0, -(tsz / 10.0));
-									double Ulen = hl->glyph.xadvance;
+									double Ulen = glyphs->xadvance;
 									double Upos, Uwid;
 									if ((style.strikethruOffset() != -1) || (style.strikethruWidth() != -1))
 									{
@@ -3486,15 +3505,15 @@
 										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);
+										Upos += (style.fontSize() / 10.0) * glyphs->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);
+									PS_moveto(glyphs->xoffset     , Upos);
+									PS_lineto(glyphs->xoffset+Ulen, Upos);
 									putColor(style.fillColor(), style.fillShade(), false);
 									PS_restore();
 								}
@@ -3504,19 +3523,19 @@
 					}
 					else
 					{
-						uint glyph = hl->glyph.glyph;
+						uint glyph = glyphs->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");
+						PutStream( MatrixToStr(1.0, 0.0, 0.0, -1.0, -pdata.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");
+							PutStream( MatrixToStr(tangt.x(), -tangt.y(), -tangt.y(), -tangt.x(), pdata.PtransX, -pdata.PtransY) + "\n");
 						else if (ite->textPathType == 1)
-							PutStream( MatrixToStr(1.0, 0.0, 0.0, -1.0, hl->PtransX, -hl->PtransY) + "\n");
+							PutStream( MatrixToStr(1.0, 0.0, 0.0, -1.0, pdata.PtransX, -pdata.PtransY) + "\n");
 						else if (ite->textPathType == 2)
 						{
 							double a = 1;
@@ -3527,20 +3546,20 @@
 								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");
+								PutStream( MatrixToStr(a, (tangt.y() / tangt.x()) * b, 0.0, -1.0, pdata.PtransX, -pdata.PtransY) + "\n");
 							else
-								PutStream( MatrixToStr(a, 4.0, 0.0, -1.0, hl->PtransX, -hl->PtransY) + "\n");
+								PutStream( MatrixToStr(a, 4.0, 0.0, -1.0, pdata.PtransX, -pdata.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 (glyphs->xoffset !=0 || glyphs->yoffset != 0)
+							PS_translate(glyphs->xoffset, -glyphs->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 Ulen = glyphs->xadvance;
 							double Upos, Uwid;
 							if ((style.underlineOffset() != -1) || (style.underlineWidth() != -1))
 							{
@@ -3559,7 +3578,7 @@
 								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);
+								Upos += (style.fontSize() / 10.0) * glyphs->scaleV * (style.baselineOffset() / 1000.0);
 							if (style.fillColor() != CommonStrings::None)
 							{
 								SetColor(style.fillColor(), style.fillShade(), &h, &s, &v, &k, gcr);
@@ -3568,13 +3587,13 @@
 							PS_setlinewidth(Uwid);
 							if (style.effects() & ScStyle_Subscript)
 							{
-								PS_moveto(hl->glyph.xoffset     , Upos);
-								PS_lineto(hl->glyph.xoffset+Ulen, Upos);
+								PS_moveto(glyphs->xoffset     , Upos);
+								PS_lineto(glyphs->xoffset+Ulen, Upos);
 							}
 							else
 							{
-								PS_moveto(hl->glyph.xoffset     , hl->glyph.yoffset+Upos);
-								PS_lineto(hl->glyph.xoffset+Ulen, hl->glyph.yoffset+Upos);
+								PS_moveto(glyphs->xoffset     , glyphs->yoffset+Upos);
+								PS_lineto(glyphs->xoffset+Ulen, glyphs->yoffset+Upos);
 							}
 							putColor(style.fillColor(), style.fillShade(), false);
 							PS_restore();
@@ -3613,7 +3632,7 @@
 						if ((style.effects() & ScStyle_Strikethrough) && (chstr != SpecialChars::PARSEP))
 						{
 							PS_save();
-							double Ulen = hl->glyph.xadvance;
+							double Ulen = glyphs->xadvance;
 							double Upos, Uwid;
 							if ((style.strikethruOffset() != -1) || (style.strikethruWidth() != -1))
 							{
@@ -3632,7 +3651,7 @@
 								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);
+								Upos += (style.fontSize() / 10.0) * glyphs->scaleV * (style.baselineOffset() / 1000.0);
 							if (style.fillColor() != CommonStrings::None)
 							if (style.fillColor() != CommonStrings::None)
 							{
@@ -3640,8 +3659,8 @@
 								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);
+							PS_moveto(glyphs->xoffset     , Upos);
+							PS_lineto(glyphs->xoffset+Ulen, Upos);
 							putColor(style.fillColor(), style.fillShade(), false);
 							PS_restore();
 						}
@@ -5051,78 +5070,92 @@
 	if (ite->lineColor() != CommonStrings::None)
 		tabDist += ite->lineWidth() / 2.0;
 
-	for (uint ll=0; ll < ite->itemText.lines(); ++ll) {
-		LineSpec ls = ite->itemText.line(ll);
+	for (uint ll=0; ll < ite->textLayout.lines(); ++ll) {
+		LineSpec ls = ite->textLayout.line(ll);
 		tabDist = ls.x;
 		double CurX = ls.x;
 
 		for (int d = ls.firstItem; d <= ls.lastItem; ++d)
 		{
-            ScText *hl = ite->itemText.item_p(d);
+            //ScText *hl = ite->itemText.item_p(d);
+            QChar chr = ite->itemText.text(d);
 			const CharStyle & cstyle(ite->itemText.charStyle(d));
 			const ParagraphStyle& pstyle(ite->itemText.paragraphStyle(d));
-			
+			const GlyphLayout* glyphs(ite->itemText.getGlyphs(d));
+            LayoutFlags flags = ite->itemText.flags(d);
+            
 //			if ((hl->ch == QChar(13)) || (hl->ch == QChar(10)) || (hl->ch == QChar(28)) || (hl->ch == QChar(27)) || (hl->ch == QChar(26)))
 //				continue;
-			if (hl->effects() & ScLayout_SuppressSpace)
+			if (flags & ScLayout_SuppressSpace)
 				continue;
 			tTabValues = pstyle.tabValues();
-			if (hl->effects() & ScLayout_StartOfLine)
+			if (flags & ScLayout_StartOfLine)
 				tabCc = 0;
-			if ((hl->ch == SpecialChars::TAB) && (tTabValues.count() != 0))
+			if ((chr == SpecialChars::TAB) && (tTabValues.count() != 0))
 			{
 				QChar tabFillChar;
-				const TabLayout* tabLayout = dynamic_cast<const TabLayout*>(hl->glyph.more);
+				const TabLayout* tabLayout = dynamic_cast<const TabLayout*>(glyphs->more);
 				if (tabLayout)
 					tabFillChar = tabLayout->fillChar;
 				if (!tabFillChar.isNull())
 				{
-					ScText hl2;
-					static_cast<CharStyle&>(hl2) = static_cast<const CharStyle&>(*hl);
-					const GlyphLayout * const gl = hl->glyph.more;
+					//ScText hl2;
+					//static_cast<CharStyle&>(hl2) = static_cast<const CharStyle&>(*hl);
+					const GlyphLayout * const gl = glyphs->more;
 					double scale = gl ? gl->scaleV : 1.0;
 					double wt    = cstyle.font().charWidth(tabFillChar, cstyle.fontSize() * scale / 10.0);
-					double len   = hl->glyph.xadvance;
+					double len   = glyphs->xadvance;
 					int coun     = static_cast<int>(len / wt);
 					// JG - #6728 : update code according to fillInTabLeaders() and PageItem::layout()
 					double sPos  = 0.0 /*CurX - len + cstyle.fontSize() / 10.0 * 0.7 + 1*/;
-					hl2.ch = tabFillChar;
-					hl2.setTracking(0);
-					hl2.setScaleH(1000);
-					hl2.setScaleV(1000);
-					hl2.glyph.glyph   = cstyle.font().char2CMap(tabFillChar);
-					hl2.glyph.yoffset = hl->glyph.yoffset;
+					//hl2.ch = tabFillChar;
+					//hl2.setTracking(0);
+					//hl2.setScaleH(1000);
+					//hl2.setScaleV(1000);
+					//hl2.glyph.glyph   = cstyle.font().char2CMap(tabFillChar);
+					//hl2.glyph.yoffset = glyphs->yoffset;
+                    
+                    GlyphLayout gl2 = *gl;
+                    gl2.glyph   = cstyle.font().char2CMap(tabFillChar);
+                    gl2.yoffset = glyphs->yoffset;
+                    
+                    CharStyle shadow(cstyle);
+                    shadow.setFillColor(cstyle.strokeColor());
+                    
 					for (int cx = 0; cx < coun; ++cx)
 					{
-						hl2.glyph.xoffset =  sPos + wt * cx;
-						if ((hl2.effects() & 256) && (hl2.strokeColor() != CommonStrings::None))
+						gl2.xoffset =  sPos + wt * cx;
+						if ((cstyle.effects() & ScStyle_Shadowed) && (cstyle.strokeColor() != CommonStrings::None))
 						{
-							ScText hl3;
-							static_cast<CharStyle&>(hl3) = static_cast<const CharStyle&>(hl2);
-							hl3.ch = hl2.ch;
-							hl3.glyph.glyph = hl2.glyph.glyph;
-							hl3.setFillColor(hl2.strokeColor());
-							hl3.glyph.yoffset = hl2.glyph.yoffset - (hl2.fontSize() * hl2.shadowYOffset() / 10000.0);
-							hl3.glyph.xoffset = hl2.glyph.xoffset + (hl2.fontSize() * hl2.shadowXOffset() / 10000.0);
-							setTextCh(Doc, ite, CurX, ls.y, gcr, argh, d, &hl3, pstyle, pg, sep, farb, ic, master);
+							//ScText hl3;
+							//static_cast<CharStyle&>(hl3) = static_cast<const CharStyle&>(hl2);
+							//hl3.ch = hl2.ch;
+							//hl3.glyph.glyph = hl2.glyph.glyph;
+							//hl3.setFillColor(hl2.strokeColor());
+							//hl3.glyph.yoffset = hl2.glyph.yoffset - (hl2.fontSize() * hl2.shadowYOffset() / 10000.0);
+							//hl3.glyph.xoffset = hl2.glyph.xoffset + (hl2.fontSize() * hl2.shadowXOffset() / 10000.0);
+							GlyphLayout gl3 = gl2;
+                            gl3.yoffset = gl2.yoffset - (cstyle.fontSize() * cstyle.shadowYOffset() / 10000.0);
+							gl3.xoffset = gl2.xoffset + (cstyle.fontSize() * cstyle.shadowXOffset() / 10000.0);
+							setTextCh(Doc, ite, CurX, ls.y, gcr, argh, d, tabFillChar, &gl3, shadow, pstyle, pg, sep, farb, ic, master);
 						}
-						setTextCh(Doc, ite, CurX, ls.y, gcr, argh, d, &hl2, pstyle, pg, sep, farb, ic, master);
+						setTextCh(Doc, ite, CurX, ls.y, gcr, argh, d, tabFillChar, &gl2, cstyle, pstyle, pg, sep, farb, ic, master);
 					}
 				}
 				tabCc++;
 			}
-			if (hl->ch == SpecialChars::TAB) {
-				CurX += hl->glyph.wide();
+			if (chr == SpecialChars::TAB) {
+				CurX += glyphs->wide();
 				continue;
 			}
 			if ((cstyle.effects() & ScStyle_Shadowed) && (cstyle.strokeColor() != CommonStrings::None))
 			{
-				ScText hl2;
-				static_cast<CharStyle&>(hl2) = static_cast<const CharStyle&>(*hl);
-				hl2.ch = hl->ch;
-				hl2.glyph.glyph = hl->glyph.glyph;
-				const GlyphLayout *gl1 = &hl->glyph;
-				GlyphLayout	*gl2 = &hl2.glyph;
+				//ScText hl2;
+				//static_cast<CharStyle&>(hl2) = static_cast<const CharStyle&>(*hl);
+				//hl2.ch = chr;
+				//hl2.glyph.glyph = glyphs->glyph;
+				const GlyphLayout *gl1 = glyphs;
+				GlyphLayout* gl2 = new GlyphLayout(*gl1);
 				while (gl1->more)
 				{
 					gl2->more = new GlyphLayout(*gl1->more);
@@ -5132,36 +5165,38 @@
 					gl1 = gl1->more;
 					gl2 = gl2->more;
 				}
-				hl2.setFillColor(cstyle.strokeColor());
-				hl2.setFillShade(cstyle.strokeShade());
-				hl2.glyph.xadvance = hl->glyph.xadvance;
-				hl2.glyph.yadvance = hl->glyph.yadvance;
-				hl2.glyph.yoffset = hl->glyph.yoffset - (cstyle.fontSize() * cstyle.shadowYOffset() / 10000.0);
-				hl2.glyph.xoffset = hl->glyph.xoffset + (cstyle.fontSize() * cstyle.shadowXOffset() / 10000.0);
-				hl2.glyph.scaleH = hl->glyph.scaleH;
-				hl2.glyph.scaleV = hl->glyph.scaleV;
+                CharStyle shadowed(cstyle);
+				shadowed.setFillColor(cstyle.strokeColor());
+				shadowed.setFillShade(cstyle.strokeShade());
+				gl2->xadvance = glyphs->xadvance;
+				gl2->yadvance = glyphs->yadvance;
+				gl2->yoffset = glyphs->yoffset - (cstyle.fontSize() * cstyle.shadowYOffset() / 10000.0);
+				gl2->xoffset = glyphs->xoffset + (cstyle.fontSize() * cstyle.shadowXOffset() / 10000.0);
+				gl2->scaleH = glyphs->scaleH;
+				gl2->scaleV = glyphs->scaleV;
 				
-				setTextCh(Doc, ite, CurX, ls.y, gcr, argh, d, &hl2, pstyle, pg, sep, farb, ic, master);
-			}
-			setTextCh(Doc, ite, CurX, ls.y, gcr, argh, d, hl, pstyle, pg, sep, farb, ic, master);
+				setTextCh(Doc, ite, CurX, ls.y, gcr, argh, d, chr, gl2, shadowed, pstyle, pg, sep, farb, ic, master);
+			}
+			setTextCh(Doc, ite, CurX, ls.y, gcr, argh, d, chr, glyphs, cstyle, pstyle, pg, sep, farb, ic, master);
 			// Unneeded now that glyph xadvance is set appropriately for inline objects by PageItem_TextFrame::layout() - JG
 			/*if (hl->ch == SpecialChars::OBJECT)
 			{
 				InlineFrame& embedded(const_cast<InlineFrame&>(hl->embedded));
-				CurX += (embedded.getItem()->gWidth + embedded.getItem()->lineWidth()) * hl->glyph.scaleH;
+				CurX += (embedded.getItem()->gWidth + embedded.getItem()->lineWidth()) * glyphs->scaleH;
 			}
 			else*/
-			CurX += hl->glyph.wide();
+			CurX += glyphs->wide();
 			tabDist = CurX;
 		}
 	}
 }
 
-void PSLib::setTextCh(ScribusDoc* Doc, PageItem* ite, double x, double y, bool gcr, uint argh, uint doh, ScText *hl, const ParagraphStyle& pstyle, ScPage* pg, bool sep, bool farb, bool ic, bool master)
-{
-	const CharStyle & cstyle(*hl);
-	const GlyphLayout & glyphs(hl->glyph);
-	uint glyph = glyphs.glyph;
+void PSLib::setTextCh(ScribusDoc* Doc, PageItem* ite, double x, double y, bool gcr, uint argh, uint doh, QChar chstr, const GlyphLayout* glyphs, const CharStyle& cstyle, const ParagraphStyle& pstyle, ScPage* pg, bool sep, bool farb, bool ic, bool master)
+{
+	//QChar chstr = hl->ch;
+	//const CharStyle & cstyle(*hl);
+	//const GlyphLayout* glyphs(&(hl->glyph));
+	uint glyph = glyphs->glyph;
 
 	int h, s, v, k;
 	double tsz;
@@ -5169,8 +5204,6 @@
 	QVector<double> dum;
 	dum.clear();
 
-	QChar chstr = hl->ch;
-
 	tsz = cstyle.fontSize();
 
 /*	if (cstyle.effects() & ScStyle_DropCap)
@@ -5190,11 +5223,11 @@
 		}
 	}
 	*/
-	if (hl->hasObject(Doc))
-	{
-		PageItem* embedded = hl->getItem(Doc);
+	if (ite->itemText.hasObject(doh-1))
+	{
+		PageItem* embedded = ite->itemText.object(doh-1);
 		PS_save();
-		PS_translate(x + hl->glyph.xoffset + embedded->gXpos * (cstyle.scaleH() / 1000.0), (y + hl->glyph.yoffset - (embedded->gHeight * (cstyle.scaleV() / 1000.0)) + embedded->gYpos * (cstyle.scaleV() / 1000.0)) * -1);
+		PS_translate(x + glyphs->xoffset + embedded->gXpos * (cstyle.scaleH() / 1000.0), (y + glyphs->yoffset - (embedded->gHeight * (cstyle.scaleV() / 1000.0)) + embedded->gYpos * (cstyle.scaleV() / 1000.0)) * -1);
 		if (doh == 0 || ite->itemText.text(doh-1) == SpecialChars::PARSEP)
 		{
 			if ((cstyle.baselineOffset() != 0) && (!pstyle.hasDropCap()))
@@ -5231,8 +5264,8 @@
 		if (((cstyle.effects() & ScStyle_Underline) && !SpecialChars::isBreak(chstr)) //FIXME && (chstr != QChar(13)))  
 			|| ((cstyle.effects() & ScStyle_UnderlineWords) && !chstr.isSpace() && !SpecialChars::isBreak(chstr)))
 		{
-	//		double Ulen = cstyle.font().glyphWidth(glyph, cstyle.fontSize()) * glyphs.scaleH;
-			double Ulen = glyphs.xadvance;
+	//		double Ulen = cstyle.font().glyphWidth(glyph, cstyle.fontSize()) * glyphs->scaleH;
+			double Ulen = glyphs->xadvance;
 			double Upos, lw;
 			if ((cstyle.underlineOffset() != -1) || (cstyle.underlineWidth() != -1))
 			{
@@ -5251,7 +5284,7 @@
 				lw = qMax(cstyle.font().strokeWidth(cstyle.fontSize() / 10.0), 1.0);
 			}
 			if (cstyle.baselineOffset() != 0)
-				Upos += (cstyle.fontSize() / 10.0) * glyphs.scaleV * (cstyle.baselineOffset() / 1000.0);
+				Upos += (cstyle.fontSize() / 10.0) * glyphs->scaleV * (cstyle.baselineOffset() / 1000.0);
 			if (cstyle.fillColor() != CommonStrings::None)
 			{
 				PS_setcapjoin(Qt::FlatCap, Qt::MiterJoin);
@@ -5262,13 +5295,13 @@
 			PS_setlinewidth(lw);
 			if (cstyle.effects() & ScStyle_Subscript)
 			{
-				PS_moveto(x + glyphs.xoffset     , -y - glyphs.yoffset+Upos);
-				PS_lineto(x + glyphs.xoffset+Ulen, -y - glyphs.yoffset+Upos);
+				PS_moveto(x + glyphs->xoffset     , -y - glyphs->yoffset+Upos);
+				PS_lineto(x + glyphs->xoffset+Ulen, -y - glyphs->yoffset+Upos);
 			}
 			else
 			{
-				PS_moveto(x + glyphs.xoffset     , -y + Upos);
-				PS_lineto(x + glyphs.xoffset+Ulen, -y + Upos);
+				PS_moveto(x + glyphs->xoffset     , -y + Upos);
+				PS_lineto(x + glyphs->xoffset+Ulen, -y + Upos);
 			}
 			putColor(cstyle.fillColor(), cstyle.fillShade(), false);
 		}
@@ -5280,20 +5313,20 @@
 				PS_save();
 				if (ite->reversed())
 				{
-					PS_translate(x + hl->glyph.xoffset, (y + hl->glyph.yoffset - (tsz / 10.0)) * -1);
+					PS_translate(x + glyphs->xoffset, (y + glyphs->yoffset - (tsz / 10.0)) * -1);
 					PS_scale(-1, 1);
-					PS_translate(-glyphs.xadvance, 0);
+					PS_translate(-glyphs->xadvance, 0);
 				}
 				else
-					PS_translate(x + glyphs.xoffset, (y + glyphs.yoffset - (cstyle.fontSize() / 10.0)) * -1);
+					PS_translate(x + glyphs->xoffset, (y + glyphs->yoffset - (cstyle.fontSize() / 10.0)) * -1);
 				if (cstyle.baselineOffset() != 0)
 					PS_translate(0, (cstyle.fontSize() / 10.0) * (cstyle.baselineOffset() / 1000.0));
-				if (glyphs.scaleH != 1.0)
-					PS_scale(glyphs.scaleH, 1);
-				if (glyphs.scaleV != 1.0)
-				{
-					PS_translate(0, -((tsz / 10.0) - (tsz / 10.0) * (glyphs.scaleV)));
-					PS_scale(1, glyphs.scaleV);
+				if (glyphs->scaleH != 1.0)
+					PS_scale(glyphs->scaleH, 1);
+				if (glyphs->scaleV != 1.0)
+				{
+					PS_translate(0, -((tsz / 10.0) - (tsz / 10.0) * (glyphs->scaleV)));
+					PS_scale(1, glyphs->scaleV);
 				}
 				if (cstyle.fillColor() != CommonStrings::None)
 				{
@@ -5307,16 +5340,16 @@
 		{
 			PS_selectfont(cstyle.font().replacementName(), tsz / 10.0);
 			PS_save();
-			PS_translate(x + glyphs.xoffset, -y - glyphs.yoffset);
+			PS_translate(x + glyphs->xoffset, -y - glyphs->yoffset);
 			if (ite->reversed())
 			{
 				PS_scale(-1, 1);
-				PS_translate(glyphs.xadvance, 0);
+				PS_translate(glyphs->xadvance, 0);
 			}
 			if (cstyle.baselineOffset() != 0)
 				PS_translate(0, (cstyle.fontSize() / 10.0) * (cstyle.baselineOffset() / 1000.0));
-			if (glyphs.scaleH != 1.0 || glyphs.scaleV != 1.0)
-				PS_scale(glyphs.scaleH, glyphs.scaleV);
+			if (glyphs->scaleH != 1.0 || glyphs->scaleV != 1.0)
+				PS_scale(glyphs->scaleH, glyphs->scaleV);
 			if (cstyle.fillColor() != CommonStrings::None)
 			{
 				PS_show_xyG(cstyle.font().replacementName(), glyph, 0, 0, cstyle.fillColor(), cstyle.fillShade());
@@ -5330,7 +5363,7 @@
 				FPointArray gly = cstyle.font().glyphOutline(glyph);
 				QTransform chma, chma2, chma3;
 				chma.scale(tsz / 100.0, tsz / 100.0);
-				chma2.scale(glyphs.scaleH, glyphs.scaleV);
+				chma2.scale(glyphs->scaleH, glyphs->scaleV);
 				if (cstyle.baselineOffset() != 0)
 					chma3.translate(0, -(cstyle.fontSize() / 10.0) * (cstyle.baselineOffset() / 1000.0));
 				gly.map(chma * chma2 * chma3);
@@ -5347,8 +5380,8 @@
 					PS_setlinewidth(tsz * cstyle.outlineWidth() / 10000.0);
 					PS_setcapjoin(Qt::FlatCap, Qt::MiterJoin);
 					PS_setdash(Qt::SolidLine, 0, dum);
-					PS_translate(x + glyphs.xoffset, (y + glyphs.yoffset - (tsz / 10.0)) * -1);
-					PS_translate(0, -((tsz / 10.0) - (tsz / 10.0) * glyphs.scaleV));
+					PS_translate(x + glyphs->xoffset, (y + glyphs->yoffset - (tsz / 10.0)) * -1);
+					PS_translate(0, -((tsz / 10.0) - (tsz / 10.0) * glyphs->scaleV));
 					SetColor(cstyle.strokeColor(), cstyle.strokeShade(), &h, &s, &v, &k, gcr);
 					PS_setcmykcolor_stroke(h / 255.0, s / 255.0, v / 255.0, k / 255.0);
 					SetClipPath(&gly);
@@ -5360,8 +5393,8 @@
 		}
 		if ((cstyle.effects() & ScStyle_Strikethrough))//&& (chstr != QChar(13)))
 		{
-			//		double Ulen = cstyle.font().glyphWidth(glyph, cstyle.fontSize()) * glyphs.scaleH;
-			double Ulen = glyphs.xadvance;
+			//		double Ulen = cstyle.font().glyphWidth(glyph, cstyle.fontSize()) * glyphs->scaleH;
+			double Ulen = glyphs->xadvance;
 			double Upos, lw;
 			if ((cstyle.strikethruOffset() != -1) || (cstyle.strikethruWidth() != -1))
 			{
@@ -5380,7 +5413,7 @@
 				lw = qMax(cstyle.font().strokeWidth(cstyle.fontSize() / 10.0), 1.0);
 			}
 			if (cstyle.baselineOffset() != 0)
-				Upos += (cstyle.fontSize() / 10.0) * glyphs.scaleV * (cstyle.baselineOffset() / 1000.0);
+				Upos += (cstyle.fontSize() / 10.0) * glyphs->scaleV * (cstyle.baselineOffset() / 1000.0);
 			if (cstyle.fillColor() != CommonStrings::None)
 			{
 				PS_setcapjoin(Qt::FlatCap, Qt::MiterJoin);
@@ -5389,18 +5422,18 @@
 				PS_setcmykcolor_stroke(h / 255.0, s / 255.0, v / 255.0, k / 255.0);
 			}
 			PS_setlinewidth(lw);
-			PS_moveto(x + glyphs.xoffset     , -y-glyphs.yoffset+Upos);
-			PS_lineto(x + glyphs.xoffset+Ulen, -y-glyphs.yoffset+Upos);
+			PS_moveto(x + glyphs->xoffset     , -y-glyphs->yoffset+Upos);
+			PS_lineto(x + glyphs->xoffset+Ulen, -y-glyphs->yoffset+Upos);
 			putColor(cstyle.fillColor(), cstyle.fillShade(), false);
 		}
 	}
-	if (glyphs.more) {
-		// ugly hack until setTextCh interface is changed
-		ScText hl2(*hl);
-		hl2.glyph = *glyphs.more;
-		setTextCh(Doc, ite, x + glyphs.xadvance, y, gcr, argh, doh, &hl2, pstyle, pg, sep, farb, ic, master);
-		// don't let hl2's destructor delete these!
-		hl2.glyph.more = 0;
+	if (glyphs->more) {
+		//// ugly hack until setTextCh interface is changed
+		//ScText hl2(*hl);
+		//hl2.glyph = *glyphs->more;
+		setTextCh(Doc, ite, x + glyphs->xadvance, y, gcr, argh, doh, chstr, glyphs->more, cstyle, pstyle, pg, sep, farb, ic, master);
+		//// don't let hl2's destructor delete these!
+		//hl2.glyph.more = 0;
 	}
 /*	if (cstyle.effects() & ScStyle_SoftHyphenVisible)
 	{
@@ -5414,13 +5447,13 @@
 			chma.scale(tsz / 100.0, tsz / 100.0);
 			gly.map(chma);
 			chma = QTransform();
-			chma.scale(glyphs.scaleH, glyphs.scaleV);
+			chma.scale(glyphs->scaleH, glyphs->scaleV);
 			gly.map(chma);
 			if (cstyle.fillColor() != CommonStrings::None)
 			{
 				PS_save();
 				PS_newpath();
-				PS_translate(x + glyphs.xoffset + glyphs.xadvance, (y + glyphs.yoffset - (tsz / 10.0)) * -1);
+				PS_translate(x + glyphs->xoffset + glyphs->xadvance, (y + glyphs->yoffset - (tsz / 10.0)) * -1);
 				SetColor(cstyle.fillColor(), cstyle.fillShade(), &h, &s, &v, &k, gcr);
 				PS_setcmykcolor_fill(h / 255.0, s / 255.0, v / 255.0, k / 255.0);
 				SetClipPath(&gly);

Modified: trunk/Scribus/scribus/pslib.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18987&path=/trunk/Scribus/scribus/pslib.h
==============================================================================
--- trunk/Scribus/scribus/pslib.h (original)
+++ trunk/Scribus/scribus/pslib.h Thu Apr  3 15:08:24 2014
@@ -140,7 +140,7 @@
 		virtual void SetColor(const QString& color, double shade, int *h, int *s, int *v, int *k, bool gcr);
 		virtual void SetColor(const ScColor& color, double shade, int *h, int *s, int *v, int *k, bool gcr);
 		virtual void setTextSt(ScribusDoc* Doc, PageItem* ite, bool gcr, uint a, ScPage* pg, bool sep, bool farb, bool ic, bool master);
-		virtual void setTextCh(ScribusDoc* Doc, PageItem* ite, double x, double y, bool gcr, uint a, uint d, ScText *hl, const ParagraphStyle& pstyle, ScPage* pg, bool sep, bool farb, bool ic, bool master);
+		virtual void setTextCh(ScribusDoc* Doc, PageItem* ite, double x, double y, bool gcr, uint a, uint d, QChar chstr, const GlyphLayout* glyphs, const CharStyle& cstyle, const ParagraphStyle& pstyle, ScPage* pg, bool sep, bool farb, bool ic, bool master);
 		bool psExport;
 
 	private:

Modified: trunk/Scribus/scribus/scpageoutput.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18987&path=/trunk/Scribus/scribus/scpageoutput.cpp
==============================================================================
--- trunk/Scribus/scribus/scpageoutput.cpp (original)
+++ trunk/Scribus/scribus/scpageoutput.cpp Thu Apr  3 15:08:24 2014
@@ -1068,7 +1068,7 @@
 void ScPageOutput::drawItem_PathText( PageItem_PathText* item, ScPainterExBase* painter, const QRect& clip )
 {
 	QString chstr;
-	ScText *hl;
+	//ScText *hl;
 	FPoint point = FPoint(0, 0);
 	FPoint tangent = FPoint(0, 0);
 	double CurX = item->textToFrameDistLeft(); // item->CurX = item->textToFrameDistLeft()
@@ -1118,7 +1118,7 @@
 		if (a < itemText.length()-1)
 			chstr += itemText.text(a+1, 1);
         glyphs->yadvance = 0;
-        item->layoutGlyphs(itemText.charStyle(a), chstr, *glyphs);
+        item->layoutGlyphs(itemText.charStyle(a), chstr, itemText.flags(a), *glyphs);
         glyphs->shrink();
         if (item->itemText.hasObject(a))
             totalTextLen += (item->itemText.object(a)->width() + item->itemText.object(a)->lineWidth()) * glyphs->scaleH;
@@ -1149,6 +1149,8 @@
 	for (int a = item->firstInFrame(); a < itemText.length(); ++a)
 	{
         GlyphLayout* glyphs = itemText.getGlyphs(a);
+        PathData* pdata = &(item->textLayout.point(a));
+        
         chstr = itemText.text(a,1);
 		if (chstr[0] == SpecialChars::PAGENUMBER || chstr[0] == SpecialChars::PARSEP || chstr[0] == SpecialChars::PAGECOUNT
 			|| chstr[0] == SpecialChars::TAB || chstr[0] == SpecialChars::LINEBREAK)
@@ -1156,7 +1158,7 @@
 		if (a < itemText.length()-1)
 			chstr += itemText.text(a+1, 1);
         glyphs->yadvance = 0;
-        item->layoutGlyphs(itemText.charStyle(a), chstr, *glyphs);
+        item->layoutGlyphs(itemText.charStyle(a), chstr, itemText.flags(a), *glyphs);
         glyphs->shrink();                                                           // HACK
 		// Unneeded now that glyph xadvance is set appropriately for inline objects by PageItem_TextFrame::layout() - JG
 		/*if (hl->hasObject())
@@ -1185,12 +1187,12 @@
 		tangent = FPoint(cos(currAngle * M_PI / 180.0), sin(currAngle * M_PI / 180.0));
 		point = FPoint(currPoint.x(), currPoint.y());
 
-        hl = itemText.item_p(a);
+        //hl = itemText.item_p(a);
         glyphs->xoffset = 0;
-		hl->PtransX = point.x();
-		hl->PtransY = point.y();
-		hl->PRot    = currAngle * M_PI / 180.0;
-		hl->PDx     = dx;
+		pdata->PtransX = point.x();
+		pdata->PtransY = point.y();
+		pdata->PRot    = currAngle * M_PI / 180.0;
+		pdata->PDx     = dx;
 		QTransform trafo = QTransform( 1, 0, 0, -1, -dx, 0 );
 		if (item->textPathFlipped)
 			trafo *= QTransform(1, 0, 0, -1, 0, 0);
@@ -1624,9 +1626,9 @@
 			painter->scale(1, -1);
 		}
 
-		for (uint ll=0; ll < item->itemText.lines(); ++ll)
-		{
-			LineSpec ls = item->itemText.line(ll);
+		for (uint ll=0; ll < item->textLayout.lines(); ++ll)
+		{
+			LineSpec ls = item->textLayout.line(ll);
 			double CurX = ls.x;
 			for (a = ls.firstItem; a <= ls.lastItem; ++a)
 			{

Modified: trunk/Scribus/scribus/scribusdoc.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18987&path=/trunk/Scribus/scribus/scribusdoc.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusdoc.cpp (original)
+++ trunk/Scribus/scribus/scribusdoc.cpp Thu Apr  3 15:08:24 2014
@@ -5225,12 +5225,12 @@
 }
 
 
-void ScribusDoc::setScTextDefaultsFromDoc(ScText *sctextdata)
-{
-	if (sctextdata==NULL)
-		return;
-	reinterpret_cast<CharStyle&>(*sctextdata) = currentStyle.charStyle();
-}
+//void ScribusDoc::setScTextDefaultsFromDoc(ScText *sctextdata)
+//{
+//	if (sctextdata==NULL)
+//		return;
+//	reinterpret_cast<CharStyle&>(*sctextdata) = currentStyle.charStyle();
+//}
 
 bool ScribusDoc::copyPageToMasterPage(const int pageNumber, const int leftPage, const int maxLeftPage,  const QString& masterPageName, bool copyFromAppliedMaster)
 {

Modified: trunk/Scribus/scribus/scribusdoc.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18987&path=/trunk/Scribus/scribus/scribusdoc.h
==============================================================================
--- trunk/Scribus/scribus/scribusdoc.h (original)
+++ trunk/Scribus/scribus/scribusdoc.h Thu Apr  3 15:08:24 2014
@@ -768,7 +768,7 @@
 	/**
 	 * @brief Sets up the ScText defaults from the document
 	 */
-	void setScTextDefaultsFromDoc(ScText *);
+	//void setScTextDefaultsFromDoc(ScText *);
 	/**
 	 * @brief Copies a normal page to be a master pages
 	 */

Modified: trunk/Scribus/scribus/scribusview.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18987&path=/trunk/Scribus/scribus/scribusview.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusview.cpp (original)
+++ trunk/Scribus/scribus/scribusview.cpp Thu Apr  3 15:08:24 2014
@@ -1523,7 +1523,7 @@
 		if (textFrame->imageFlippedV())
 			point.setY(textFrame->height() - point.y());
 		textFrame->itemText.setCursorPosition(textFrame->itemText.length() == 0 ? 0 :
-			textFrame->itemText.screenToPosition(point));
+			textFrame->textLayout.screenToPosition(point));
 
 		if (textFrame->itemText.length() > 0)
 		{
@@ -3108,8 +3108,12 @@
 					pts.resize(0);
 					x = 0.0;
 					y = 0.0;
-					ScText * hl = currItem->asPathText()->itemRenderText.item_p(a);
+					//ScText * hl = currItem->asPathText()->itemRenderText.item_p(a);
 					const CharStyle& charStyle(currItem->asPathText()->itemRenderText.charStyle(a));
+                    const PathData& pdata(currItem->textLayout.point(a));
+                    const GlyphLayout* glyphs = currItem->asPathText()->itemRenderText.getGlyphs(a);
+                    LayoutFlags flags = currItem->asPathText()->itemRenderText.flags(a);
+                    
 					chstr = currItem->asPathText()->itemRenderText.text(a,1);
 					if ((chstr == SpecialChars::PARSEP) || (chstr == SpecialChars::OLD_NBSPACE))
 						continue;
@@ -3132,15 +3136,15 @@
 						chstr = chstr[0].toUpper();
 	//					double csi = static_cast<double>(chs) / 100.0;
 					uint chr = chstr[0].unicode();
-					QPointF tangt = QPointF( cos(hl->PRot), sin(hl->PRot) );
+					QPointF tangt = QPointF( cos(pdata.PRot), sin(pdata.PRot) );
 					QTransform chma, chma2, chma3, chma4, chma6;
-					QTransform trafo = QTransform( 1, 0, 0, -1, -hl->PDx, 0 );
+					QTransform trafo = QTransform( 1, 0, 0, -1, -pdata.PDx, 0 );
 					if (currItem->textPathFlipped)
 						trafo *= QTransform(1, 0, 0, -1, 0, 0);
 					if (currItem->textPathType == 0)
-						trafo *= QTransform( tangt.x(), tangt.y(), tangt.y(), -tangt.x(), hl->PtransX, hl->PtransY );
+						trafo *= QTransform( tangt.x(), tangt.y(), tangt.y(), -tangt.x(), pdata.PtransX, pdata.PtransY );
 					else if (currItem->textPathType == 1)
-						trafo *= QTransform(1, 0, 0, -1, hl->PtransX, hl->PtransY );
+						trafo *= QTransform(1, 0, 0, -1, pdata.PtransX, pdata.PtransY );
 					else if (currItem->textPathType == 2)
 					{
 						double a = 1;
@@ -3151,11 +3155,11 @@
 							b = 1;
 						}
 						if (fabs(tangt.x()) > 0.1)
-							trafo *= QTransform( a, (tangt.y() / tangt.x()) * b, 0, -1, hl->PtransX, hl->PtransY ); // ID's Skew mode
+							trafo *= QTransform( a, (tangt.y() / tangt.x()) * b, 0, -1, pdata.PtransX, pdata.PtransY ); // ID's Skew mode
 						else
-							trafo *= QTransform( a, 6 * b, 0, -1, hl->PtransX, hl->PtransY );
+							trafo *= QTransform( a, 6 * b, 0, -1, pdata.PtransX, pdata.PtransY );
 					}
-					//trafo *= QTransform( hl->PtransX, hl->PtransY, hl->PtransY, -hl->PtransX, hl->glyph.xoffset, hl->glyph.yoffset);
+					//trafo *= QTransform( hl->PtransX, hl->PtransY, hl->PtransY, -hl->PtransX, glyphs->xoffset, glyphs->yoffset);
 					if (currItem->rotation() != 0)
 					{
 						QTransform sca;
@@ -3163,7 +3167,7 @@
 						sca.rotate(currItem->rotation());
 						trafo *= sca;
 					}
-					chma.scale(hl->glyph.scaleH * charStyle.fontSize() / 100.00, hl->glyph.scaleV * charStyle.fontSize() / 100.0);
+					chma.scale(glyphs->scaleH * charStyle.fontSize() / 100.00, glyphs->scaleV * charStyle.fontSize() / 100.0);
 					if (currItem->reversed())
 					{
 						if (a < currItem->asPathText()->itemRenderText.length()-1)
@@ -3173,9 +3177,9 @@
 						chma3.scale(-1, 1);
 						chma3.translate(-wide, 0);
 					}
-					chma4.translate(0, currItem->BaseOffs - (charStyle.fontSize() / 10.0) * hl->glyph.scaleV);
+					chma4.translate(0, currItem->BaseOffs - (charStyle.fontSize() / 10.0) * glyphs->scaleV);
 					if (charStyle.effects() & (ScStyle_Subscript | ScStyle_Superscript))
-						chma6.translate(0, hl->glyph.yoffset);
+						chma6.translate(0, glyphs->yoffset);
 					if (charStyle.baselineOffset() != 0)
 						chma6.translate(0, (-charStyle.fontSize() / 10.0) * (charStyle.baselineOffset() / 1000.0));
 					uint gl = charStyle.font().char2CMap(chr);
@@ -3186,7 +3190,7 @@
 						sca.translate(currItem->xPos(), currItem->yPos());
 						pts.map(sca);
 					}
-					QChar chstc = hl->ch;
+					QChar chstc = chstr[0];
 					if (((charStyle.effects() & ScStyle_Underline) && !SpecialChars::isBreak(chstc))
 						|| ((charStyle.effects() & ScStyle_UnderlineWords) && !chstc.isSpace() && !SpecialChars::isBreak(chstc)))
 					{
@@ -3197,9 +3201,9 @@
 							sca.translate(currItem->xPos(), currItem->yPos());
 							stro *= sca;
 						}
-						double Ulen = hl->glyph.xadvance;
+						double Ulen = glyphs->xadvance;
 						double Upos, Uwid, kern;
-						if (charStyle.effects() & ScLayout_StartOfLine)
+						if (flags & ScLayout_StartOfLine)
 							kern = 0;
 						else
 							kern = charStyle.fontSize() * charStyle.tracking() / 10000.0;
@@ -3232,13 +3236,13 @@
 						FPoint start, stop;
 						if (charStyle.effects() & ScStyle_Subscript)
 						{
-							start = FPoint(hl->glyph.xoffset-kern, -Upos);
-							stop = FPoint(hl->glyph.xoffset+Ulen, -Upos);
+							start = FPoint(glyphs->xoffset-kern, -Upos);
+							stop = FPoint(glyphs->xoffset+Ulen, -Upos);
 						}
 						else
 						{
-							start = FPoint(hl->glyph.xoffset-kern, -(Upos + hl->glyph.yoffset));
-							stop = FPoint(hl->glyph.xoffset+Ulen, -(Upos + hl->glyph.yoffset));
+							start = FPoint(glyphs->xoffset-kern, -(Upos + glyphs->yoffset));
+							stop = FPoint(glyphs->xoffset+Ulen, -(Upos + glyphs->yoffset));
 						}
 						bb->PoLine.resize(0);
 						bb->PoLine.addQuadPoint(start, start, stop, stop);
@@ -3346,9 +3350,9 @@
 							sca.translate(currItem->xPos(), currItem->yPos());
 							stro *= sca;
 						}
-						double Ulen = hl->glyph.xadvance;
+						double Ulen = glyphs->xadvance;
 						double Upos, Uwid, kern;
-						if (charStyle.effects() & ScLayout_StartOfLine)
+						if (flags & ScLayout_StartOfLine)
 							kern = 0;
 						else
 							kern = charStyle.fontSize() * charStyle.tracking() / 10000.0;
@@ -3378,8 +3382,8 @@
 						bb->setLocked(currItem->locked());
 						bb->NamedLStyle = currItem->NamedLStyle;
 						bb->setItemName(currItem->itemName()+"+S"+ccounter.setNum(a));
-						FPoint start = FPoint(hl->glyph.xoffset-kern, -Upos);
-						FPoint stop = FPoint(hl->glyph.xoffset+Ulen, -Upos);
+						FPoint start = FPoint(glyphs->xoffset-kern, -Upos);
+						FPoint stop = FPoint(glyphs->xoffset+Ulen, -Upos);
 						bb->PoLine.resize(0);
 						bb->PoLine.addQuadPoint(start, start, stop, stop);
 						bb->PoLine.map(stro);
@@ -3401,9 +3405,9 @@
 			}
 			else
 			{
-				for (uint ll=0; ll < currItem->itemText.lines(); ++ll)
+				for (uint ll=0; ll < currItem->textLayout.lines(); ++ll)
 				{
-					LineSpec ls = currItem->itemText.line(ll);
+					LineSpec ls = currItem->textLayout.line(ll);
 					double CurX = ls.x;
 					for (int a = ls.firstItem; a <= ls.lastItem; ++a)
 					{

Modified: trunk/Scribus/scribus/sctextstruct.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18987&path=/trunk/Scribus/scribus/sctextstruct.h
==============================================================================
--- trunk/Scribus/scribus/sctextstruct.h (original)
+++ trunk/Scribus/scribus/sctextstruct.h Thu Apr  3 15:08:24 2014
@@ -111,21 +111,16 @@
 public:
 	ParagraphStyle* parstyle; // only for parseps
 	GlyphLayout glyph;
-	float PtransX;
-	float PtransY;
-	float PRot;
-	float PDx;
 	int embedded;
 	Mark* mark;
 	QChar ch;
 	ScText() : 
 		CharStyle(),
 		parstyle(NULL), glyph(), 
-		PtransX(0.0f), PtransY(0.0f), PRot(0.0f), PDx(0.0f), embedded(0), mark(NULL), ch() {}
+		embedded(0), mark(NULL), ch() {}
 	ScText(const ScText& other) : 
 		CharStyle(other),
 		parstyle(NULL), glyph(other.glyph), 
-		PtransX(other.PtransX), PtransY(other.PtransY), PRot(other.PRot), PDx(other.PDx), 
 		embedded(other.embedded), mark(NULL), ch(other.ch)
 	{
 		glyph.more = NULL;

Modified: trunk/Scribus/scribus/text/CMakeLists.txt
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18987&path=/trunk/Scribus/scribus/text/CMakeLists.txt
==============================================================================
--- trunk/Scribus/scribus/text/CMakeLists.txt (original)
+++ trunk/Scribus/scribus/text/CMakeLists.txt Thu Apr  3 15:08:24 2014
@@ -12,6 +12,7 @@
 SET(SCRIBUS_TEXT_LIB_SOURCES
 	specialchars.cpp
 	storytext.cpp
+	textlayout.cpp
 	sctext_shared.cpp
 	fsize.cpp
 	frect.cpp

Modified: trunk/Scribus/scribus/text/storytext.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18987&path=/trunk/Scribus/scribus/text/storytext.cpp
==============================================================================
--- trunk/Scribus/scribus/text/storytext.cpp (original)
+++ trunk/Scribus/scribus/text/storytext.cpp Thu Apr  3 15:08:24 2014
@@ -53,10 +53,10 @@
 	m_selFirst = 0;
 	m_selLast = -1;
 	
-	m_firstFrameItem = 0;
-	m_lastFrameItem = -1;
-	m_magicX = 0.0;
-	m_lastMagicPos = -1;
+//	m_firstFrameItem = 0;
+//	m_lastFrameItem = -1;
+//	m_magicX = 0.0;
+//	m_lastMagicPos = -1;
 	
 	d->len = 0;
 	invalidateAll();
@@ -69,10 +69,10 @@
 	m_selFirst = 0;
 	m_selLast = -1;
 	
-	m_firstFrameItem = 0;
-	m_lastFrameItem = -1;
-	m_magicX = 0.0;
-	m_lastMagicPos = -1;
+//	m_firstFrameItem = 0;
+//	m_lastFrameItem = -1;
+//	m_magicX = 0.0;
+//	m_lastMagicPos = -1;
 }
 
 StoryText::StoryText(const StoryText & other) : QObject(), SaxIO(), m_doc(other.m_doc)
@@ -88,10 +88,10 @@
 	m_selFirst = 0;
 	m_selLast = -1;
 	
-	m_firstFrameItem = 0;
-	m_lastFrameItem = -1;
-	m_magicX = 0.0;
-	m_lastMagicPos = -1;
+//	m_firstFrameItem = 0;
+//	m_lastFrameItem = -1;
+//	m_magicX = 0.0;
+//	m_lastMagicPos = -1;
 
 	invalidateLayout();
 }
@@ -152,8 +152,8 @@
 	m_selFirst = 0;
 	m_selLast = -1;
 	
-	m_firstFrameItem = 0;
-	m_lastFrameItem = -1;
+//	m_firstFrameItem = 0;
+//	m_lastFrameItem = -1;
 
 	invalidateLayout();
 	return *this;
@@ -186,8 +186,8 @@
 	m_selFirst = 0;
 	m_selLast = -1;
 
-	m_firstFrameItem = 0;
-	m_lastFrameItem = -1;
+//	m_firstFrameItem = 0;
+//	m_lastFrameItem = -1;
 	
 	d->defaultStyle.erase();
 	d->trailingStyle.erase();
@@ -360,7 +360,7 @@
  */
 void StoryText::insertParSep(int pos)
 {
-	ScText* it = item_p(pos);
+	ScText* it = item(pos);
 	if(!it->parstyle) {
 		it->parstyle = new ParagraphStyle(paragraphStyle(pos+1));
 		it->parstyle->setContext( & d->pstyleContext);
@@ -382,7 +382,7 @@
  */
 void StoryText::removeParSep(int pos)
 {
-	ScText* it = item_p(pos);
+	ScText* it = item(pos);
 	if (it->parstyle) {
 //		const CharStyle* oldP = & it->parstyle->charStyle();
 //		const CharStyle* newP = & that->paragraphStyle(pos+1).charStyle();
@@ -870,7 +870,7 @@
     if (pos < 0)
         pos += length();
 
-    assert(pos >= 0);
+	assert(pos >= 0);
     assert(pos < length());
 
     StoryText* that = const_cast<StoryText *>(this);
@@ -1519,104 +1519,7 @@
 	return result;
 }
 
-// these need valid layout:
-
-int StoryText::startOfLine(int pos)
-{
-	for (int i=0; i < m_lines.count(); ++i) {
-		const LineSpec & ls(m_lines.at(i));
-		if (ls.firstItem <= pos && pos <= ls.lastItem)
-			return ls.firstItem;
-	}
-	return 0;
-}
-int StoryText::endOfLine(int pos)
-{
-	for (int i=0; i < m_lines.count(); ++i) {
-		const LineSpec & ls(m_lines.at(i));
-		if (ls.firstItem <= pos && pos <= ls.lastItem)
-			return text(ls.lastItem) == SpecialChars::PARSEP ? ls.lastItem : 
-				text(ls.lastItem) == ' ' ? ls.lastItem : ls.lastItem + 1;
-	}
-	return length();
-}
-int StoryText::prevLine(int pos)
-{
-	for (int i=0; i < m_lines.count(); ++i) 
-	{
-		// find line for pos
-		const LineSpec & ls(m_lines.at(i));
-		if (ls.firstItem <= pos && pos <= ls.lastItem) 
-		{
-			if (i == 0)
-				return startOfLine(pos);
-			// find current xpos
-			qreal xpos = 0.0;
-			for (int j = ls.firstItem; j < pos; ++j)
-				xpos += item(j)->glyph.wide();
-			if (pos != m_lastMagicPos || xpos > m_magicX)
-				m_magicX = xpos;
-			const LineSpec & ls2(m_lines.at(i-1));
-			// find new cpos
-			xpos = 0.0;
-			for (int j = ls2.firstItem; j <= ls2.lastItem; ++j) 
-			{
-				xpos += item(j)->glyph.wide();
-				if (xpos > m_magicX) {
-					m_lastMagicPos = j;
-					return j;
-				}
-			}
-			m_lastMagicPos = ls2.lastItem;
-			return ls2.lastItem;
-		}
-	}
-	return m_firstFrameItem;
-}
-
-int StoryText::nextLine(int pos)
-{
-	for (int i=0; i < m_lines.count(); ++i) 
-	{
-		// find line for pos
-		const LineSpec & ls(m_lines.at(i));
-		if (ls.firstItem <= pos && pos <= ls.lastItem) 
-		{
-			if (i+1 == m_lines.count())
-				return endOfLine(pos);
-			// find current xpos
-			qreal xpos = 0.0;
-			for (int j = ls.firstItem; j < pos; ++j)
-				xpos += item(j)->glyph.wide();
-			if (pos != m_lastMagicPos || xpos > m_magicX)
-				m_magicX = xpos;
-			const LineSpec & ls2(m_lines.at(i+1));
-			// find new cpos
-			xpos = 0.0;
-			for (int j = ls2.firstItem; j <= ls2.lastItem; ++j) 
-			{
-				xpos += item(j)->glyph.wide();
-				if (xpos > m_magicX) {
-					m_lastMagicPos = j;
-					return j;
-				}
-			}
-			m_lastMagicPos = ls2.lastItem + 1;
-			return ls2.lastItem + 1;
-		}
-	}
-	return m_lastFrameItem;
-}
-
-int StoryText::startOfFrame(int pos) 
-{
-	return m_firstFrameItem;
-}
-
-int StoryText::endOfFrame(int pos)
-{
-	return m_lastFrameItem + 1;
-}
+
 
 // selection
 
@@ -1828,102 +1731,6 @@
 }
 */
 
-int StoryText::screenToPosition(FPoint coord) const
-{
-	qreal maxx = coord.x() - 1.0;
-	for (unsigned int i=0; i < lines(); ++i)
-	{
-		LineSpec ls = line(i);
-//		qDebug() << QString("screenToPosition: (%1,%2) -> y %3 - %4 + %5").arg(coord.x()).arg(coord.y()).arg(ls.y).arg(ls.ascent).arg(ls.descent);
-		if (ls.y + ls.descent < coord.y())
-			continue;
-		qreal xpos = ls.x;
-		for (int j = ls.firstItem; j <= ls.lastItem; ++j)
-		{
-//				qDebug() << QString("screenToPosition: (%1,%2) -> x %3 + %4").arg(coord.x()).arg(coord.y()).arg(xpos).arg(item(j)->glyph.wide());
-			qreal width = item(j)->glyph.wide();
-			xpos += width;
-			if (xpos >= coord.x())
-			{
-				if (hasObject(j))
-					return j;
-				else
-					return xpos - width/2 > coord.x() ? j : j+1;
-			}
-		}
-		if (xpos > maxx)
-			maxx = xpos;
-		if (xpos + 1.0 > coord.x()) // allow 1pt after end of line
-			return ls.lastItem + 1;
-		else if (coord.x() <= ls.x + ls.width) // last line of paragraph?
-			return ((ls.lastItem == m_lastFrameItem) ? (ls.lastItem + 1) : ls.lastItem);
-		else if (xpos < ls.x + 0.01 && maxx >= coord.x()) // check for empty line
-			return ls.firstItem;
-	}
-	return qMax(m_lastFrameItem+1, m_firstFrameItem);
-}
-
-
-FRect StoryText::boundingBox(int pos, uint len) const
-{
-	FRect result;
-	LineSpec ls;
-	for (uint i=0; i < lines(); ++i)
-	{
-		ls = line(i);
-		if (ls.lastItem < pos)
-			continue;
-		if (ls.firstItem <= pos) {
-			/*
-			if (ls.lastItem == pos && (item(pos)->effects() & ScLayout_SuppressSpace)  )
-			{
-				if (i+1 < lines())
-				{
-					ls = line(i+1);
-					result.setRect(ls.x, ls.y - ls.ascent, 1, ls.ascent + ls.descent);
-				}
-				else
-				{
-					ls = line(lines()-1);
-					const ParagraphStyle& pstyle(paragraphStyle(pos));
-					result.setRect(ls.x, ls.y + pstyle.lineSpacing() - ls.ascent, 1, ls.ascent + ls.descent);
-				}
-			}
-			else */
-			{
-				qreal xpos = ls.x;
-				for (int j = ls.firstItem; j < pos; ++j)
-				{
-					if (hasObject(j))
-						xpos += (object(j)->width() + object(j)->lineWidth()) * item(j)->glyph.scaleH;
-					else
-						xpos += item(j)->glyph.wide();
-				}
-				qreal finalw = 1;
-				if (hasObject(pos))
-					finalw = (object(pos)->width() + object(pos)->lineWidth()) * item(pos)->glyph.scaleH;
-				else
-					finalw = item(pos)->glyph.wide();
-				const CharStyle& cs(charStyle(pos));
-				qreal desc = -cs.font().descent(cs.fontSize() / 10.0);
-				qreal asce = cs.font().ascent(cs.fontSize() / 10.0);
-				result.setRect(xpos, ls.y - asce, pos < length()? finalw : 1, desc+asce);
-			}
-			return result;
-		}
-	}
-	const ParagraphStyle& pstyle(paragraphStyle(qMin(pos, length()))); // rather the trailing style than a segfault.
-	if (lines() > 0)
-	{
-		ls = line(lines()-1);		
-		result.setRect(ls.x, ls.y + pstyle.lineSpacing() - ls.ascent, 1, ls.ascent + ls.descent);
-	}
-	else
-	{
-		result.setRect(1, 1, 1, pstyle.lineSpacing());
-	}	
-	return result;
-}
 
 
 ScText*  StoryText::item(uint itm)

Modified: trunk/Scribus/scribus/text/storytext.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18987&path=/trunk/Scribus/scribus/text/storytext.h
==============================================================================
--- trunk/Scribus/scribus/text/storytext.h (original)
+++ trunk/Scribus/scribus/text/storytext.h Thu Apr  3 15:08:24 2014
@@ -51,19 +51,6 @@
 class ResourceCollection;
  
 
-struct LineSpec 
-{
-	qreal x;
-	qreal y;
-	qreal width;
-	qreal ascent;
-	qreal descent;
-	qreal colLeft;
-	
-	int firstItem;
-	int lastItem;
-	qreal naturalWidth;
-};
 
 /**
  * This class holds the text of a Scribus textframe and pointers to its
@@ -220,12 +207,12 @@
 
 // these need valid layout:
 
-	int startOfLine(int pos);
-	int endOfLine(int pos);
-	int prevLine(int pos);
-	int nextLine(int pos);
-	int startOfFrame(int pos);
-	int endOfFrame(int pos);
+//	int startOfLine(int pos);
+//	int endOfLine(int pos);
+//	int prevLine(int pos);
+//	int nextLine(int pos);
+//	int startOfFrame(int pos);
+//	int endOfFrame(int pos);
 
 // selection
 
@@ -261,71 +248,32 @@
 	/// call this if some logical style changes (redos shaping and layout)
  	void invalidateAll();
 
-	signals:
+signals:
 		void changed();
 
 private:
  	ScText * item(uint index);
  	const ScText * item(uint index) const;
-public:
-	ScText * item_p(uint index) { return item(index); }
-
- 	int screenToPosition(FPoint coord) const;
- 	FRect  boundingBox(int pos, uint len = 1) const;
-
-	uint lines() const { return (uint) m_lines.count(); }
-	
-	LineSpec line(uint i) const { return m_lines[i]; }
-	
-	void appendLine(const LineSpec& ls) 
-	{ 
-		assert( ls.firstItem >= 0 );
-		assert( ls.firstItem < length() );
-		assert( ls.lastItem >= 0 && ls.firstItem - ls.lastItem < 1 );
-		assert( ls.lastItem < length() );
-		m_lines.append(ls);
-		if (m_lastFrameItem < m_firstFrameItem) {
-			m_firstFrameItem = ls.firstItem;
-			m_lastFrameItem = ls.lastItem;
-		}
-		else {
-			m_firstFrameItem = qMin(m_firstFrameItem, ls.firstItem);
-			m_lastFrameItem = qMax(m_lastFrameItem, ls.lastItem);
-		}
-	}
-
-	// Remove the last line from the list. Used when we need to backtrack on the layouting.
-	void removeLastLine ()
-	{
-		if (m_lines.isEmpty()) return;
-		LineSpec last = m_lines.takeLast ();
-		if (m_lines.isEmpty()) {
-			clearLines();
-			return;
-		}
-		// fix lastFrameItem
-		if (m_lastFrameItem != last.lastItem) return;
-		m_lastFrameItem = m_lines.last().lastItem;
-	}
-
-	void clearLines() 
-	{ 
-		m_lines.clear(); 
-		m_firstFrameItem = 0; 
-		m_lastFrameItem = -1; 
-	}
-	
-	int firstInFrame() { return m_firstFrameItem; }
-	int lastInFrame() { return m_lastFrameItem; }
+
+//public:
+//	ScText * item_p(uint index) { return item(index); }
+
+// 	int screenToPosition(FPoint coord) const;
+// 	FRect  boundingBox(int pos, uint len = 1) const;
+
+//	uint lines() const { return (uint) m_lines.count(); }
+	
+//	LineSpec line(uint i) const { return m_lines[i]; }
+	
 
 private:
 	ScribusDoc * m_doc; 
 	int m_selFirst, m_selLast;
-	int m_firstFrameItem, m_lastFrameItem;
-	QList<LineSpec> m_lines;
-	bool m_validLayout;
-	qreal m_magicX;
-	int m_lastMagicPos;
+//	int m_firstFrameItem, m_lastFrameItem;
+//	QList<LineSpec> m_lines;
+//	bool m_validLayout;
+//	qreal m_magicX;
+//	int m_lastMagicPos;
 
 	QString textWithSoftHyphens (int pos, uint len) const;
 	void    insertCharsWithSoftHyphens(int pos, QString txt, bool applyNeighbourStyle = false);

Modified: trunk/Scribus/scribus/ui/search.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18987&path=/trunk/Scribus/scribus/ui/search.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/search.cpp (original)
+++ trunk/Scribus/scribus/ui/search.cpp Thu Apr  3 15:08:24 2014
@@ -486,7 +486,7 @@
 			}
 			if (SEffect->isChecked())
 			{
-				if ((m_item->itemText.charStyle(a).effects() & 1919) != sEff)
+				if ((m_item->itemText.charStyle(a).effects() & ScStyle_UserStyles) != sEff)
 					found = false;
 			}
 			if (SFill->isChecked())
@@ -572,7 +572,7 @@
 						found = false;
 					if (SFillS->isChecked() && (charStyle.fillShade() != sFillSh))
 						found = false;
-					if (SEffect->isChecked() && ((charStyle.effects() & 1919) != sEff))
+					if (SEffect->isChecked() && ((charStyle.effects() & ScStyle_UserStyles) != sEff))
 						found = false;
 				}
 			} while(!found);
@@ -604,7 +604,7 @@
 					found = false;
 				if (SStrokeS->isChecked() && (charStyle.strokeShade() != sStrokeSh))
 					found = false;
-				if (SEffect->isChecked() && ((charStyle.effects() & 1919) != sEff))
+				if (SEffect->isChecked() && ((charStyle.effects() & ScStyle_UserStyles) != sEff))
 					found = false;
 				if (found && (firstChar < 0))
 					firstChar = i;

Modified: trunk/Scribus/scribus/ui/storyeditor.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18987&path=/trunk/Scribus/scribus/ui/storyeditor.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/storyeditor.cpp (original)
+++ trunk/Scribus/scribus/ui/storyeditor.cpp Thu Apr  3 15:08:24 2014
@@ -2586,7 +2586,7 @@
 		Editor->prevFont = Editor->CurrFont;
 		Editor->CurrFont = charStyle.font().scName();
 		Editor->CurrFontSize = charStyle.fontSize();
-		Editor->CurrentEffects = charStyle.effects() & static_cast<StyleFlag>(1919);
+		Editor->CurrentEffects = charStyle.effects() & static_cast<StyleFlag>(ScStyle_UserStyles);
 		Editor->CurrTextKern   = charStyle.tracking();
 		Editor->CurrTextScale  = charStyle.scaleH();
 		Editor->CurrTextScaleV = charStyle.scaleV();
@@ -2953,7 +2953,8 @@
 	Editor->saveItemText(nextItem);
 	// #9180 : force relayout here, it appears that relayout is sometime disabled
 	// to speed up selection, but re layout() cannot be avoided here
-	nextItem->asTextFrame()->invalidateLayout(true);
+	if (nextItem->asTextFrame())
+        nextItem->asTextFrame()->invalidateLayout(true);
 	nextItem->layout();
 #if 0
 	QList<PageItem*> FrameItemsDel;

Modified: trunk/Scribus/xcode/Scribus/Scribus.xcodeproj/project.pbxproj
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18987&path=/trunk/Scribus/xcode/Scribus/Scribus.xcodeproj/project.pbxproj
==============================================================================
--- trunk/Scribus/xcode/Scribus/Scribus.xcodeproj/project.pbxproj (original)
+++ trunk/Scribus/xcode/Scribus/Scribus.xcodeproj/project.pbxproj Thu Apr  3 15:08:24 2014
@@ -1875,6 +1875,11 @@
 		8808DFA4123238D100B95A3F /* vgradient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = vgradient.h; path = ../../scribus/vgradient.h; sourceTree = SOURCE_ROOT; };
 		8808DFA5123238D100B95A3F /* vgradientex.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = vgradientex.cpp; path = ../../scribus/vgradientex.cpp; sourceTree = SOURCE_ROOT; };
 		8808DFA6123238D100B95A3F /* vgradientex.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = vgradientex.h; path = ../../scribus/vgradientex.h; sourceTree = SOURCE_ROOT; };
+		8885481918EB18920063510D /* textlayout.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = textlayout.cpp; sourceTree = "<group>"; };
+		8885481A18EB18920063510D /* textlayout.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = textlayout.h; sourceTree = "<group>"; };
+		8885481C18EB38300063510D /* CMakeLists.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = CMakeLists.txt; sourceTree = "<group>"; };
+		8885481D18EB38300063510D /* xpsexplugin.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = xpsexplugin.cpp; sourceTree = "<group>"; };
+		8885481E18EB38300063510D /* xpsexplugin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = xpsexplugin.h; sourceTree = "<group>"; };
 /* End PBXFileReference section */
 
 /* Begin PBXGroup section */
@@ -2503,6 +2508,7 @@
 		8808D94F123238CF00B95A3F /* plugins */ = {
 			isa = PBXGroup;
 			children = (
+				8885481B18EB38300063510D /* xpsexport */,
 				8808D950123238CF00B95A3F /* barcodegenerator */,
 				8808D958123238CF00B95A3F /* CMakeLists.txt */,
 				8808D959123238CF00B95A3F /* colorwheel */,
@@ -3580,6 +3586,8 @@
 		8808DC53123238D000B95A3F /* text */ = {
 			isa = PBXGroup;
 			children = (
+				8885481918EB18920063510D /* textlayout.cpp */,
+				8885481A18EB18920063510D /* textlayout.h */,
 				8808DC54123238D000B95A3F /* CMakeLists.txt */,
 				8808DC55123238D000B95A3F /* frect.cpp */,
 				8808DC56123238D000B95A3F /* frect.h */,
@@ -4447,6 +4455,16 @@
 			path = ../../scribus/unicodemap;
 			sourceTree = SOURCE_ROOT;
 		};
+		8885481B18EB38300063510D /* xpsexport */ = {
+			isa = PBXGroup;
+			children = (
+				8885481C18EB38300063510D /* CMakeLists.txt */,
+				8885481D18EB38300063510D /* xpsexplugin.cpp */,
+				8885481E18EB38300063510D /* xpsexplugin.h */,
+			);
+			path = xpsexport;
+			sourceTree = "<group>";
+		};
 /* End PBXGroup section */
 
 /* Begin PBXLegacyTarget section */
@@ -4499,7 +4517,14 @@
 			isa = PBXProject;
 			buildConfigurationList = 1DEB919308733D9F0010E9CD /* Build configuration list for PBXProject "Scribus" */;
 			compatibilityVersion = "Xcode 3.1";
+			developmentRegion = English;
 			hasScannedForEncodings = 1;
+			knownRegions = (
+				English,
+				Japanese,
+				French,
+				German,
+			);
 			mainGroup = 08FB7794FE84155DC02AAC07 /* Scribus */;
 			projectDirPath = "";
 			projectRoot = "";




More information about the scribus-commit mailing list