r13946 by jghali - #8385: tab fill characters are printed incorrectly to PDF and to PS

scribus-commit scribus-commit at lists.scribus.net
Tue Sep 1 14:50:43 CEST 2009


Revision: 13946
Author: jghali
Date: 2009-09-01T12:50:19.139731Z
Commit message: #8385: tab fill characters are printed incorrectly to PDF and to PS

Changeset: 
M  /trunk/Scribus/scribus/pdflib_core.cpp
M  /trunk/Scribus/scribus/pslib.cpp
M  /trunk/Scribus/scribus/pageitem_textframe.cpp
M  /trunk/Scribus/scribus/sctextstruct.cpp
M  /trunk/Scribus/scribus/sctextstruct.h

Diffs:
Index: scribus/pdflib_core.cpp
===================================================================
--- scribus/pdflib_core.cpp	(revision 13945)
+++ scribus/pdflib_core.cpp	(revision 13946)
@@ -4004,12 +4004,9 @@
 				if ((ch == SpecialChars::TAB) && (tTabValues.count() != 0))
 				{
 					QChar tabFillChar;
-					double tCurX = CurX - colLeft + 1;
-					for (int yg = static_cast<int>(tTabValues.count()-1); yg > -1; yg--)
-					{
-						if (tCurX < tTabValues[yg].tabPosition)
-							tabFillChar = tTabValues[yg].tabFillChar;
-					}
+					const TabLayout* tabLayout = dynamic_cast<const TabLayout*>(hl->glyph.more);
+					if (tabLayout)
+						tabFillChar = tabLayout->fillChar;
 					if (!tabFillChar.isNull())
 					{
 						ScText hl2;
Index: scribus/sctextstruct.cpp
===================================================================
--- scribus/sctextstruct.cpp	(revision 13945)
+++ scribus/sctextstruct.cpp	(revision 13946)
@@ -13,6 +13,12 @@
 #include "pageitem.h"
 #include "scribusdoc.h"
 
+void GlyphLayout::growWithTabLayout()
+{
+	if (more)
+		shrink();
+	more = new TabLayout();
+}
 
 struct InlineFrameData
 {
Index: scribus/sctextstruct.h
===================================================================
--- scribus/sctextstruct.h	(revision 13945)
+++ scribus/sctextstruct.h	(revision 13946)
@@ -88,9 +88,14 @@
 			more = new GlyphLayout();
 		}
 	}
-	
+	virtual void growWithTabLayout();
 };
 
+struct SCRIBUS_API TabLayout : public GlyphLayout
+{
+	QChar fillChar;
+};
+
 struct InlineFrameData;
 
 class SCRIBUS_API InlineFrame
Index: scribus/pageitem_textframe.cpp
===================================================================
--- scribus/pageitem_textframe.cpp	(revision 13945)
+++ scribus/pageitem_textframe.cpp	(revision 13946)
@@ -1447,12 +1447,16 @@
 						// remember fill char
 //						qDebug() << QString("tab: %1 '%2'").arg(tCurX).arg(tabs.fillChar);
 						if (!tabs.fillChar.isNull()) {
-							hl->glyph.grow();
-							GlyphLayout * tglyph = hl->glyph.more;
-							tglyph->glyph = charStyle.font().char2CMap(tabs.fillChar);
-							tglyph->yoffset = hl->glyph.yoffset;
-							tglyph->scaleV = tglyph->scaleH = chs / charStyle.fontSize();
-							tglyph->xadvance = 0;
+							hl->glyph.growWithTabLayout();
+							TabLayout * tglyph = dynamic_cast<TabLayout*>(hl->glyph.more);
+							if (tglyph)
+							{
+								tglyph->fillChar = tabs.fillChar;
+								tglyph->glyph    = charStyle.font().char2CMap(tabs.fillChar);
+								tglyph->yoffset  = hl->glyph.yoffset;
+								tglyph->scaleV   = tglyph->scaleH = chs / charStyle.fontSize();
+								tglyph->xadvance = 0;
+							}
 						}
 					}
 					current.xPos -= (legacy ? 1.0 : 0.0);
Index: scribus/pslib.cpp
===================================================================
--- scribus/pslib.cpp	(revision 13945)
+++ scribus/pslib.cpp	(revision 13946)
@@ -3675,12 +3675,9 @@
 			if ((hl->ch == SpecialChars::TAB) && (tTabValues.count() != 0))
 			{
 				QChar tabFillChar;
-				double tCurX = CurX - colLeft + 1;
-				for (int yg = static_cast<int>(tTabValues.count()-1); yg > -1; yg--)
-				{
-					if (tCurX < tTabValues[yg].tabPosition)
-						tabFillChar = tTabValues[yg].tabFillChar;
-				}
+				const TabLayout* tabLayout = dynamic_cast<const TabLayout*>(hl->glyph.more);
+				if (tabLayout)
+					tabFillChar = tabLayout->fillChar;
 				if (!tabFillChar.isNull())
 				{
 					ScText hl2;




More information about the scribus-commit mailing list