r14364 by fschmid - Xara Importer: Fixed incorrect positioning of right or centered aligned text.

scribus-commit scribus-commit at lists.scribus.net
Fri Nov 27 20:45:22 CET 2009


Revision: 14364
Author: fschmid
Date: 2009-11-27T10:07:33.847762Z
Commit message: Xara Importer: Fixed incorrect positioning of right or centered aligned text.

Changeset: 
M  /trunk/Scribus/scribus/plugins/import/xar/importxar.cpp

Diffs:
Index: scribus/plugins/import/xar/importxar.cpp
===================================================================
--- scribus/plugins/import/xar/importxar.cpp	(revision 14363)
+++ scribus/plugins/import/xar/importxar.cpp	(revision 14364)
@@ -1080,19 +1080,19 @@
 			textFont.setItalic(txDat.FontItalic);
 			textFont.setUnderline(txDat.FontUnderline);
 			textFont.setStretch(txDat.FontStretch * 100);
-			painterPath.addText( xpos, 0, textFont, txDat.itemText);
+			painterPath.addText( 0, 0, textFont, txDat.itemText);
 			QMatrix txS;
 			txS.scale(0.1, 0.1);
 			painterPath = txS.map(painterPath);
-			QRectF bound = painterPath.boundingRect();
 			Coords.resize(0);
 			Coords.fromQPainterPath(painterPath);
+			Coords.translate(xpos, 0);
 			Coords.map(textMatrix);
 			Coords.translate(TextX, TextY);
 			if (gc->TextAlignment == 1)
-				Coords.translate(-bound.width() / 2.0, 0);
+				Coords.translate(-gc->LineWidth / 2.0, 0);
 			else if (gc->TextAlignment == 2)
-				Coords.translate(-bound.width(), 0);
+				Coords.translate(-gc->LineWidth, 0);
 			if (Coords.size() > 0)
 			{
 				int z = m_Doc->itemAdd(PageItem::Polygon, PageItem::Unspecified, baseX, baseY, 10, 10, 0, gc->FillCol, CommonStrings::None, true);
@@ -1141,7 +1141,7 @@
 					}
 				}
 			}
-			xpos += QFontMetricsF(textFont).width(txDat.itemText);
+			xpos += QFontMetricsF(textFont).width(txDat.itemText) / 10.0;
 		}
 	}
 	textData.clear();




More information about the scribus-commit mailing list