View Issue Details

IDProjectCategoryView StatusLast Update
0010280ScribusStory Editor / Text Framespublic2017-10-28 10:17
ReporterJLuc Assigned To 
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionduplicate 
PlatformPCOS7 
Product Version1.4.0svn 
Summary0010280: Same display for spaces and not breaking spaces with "Show all characters" option on
DescriptionWhen "display / show all characters" option is on, spaces and not breaking spaces (CTRL + Spaces) display exactly the same way : as a red little o or down °

Thus it is not possible to easily check non breaking spaces.
Steps To Reproduce- display all characters
- type any sentence with both spaces and CTRL spaces non breaking spaces
Tagsspacing
PatchYes

Relationships

duplicate of 0009615 new Find a way to display all kind of spaces (thin, thick, mid, etc) differently when "Show Control Character" is enabled 
related to 0001301 closed Text frame tool is confused when clicking on existing text frames 

Activities

JLuc

2011-09-25 17:13

developer   ~0026905

Workaround : Its possible to distinguish non breaking spaces as red underlines in the story editor.

It would be handy however to distinguish these non breaking spaces in the normal view, when "display all characters" option is on.

In this mode, there are green little down ° for each space at the end of a line when this space is actually breaking the line. I dont see interest in this color since it is obvious allready when the line is broken. So this green color could be used for non breaking space instead.
Or a blue color.

JLuc

2011-09-25 17:14

developer   ~0026906

or another sign. For example a red underscored down ° (since non breaking spaces are displayed as red undescore in the story editor)

jghali

2011-09-26 21:47

administrator   ~0026912

Current code is supposed to display a stroked circle for space and a filled circle for non breakable space. Unfortunately another issue prevent the code to work properly and that one is a bit tricky to fix...

ale

2011-09-27 12:38

manager   ~0026915

jluc "other "question" is still pertinent: why is the space at the end of the line of a different color?

i know it's not a big issue, but every line which is not in the code is a chance to avoid a bug and speeds up scribus by a few microseconds...

... and every unnecessary graphical element makes the user interface "harder" to use...

so: is it of any use to anybody?

joan

2011-09-28 13:51

reporter  

Issue10280.patch (6,043 bytes)   
Index: Scribus/scribus/fonts/scface.cpp
===================================================================
--- Scribus/scribus/fonts/scface.cpp	(revision 16858)
+++ Scribus/scribus/fonts/scface.cpp	(working copy)
@@ -9,6 +9,8 @@
 #include "fonts/scface.h"
 #include "text/storytext.h"
 
+#include<QDebug>
+
 ScFace::ScFaceData::ScFaceData() : 
 	refs(0), 
 	usage(0), 
@@ -350,10 +352,8 @@
 	if (ch == SpecialChars::LINEBREAK || ch == SpecialChars::PARSEP 
 		|| ch == SpecialChars::FRAMEBREAK || ch == SpecialChars::COLBREAK 
 		|| ch == SpecialChars::TAB || ch == SpecialChars::SHYPHEN
-		 || ch == SpecialChars::ZWSPACE || ch == SpecialChars::ZWNBSPACE)
+		 || ch == SpecialChars::ZWSPACE || ch == SpecialChars::ZWNBSPACE || ch == SpecialChars::NBSPACE)
 		return CONTROL_GLYPHS + ch.unicode();
-	else if (ch == SpecialChars::NBSPACE)
-		return  m->char2CMap(QChar(' '));
 	else if(ch == SpecialChars::NBHYPHEN)
 		return  m->char2CMap(QChar('-'));
 	else
@@ -367,11 +367,10 @@
 		m->load();
 	}
 	
-	if (ch == SpecialChars::SHYPHEN)
+	if (ch == SpecialChars::SHYPHEN || ch == SpecialChars::NBSPACE)
 		return emulateGlyph(ch);
 
 	uint gl = m->char2CMap(ch);
-	
 	if (gl == 0)
 		return emulateGlyph(ch);
 	else
Index: Scribus/scribus/pageitem.cpp
===================================================================
--- Scribus/scribus/pageitem.cpp	(revision 16858)
+++ Scribus/scribus/pageitem.cpp	(working copy)
@@ -1879,12 +1879,12 @@
 		layout.scaleV = style.scaleV() / 1000.0;
 	}	
 	
-/*	if (layout.glyph == (ScFace::CONTROL_GLYPHS + SpecialChars::NBSPACE.unicode())) {
+	if (layout.glyph == (ScFace::CONTROL_GLYPHS + SpecialChars::NBSPACE.unicode())) {
 		uint replGlyph = style.font().char2CMap(QChar(' '));
 		layout.xadvance = style.font().glyphWidth(replGlyph, style.fontSize() / 10) * layout.scaleH;
 		layout.yadvance = style.font().glyphBBox(replGlyph, style.fontSize() / 10).ascent * layout.scaleV;
 	}
-	else if (layout.glyph == (ScFace::CONTROL_GLYPHS + SpecialChars::NBHYPHEN.unicode())) {
+	/* else if (layout.glyph == (ScFace::CONTROL_GLYPHS + SpecialChars::NBHYPHEN.unicode())) {
 		uint replGlyph = style.font().char2CMap(QChar('-'));
 		layout.xadvance = style.font().glyphWidth(replGlyph, style.fontSize() / 10) * layout.scaleH;
 		layout.yadvance = style.font().glyphBBox(replGlyph, style.fontSize() / 10).ascent * layout.scaleV;
@@ -1892,8 +1892,8 @@
 	else if (layout.glyph >= ScFace::CONTROL_GLYPHS) {
 		layout.xadvance = 0;
 		layout.yadvance = 0;
-	}
-	else */
+	} */
+	else
 	{
 		layout.xadvance = style.font().glyphWidth(layout.glyph, style.fontSize() / 10) * layout.scaleH;
 		layout.yadvance = style.font().glyphBBox(layout.glyph, style.fontSize() / 10).ascent * layout.scaleV;
@@ -2002,11 +2002,11 @@
 		{
 			p->translate(glyphs.xadvance, 0);
 			drawGlyphs(p, style, *glyphs.more);
-		}			
+		}
 		return;
 	}
 	else if (glyph == (ScFace::CONTROL_GLYPHS + SpecialChars::NBSPACE.unicode()) ||
-			 glyph == (ScFace::CONTROL_GLYPHS + 32)) 
+			 glyph == (ScFace::CONTROL_GLYPHS + 32))
 		glyph = style.font().char2CMap(QChar(' '));
 	else if (glyph == (ScFace::CONTROL_GLYPHS + SpecialChars::NBHYPHEN.unicode()))
 		glyph = style.font().char2CMap(QChar('-'));
@@ -2028,23 +2028,14 @@
 		// underlines when drawing a white outline
 		if (((style.effects() & ScStyle_Underline) || ((style.effects() & ScStyle_UnderlineWords) && glyph != style.font().char2CMap(QChar(' ')))) && (style.strokeColor() != CommonStrings::None))
 		{
-			double st, lw;
-			if ((style.underlineOffset() != -1) || (style.underlineWidth() != -1))
-			{
-				if (style.underlineOffset() != -1)
-					st = (style.underlineOffset() / 1000.0) * (style.font().descent(style.fontSize() / 10.0));
-				else
-					st = style.font().underlinePos(style.fontSize() / 10.0);
-				if (style.underlineWidth() != -1)
-					lw = (style.underlineWidth() / 1000.0) * (style.fontSize() / 10.0);
-				else
-					lw = qMax(style.font().strokeWidth(style.fontSize() / 10.0), 1.0);
-			}
-			else
-			{
-				st = style.font().underlinePos(style.fontSize() / 10.0);
-				lw = qMax(style.font().strokeWidth(style.fontSize() / 10.0), 1.0);
-			}
+			double st = style.font().underlinePos(style.fontSize() / 10.0);
+			double lw = qMax(style.font().strokeWidth(style.fontSize() / 10.0), 1.0);
+
+			if (style.underlineOffset() != -1)
+				st = (style.underlineOffset() / 1000.0) * (style.font().descent(style.fontSize() / 10.0));
+			if (style.underlineWidth() != -1)
+				lw = (style.underlineWidth() / 1000.0) * (style.fontSize() / 10.0);
+
 			if (style.baselineOffset() != 0)
 				st += (style.fontSize() / 10.0) * glyphs.scaleV * (style.baselineOffset() / 1000.0);
 			QColor tmpC = p->pen();
@@ -2146,23 +2137,14 @@
 		}
 		if ((style.effects() & ScStyle_Strikethrough) && (style.strokeColor() != CommonStrings::None))
 		{
-			double st, lw;
-			if ((style.strikethruOffset() != -1) || (style.strikethruWidth() != -1))
-			{
-				if (style.strikethruOffset() != -1)
-					st = (style.strikethruOffset() / 1000.0) * (style.font().ascent(style.fontSize() / 10.0));
-				else
-					st = style.font().strikeoutPos(style.fontSize() / 10.0);
-				if (style.strikethruWidth() != -1)
-					lw = (style.strikethruWidth() / 1000.0) * (style.fontSize() / 10.0);
-				else
-					lw = qMax(style.font().strokeWidth(style.fontSize() / 10.0), 1.0);
-			}
-			else
-			{
-				st = style.font().strikeoutPos(style.fontSize() / 10.0);
-				lw = qMax(style.font().strokeWidth(style.fontSize() / 10.0), 1.0);
-			}
+			double st = style.font().strikeoutPos(style.fontSize() / 10.0);
+			double lw = qMax(style.font().strokeWidth(style.fontSize() / 10.0), 1.0);
+
+			if (style.strikethruOffset() != -1)
+				st = (style.strikethruOffset() / 1000.0) * (style.font().ascent(style.fontSize() / 10.0));
+			if (style.strikethruWidth() != -1)
+				lw = (style.strikethruWidth() / 1000.0) * (style.fontSize() / 10.0);
+
 			if (style.baselineOffset() != 0)
 				st += (style.fontSize() / 10.0) * glyphs.scaleV * (style.baselineOffset() / 1000.0);
 			p->setPen(p->brush());
Issue10280.patch (6,043 bytes)   

joan

2011-09-28 13:51

reporter   ~0026922

@jghali
Before reading your note, I found the part of code that need to be uncommented (in pageitem.cpp line 1882 to 1886) + some change (in scface.cpp) for resolving this issue. (uploaded patch)

I think that the patch resolves the issue has described here but it may have side effects if you know that "another issue prevent the code to work properly".

if nobody is working on this other issue, can you tell me more about the other issue so i may have a look?

Kunda

2016-03-10 15:24

updater   ~0039109

@joan are you still available to look in to this?

@jghali did you see the patch ?

jghali

2016-03-10 16:05

administrator   ~0039115

Last edited: 2016-03-10 16:06

Yes i saw it. A patch which remove comments from commented out code is most likely not correct. Code commented out is usually experimental or cause issues.

JLuc

2017-10-28 10:17

developer   ~0044609

go to 0009615

Issue History

Date Modified Username Field Change
2011-09-25 16:40 JLuc New Issue
2011-09-25 17:13 JLuc Note Added: 0026905
2011-09-25 17:14 JLuc Note Added: 0026906
2011-09-26 21:47 jghali Note Added: 0026912
2011-09-27 12:38 ale Note Added: 0026915
2011-09-28 13:51 joan File Added: Issue10280.patch
2011-09-28 13:51 joan Note Added: 0026922
2015-09-17 20:08 Kunda Category Story Editor / Text Frames => Story Ed/Txt Frames
2015-09-17 20:12 Kunda Category Story Ed/Txt Frames => Story Editor / Text Frames
2016-03-10 15:23 Kunda Patch => Yes
2016-03-10 15:24 Kunda Note Added: 0039109
2016-03-10 16:05 jghali Note Added: 0039115
2016-03-10 16:06 jghali Note Edited: 0039115
2016-03-14 13:16 Kunda Relationship added related to 0001301
2017-10-28 10:15 JLuc Tag Attached: spacing
2017-10-28 10:17 JLuc Relationship added duplicate of 0009615
2017-10-28 10:17 JLuc Status new => closed
2017-10-28 10:17 JLuc Resolution open => duplicate
2017-10-28 10:17 JLuc Note Added: 0044609