r24492 by jghali - #9614: Non breaking spaces look the same as normal space when "Show Control Characters" is checked

scribus-commit scribus-commit at lists.scribus.net
Mon Feb 15 21:44:24 UTC 2021


Author: jghali
Date: Mon Feb 15 21:44:23 2021
New Revision: 24492

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=24492
Log:
#9614: Non breaking spaces look the same as normal space when "Show Control Characters" is checked

Modified:
    trunk/Scribus/scribus/text/screenpainter.cpp
    trunk/Scribus/scribus/text/specialchars.cpp
    trunk/Scribus/scribus/text/specialchars.h
    trunk/Scribus/scribus/text/textshaper.cpp

Modified: trunk/Scribus/scribus/text/screenpainter.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24492&path=/trunk/Scribus/scribus/text/screenpainter.cpp
==============================================================================
--- trunk/Scribus/scribus/text/screenpainter.cpp	(original)
+++ trunk/Scribus/scribus/text/screenpainter.cpp	Mon Feb 15 21:44:23 2021
@@ -107,7 +107,11 @@
 		if (gid >= ScFace::CONTROL_GLYPHS)
 			gid -= ScFace::CONTROL_GLYPHS;
 		else if (gid != 0)
-			gid = 32;
+		{
+			gid = gc.getText().at(0).unicode();
+			if (gid != SpecialChars::NBSPACE && gid != SpecialChars::NNBSPACE)
+				gid = 32;
+		}
 		QTransform chma, chma4;
 		FPointArray outline;
 		if (gid == 0)
@@ -159,6 +163,12 @@
 		else if (gid == SpecialChars::NBSPACE.unicode() || gid == 32)
 		{
 			stroke = (gid == 32);
+			outline = m_item->doc()->symNonBreak.copy();
+			chma4.translate(gc.xoffset, -fontSize() * gc.scaleV() * 0.4);
+		}
+		else if (gid == SpecialChars::NNBSPACE.unicode())
+		{
+			stroke = false;
 			outline = m_item->doc()->symNonBreak.copy();
 			chma4.translate(gc.xoffset, -fontSize() * gc.scaleV() * 0.4);
 		}

Modified: trunk/Scribus/scribus/text/specialchars.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24492&path=/trunk/Scribus/scribus/text/specialchars.cpp
==============================================================================
--- trunk/Scribus/scribus/text/specialchars.cpp	(original)
+++ trunk/Scribus/scribus/text/specialchars.cpp	Mon Feb 15 21:44:23 2021
@@ -53,6 +53,11 @@
 bool SpecialChars::isExpandingSpace(QChar c)
 {
 	return c == BLANK || c == NBSPACE;
+}
+
+bool SpecialChars::isFixedSpace(QChar c)
+{
+	return c == NNBSPACE;
 }
 
 bool SpecialChars::isImplicitSpace(QChar c1, QChar c2)

Modified: trunk/Scribus/scribus/text/specialchars.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24492&path=/trunk/Scribus/scribus/text/specialchars.h
==============================================================================
--- trunk/Scribus/scribus/text/specialchars.h	(original)
+++ trunk/Scribus/scribus/text/specialchars.h	Mon Feb 15 21:44:23 2021
@@ -55,6 +55,7 @@
 	static bool isBreak(QChar c, bool includeColBreak = true);
 	static bool isBreakingSpace(QChar c);
 	static bool isExpandingSpace(QChar c);
+	static bool isFixedSpace(QChar c);
 	static bool isImplicitSpace(QChar c1, QChar c2);
 	static bool isImplicitSpace(uint c1, uint c2);
 

Modified: trunk/Scribus/scribus/text/textshaper.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24492&path=/trunk/Scribus/scribus/text/textshaper.cpp
==============================================================================
--- trunk/Scribus/scribus/text/textshaper.cpp	(original)
+++ trunk/Scribus/scribus/text/textshaper.cpp	Mon Feb 15 21:44:23 2021
@@ -441,6 +441,8 @@
 
 			if (SpecialChars::isExpandingSpace(ch))
 				run.setFlag(ScLayout_ExpandingSpace);
+			else if (SpecialChars::isFixedSpace(ch))
+				run.setFlag(ScLayout_FixedSpace);
 			else if (justificationTracking.contains(firstCluster))
 				run.setFlag(ScLayout_JustificationTracking);
 




More information about the scribus-commit mailing list