r23711 by jghali - Fix issue where lines ending with multiple spaces would not be justified correctly

scribus-commit scribus-commit at lists.scribus.net
Fri May 8 03:10:41 UTC 2020


Author: jghali
Date: Fri May  8 03:10:41 2020
New Revision: 23711

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=23711
Log:
Fix issue where lines ending with multiple spaces would not be justified correctly

Modified:
    trunk/Scribus/scribus/pageitem_textframe.cpp

Modified: trunk/Scribus/scribus/pageitem_textframe.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23711&path=/trunk/Scribus/scribus/pageitem_textframe.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem_textframe.cpp	(original)
+++ trunk/Scribus/scribus/pageitem_textframe.cpp	Fri May  8 03:10:41 2020
@@ -1545,7 +1545,7 @@
 			}
 			else // from 134 on use NBSPACE for this effect
 			{
-				if ( current.isEmpty && (SpecialChars::isBreakingSpace(itemText.text(a)) || itemText.text(a).isSpace()))
+				if (current.isEmpty && (SpecialChars::isBreakingSpace(itemText.text(a)) || itemText.text(a).isSpace()))
 				{
 					current.glyphs[currentIndex].setFlag(ScLayout_SuppressSpace);
 					continue;
@@ -2579,8 +2579,14 @@
 					current.isEmpty = (i - current.lineData.firstCluster + 1) == 0;
 					if (current.addLine && !current.isEmpty)
 					{
-						if (itemText.text(a) == ' ') {
-							current.glyphs[currentIndex].setFlag(ScLayout_SuppressSpace);
+						int supSpace = currentIndex;
+						while (supSpace > 0)
+						{
+							GlyphCluster& cluster = current.glyphs[supSpace];
+							if (cluster.glyphs().count() != 1 || !itemText.text(cluster.firstChar()).isSpace())
+								break;
+							cluster.setFlag(ScLayout_SuppressSpace);
+							--supSpace;
 						}
 
 						current.updateHeightMetrics();




More information about the scribus-commit mailing list