r16080 by pierremarc - Fixed incorrect positionning of multi items lines in RTL context

scribus-commit scribus-commit at lists.scribus.net
Wed Dec 8 17:45:24 CET 2010


Author: pierremarc
Date: Wed Dec  8 16:45:24 2010
New Revision: 16080

URL: http://scribus.info/websvn/listing.php?repname=Scribus&sc=1&rev=16080
Log:
Fixed incorrect positionning of multi items lines in RTL context

Modified:
    branches/ScribusOIF/scribus/text/linelayouter.cpp

Modified: branches/ScribusOIF/scribus/text/linelayouter.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16080&path=/branches/ScribusOIF/scribus/text/linelayouter.cpp
==============================================================================
--- branches/ScribusOIF/scribus/text/linelayouter.cpp (original)
+++ branches/ScribusOIF/scribus/text/linelayouter.cpp Wed Dec  8 16:45:24 2010
@@ -60,7 +60,9 @@
 		while(true && cluster.isValid())
 		{
 			lastPos = cluster.textPosition();
-			if(cluster.textPosition() < start)
+			bool currentIsBrSpace(SpecialChars::isBreakingSpace(m_layout->story()->text(lastPos)));
+
+			if(lastPos < start)
 			{
 				if(gs->haveNext(cluster))
 				{
@@ -70,8 +72,7 @@
 				else
 					break;
 			}
-			else if((cluster.textPosition() == start)
-				&& SpecialChars::isBreakingSpace(m_layout->story()->text(cluster.textPosition())))
+			else if((lastPos == start) && currentIsBrSpace)
 			{
 				cluster = gs->next(cluster);
 				continue;
@@ -87,31 +88,31 @@
 						ret << lr;
 						resultCount = 1;
 					}
-					else if(SpecialChars::isBreakingSpace(m_layout->story()->text(cluster.textPosition())))
+					else if(currentIsBrSpace)
 					{
-						LineResult lr(stackWidth + currentClusterWidth, 1, cluster.textPosition()); // overfullbox
+						LineResult lr(stackWidth, 1, lastPos ); // overfullbox
 						ret << lr;
 						resultCount = 1;
 					}
 //					qDebug()<<"Inserting Line Result0"<<lr.width<<lr.endPos;
 				}
-				else if(cluster.textPosition() + 1 == m_layout->story()->length())
+				else if(lastPos + 1 == m_layout->story()->length())
 				{
-					LineResult lr(stackWidth + currentClusterWidth, 0, cluster.textPosition());
+					LineResult lr(stackWidth + currentClusterWidth, 0, lastPos);
 					ret << lr;
 //					qDebug()<<"Inserting Line Result1"<<lr.width<<lr.endPos;
 					resultCount = 2;
 				}
 				// put a possible break for next iteration
-				if(SpecialChars::isBreakingSpace(m_layout->story()->text(cluster.textPosition())))
+				if(currentIsBrSpace)
 				{
 					lastBreak = cluster.textPosition();
-					lastBreakWidth = stackWidth + currentClusterWidth;
+					lastBreakWidth = stackWidth;
 				}
 			}
-			else if( SpecialChars::isBreakingSpace(m_layout->story()->text(cluster.textPosition())))
+			else if(currentIsBrSpace)
 			{
-				LineResult lr(stackWidth + currentClusterWidth, 1, cluster.textPosition());
+				LineResult lr(stackWidth, 1, lastPos );
 				ret << lr;
 //				qDebug()<<"Inserting Line Result2"<<lr.width<<lr.endPos;
 				resultCount = 2;




More information about the scribus-commit mailing list