View Issue Details

IDProjectCategoryView StatusLast Update
0009614ScribusGeneralpublic2017-10-28 10:18
Reportercharette.s Assigned To 
PrioritynormalSeverityminorReproducibilityalways
Status newResolutionopen 
Product Version1.5.0svn 
Target VersionFixed in Version 
Summary0009614: [Patch] Non breaking spaces look the same as normal space when "Show Control Characters" is checked
DescriptionThere's no way to make the difference between spaces and nbsp since they both look the same. I spoke with vox_@irc.freenode.net#scribus and he had a look at the code. He said: "According to the code it should fill nbspaces and use an open circle for normal spaces" which it doesn't.
Steps To ReproduceInsert a space and a non-breaking space in a text frame and check view > show control character.
Additional Informationhttp://dl.dropbox.com/u/2759157/nbsp.png (attached to ticket)
Tags#pending, #rottenpatch, control characters, patch, spacing
PatchYes

Relationships

related to 0013373 new No way to distinguish a common space from a non-breaking space for frames with Russian text 
related to 0005592 new display narrow no-break space (U+202f) in story editor 
related to 0010301 new All types of non breaking spaces should be displayed as red underscore in story editor 
related to 0013892 closedfschmid Opening a file created with Scribus 1.4.x, inserting any type of spaces except nbsp (non-breaking space) is disabled 
related to 0009615 new Find a way to display all kind of spaces (thin, thick, mid, etc) differently when "Show Control Character" is enabled 
child of 0004004 acknowledged Metabug: Typographic spacing 

Activities

ale

2012-12-07 18:33

manager   ~0029340

... i'll have a look at it...

ale

2012-12-13 08:25

manager   ~0029363

the glyph seems to be drawn in void PageItem::drawGlyphs(). the problem seems to be that glyph is set to 32 for both the nbsp and the normal space...

pygmee

2012-12-13 15:45

developer   ~0029364

yes, scribus has to improve space support. Especially we should try to keep all kind of space even if they are not included in the font. I had a python script that nearly did that by attaching a default font with char style to special spaces, but i guess something better has to be done and included as a default or preference.
Plus all kind of spaces should have a different indicator to show the user that what he done (like char insertion) has been taken in account correctly even if it doesn't show as width on page.

ale

2012-12-13 18:37

manager   ~0029365

i've to look further at it, but i'm still wondering why my epub exporter sees a difference between the two spaces and the drawGlyphs() function not...

pygmee

2012-12-13 23:15

developer   ~0029368

I included some changes here and there and i know have a real differnce in display with normal space. But i could succeed in display properly Nbspaces. It seems there are several places where nbspaces are replace with Qchar(' '). Could it be the problem ?
strangely. Nbspaces are correctly detected and displayed in storyeditor. But should display them the same way there.
I polished the space display (too heavy). I think i'll go on with other specialChars.

pygmee

2012-12-13 23:15

developer  

NBspace.diff (6,530 bytes)
Index: scribus/pageitem.cpp
===================================================================
--- scribus/pageitem.cpp	(révision 17956)
+++ scribus/pageitem.cpp	(copie de travail)
@@ -2449,10 +2449,10 @@
                (glyph == font.char2CMap(QChar(' ')) || glyph >=  ScFace::CONTROL_GLYPHS))
        {
                bool stroke = false;
-		if (glyph >=  ScFace::CONTROL_GLYPHS)
+        if (glyph >=  ScFace::CONTROL_GLYPHS)
                        glyph -= ScFace::CONTROL_GLYPHS;
                else
-			glyph = 32;
+            glyph = 32;
                QTransform chma, chma4, chma5;
                FPointArray points;
                if (glyph == SpecialChars::TAB.unicode())
@@ -2480,17 +2480,24 @@
                        points = m_Doc->symNewLine.copy();
                        chma4.translate(glyphs.xoffset, glyphs.yoffset-((style.fontSize() / 10.0) * glyphs.scaleV * 0.4));
                }
-		else if (glyph == SpecialChars::NBSPACE.unicode() ||
-				 glyph == 32)
+        else if (glyph == 32)
                {
                        stroke = (glyph == 32);
-			points = m_Doc->symNonBreak.copy();
-			chma4.translate(glyphs.xoffset, glyphs.yoffset-((style.fontSize() / 10.0) * glyphs.scaleV * 0.4));
+            points = m_Doc->symNonBreak.copy();
+            chma4.scale(0.4,0.4);
+            chma4.translate(glyphs.xoffset+4, glyphs.yoffset-((style.fontSize() / 10.0) * glyphs.scaleV * 0.8));
                }
-		else if (glyph == SpecialChars::NBHYPHEN.unicode())
+        else if (glyph == SpecialChars::NBSPACE.unicode())
+        {
+            stroke = (glyph == 32);
+            points = m_Doc->symNonBreak.copy();
+            chma4.translate(glyphs.xoffset, glyphs.yoffset-((style.fontSize() / 10.0) * glyphs.scaleV * 0.8));
+        }
+        else if (glyph == SpecialChars::NBHYPHEN.unicode())
                {
-			points = font.glyphOutline(font.char2CMap(QChar('-')), style.fontSize() / 100);
+            points = font.glyphOutline(font.char2CMap(QChar('-')), style.fontSize() / 100);
                        chma4.translate(glyphs.xoffset, glyphs.yoffset-((style.fontSize() / 10.0) * glyphs.scaleV));
+            chma4.scale(0.5,0.5);
                }
                else if (glyph == SpecialChars::SHYPHEN.unicode())
                {
@@ -2522,8 +2529,8 @@
                if (stroke)
                {
                        QColor tmp = p->pen();
-			p->setPen(p->brush(), 1, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin);
-			p->setLineWidth(style.fontSize() * glyphs.scaleV / 200.0);
+            p->setPen(p->brush(), 1, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin);
+            p->setLineWidth(style.fontSize() * glyphs.scaleV / 400.0);
                        p->strokePath();
                        p->setPen(tmp, 1, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin);
                }
@@ -2540,9 +2547,9 @@
                }
                return;
        }
-	else if (glyph == (ScFace::CONTROL_GLYPHS + SpecialChars::NBSPACE.unicode()) ||
+    else if (glyph == (ScFace::CONTROL_GLYPHS + SpecialChars::NBSPACE.unicode()) ||
                         glyph == (ScFace::CONTROL_GLYPHS + 32))
-		glyph = font.char2CMap(QChar(' '));
+        glyph = font.char2CMap(QChar(' '));
        else if (glyph == (ScFace::CONTROL_GLYPHS + SpecialChars::NBHYPHEN.unicode()))
                glyph = font.char2CMap(QChar('-'));

Index: scribus/scribusdoc.h
===================================================================
--- scribus/scribusdoc.h	(révision 17956)
+++ scribus/scribusdoc.h	(copie de travail)
@@ -1352,7 +1352,8 @@
        FPointArray symNewLine;
        FPointArray symTab;
        FPointArray symNonBreak;
-	FPointArray symNewCol;
+    FPointArray symSpace;
+    FPointArray symNewCol;
        FPointArray symNewFrame;

        Hyphenator * docHyphenator;
Index: scribus/fonts/scface.cpp
===================================================================
--- scribus/fonts/scface.cpp	(révision 17956)
+++ scribus/fonts/scface.cpp	(copie de travail)
@@ -342,11 +342,11 @@
 {
        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::OBJECT)
+        || ch == SpecialChars::TAB || ch == SpecialChars::SHYPHEN
+         || ch == SpecialChars::ZWSPACE || ch == SpecialChars::ZWNBSPACE || ch==SpecialChars::OBJECT)
                return CONTROL_GLYPHS + ch.unicode();
-	else if (ch == SpecialChars::NBSPACE)
-		return  m->char2CMap(QChar(' '));
+    else if (ch == SpecialChars::NBSPACE)
+        return  m->char2CMap(QChar(' '));
        else if(ch == SpecialChars::NBHYPHEN)
                return  m->char2CMap(QChar('-'));
        else
Index: scribus/scpageoutput.cpp
===================================================================
--- scribus/scpageoutput.cpp	(révision 17956)
+++ scribus/scpageoutput.cpp	(copie de travail)
@@ -500,7 +500,7 @@
 {
        uint glyph = glyphs.glyph;
        if (glyph == (ScFace::CONTROL_GLYPHS + SpecialChars::NBSPACE.unicode())) // NBSPACE
-		glyph = style.font().char2CMap(QChar(' '));
+        glyph = style.font().char2CMap(QChar(' '));
        else if (glyph == (ScFace::CONTROL_GLYPHS + SpecialChars::NBHYPHEN.unicode())) // NBHYPHEN
                glyph = style.font().char2CMap(QChar('-'));

Index: scribus/scribusdoc.cpp
===================================================================
--- scribus/scribusdoc.cpp	(révision 17956)
+++ scribus/scribusdoc.cpp	(copie de travail)
@@ -2512,7 +2512,10 @@
        symTab.addQuadPoint(5.90625, 0.828125, 5.90625, 0.828125, 6.9375, 1.79688, 6.9375, 1.64062);
        symTab.addQuadPoint(6.9375, 1.79688, 6.9375, 1.79688, 5.95312, 2.96875, 6.9375, 1.95312);
        symTab.addQuadPoint(5.95312, 2.96875, 5.95312, 2.96875, 4.82812, 3.96875, 4.98438, 3.96875);
-	symNonBreak.resize(0);
+    symSpace.resize(0);
+    symSpace.addQuadPoint(1.32812, 2.59375, 1.32812, 2.59375, 0.390625, 2.21875, 0.796875, 2.59375);
+//    symSpace.addQuadPoint(0.390625, 2.21875, 0.390625, 2.21875, 0, 1.3125, 0, 1.84375);
+    symNonBreak.resize(0);
        symNonBreak.addQuadPoint(1.32812, 2.59375, 1.32812, 2.59375, 0.390625, 2.21875, 0.796875, 2.59375);
        symNonBreak.addQuadPoint(0.390625, 2.21875, 0.390625, 2.21875, 0, 1.3125, 0, 1.84375);
        symNonBreak.addQuadPoint(0, 1.3125, 0, 1.3125, 0.390625, 0.390625, 0, 0.765625);
NBspace.diff (6,530 bytes)

Kunda

2016-04-07 20:48

manager  

nbsp.png (30,312 bytes)
nbsp.png (30,312 bytes)

Kunda

2016-12-09 02:46

manager   ~0042807

@fahad if you have a moment, do you mind checking out the validity of this patch ?

Fahad

2016-12-11 03:10

developer   ~0042851

The patch is outdate. Things have changed by merging CTL.
@charette.s could you update the patch to 1.5.3svn?

Issue History

Date Modified Username Field Change
2010-12-24 17:10 charette.s New Issue
2012-12-07 18:33 ale Note Added: 0029340
2012-12-13 08:25 ale Note Added: 0029363
2012-12-13 15:45 pygmee Note Added: 0029364
2012-12-13 18:37 ale Note Added: 0029365
2012-12-13 23:15 pygmee Note Added: 0029368
2012-12-13 23:15 pygmee File Added: NBspace.diff
2016-04-01 13:08 Kunda Relationship added related to 0010301
2016-04-01 13:08 Kunda Relationship added related to 0013892
2016-04-07 20:47 Kunda Patch => Yes
2016-04-07 20:48 Kunda File Added: nbsp.png
2016-04-07 20:48 Kunda Additional Information Updated View Revisions
2016-04-07 20:54 Kunda Relationship added related to 0013373
2016-04-07 20:54 Kunda Relationship added related to 0005592
2016-04-07 20:54 Kunda Relationship added child of 0004004
2016-04-07 20:58 Kunda Summary Non breaking spaces look the same as normal space when "Show Control Characters" is checked => [Patch] Non breaking spaces look the same as normal space when "Show Control Characters" is checked
2016-04-26 22:10 Kunda Relationship added related to 0009615
2016-05-24 19:24 Kunda Tag Attached: control characters
2016-12-09 02:46 Kunda Note Added: 0042807
2016-12-09 02:47 Kunda Tag Attached: #pending
2016-12-09 02:47 Kunda Tag Attached: patch
2016-12-11 03:10 Fahad Note Added: 0042851
2017-10-28 10:12 JLuc Tag Attached: spacing
2017-10-28 10:18 JLuc Tag Attached: #rottenpatch