Bug 67669 - Make narrow non-breaking spaces visible
Summary: Make narrow non-breaking spaces visible
Status: REOPENED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: Other All
: medium enhancement
Assignee: Not Assigned
URL:
Whiteboard: target:7.5.0 target:7.4.0.2 target:7.4.4
Keywords: implementationError
Depends on:
Blocks: Formatting-Mark Authors
  Show dependency treegraph
 
Reported: 2013-08-02 12:28 UTC by Olivier R.
Modified: 2022-12-19 13:34 UTC (History)
12 users (show)

See Also:
Crash report or crash signature:


Attachments
spaces in Writer (8.66 KB, image/png)
2013-08-02 12:29 UTC, Olivier R.
Details
demo document (8.98 KB, application/vnd.oasis.opendocument.text)
2022-08-10 08:30 UTC, BogdanB
Details
how I seen it with Ctrl+F8 (2.53 KB, image/png)
2022-08-10 08:31 UTC, BogdanB
Details
Both fonts using a narrow no break space (25.53 KB, image/png)
2022-08-22 20:42 UTC, Andreas Heinisch
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Olivier R. 2013-08-02 12:28:17 UTC
At the moment, non-breaking spaces can be distinguished from common spaces by their grayed background.
But there is no such thing for the non-breaking spaces which are still invisible.

See screenshot attached.

I suggest to display narrow non-breaking spaces with a lighter gray than the one used to show non-breaking spaces.
Comment 1 Olivier R. 2013-08-02 12:29:28 UTC
Created attachment 83540 [details]
spaces in Writer
Comment 2 Olivier R. 2013-08-02 12:30:11 UTC
Correction:
But there is no such thing for the _narrow_ non-breaking spaces which are still invisible.
Comment 3 Jorendc 2013-08-02 22:07:33 UTC
Hi Olivier,

THanks for reporting. Probably easy to do, but I can't find it for now: How to add a narrow non-breaking space. I know a non-breaking space can be added with ctrl+shift+space ... not sure how to do a narrow one :).

Kind regards,
Joren
Comment 4 Olivier R. 2013-08-02 22:42:57 UTC
AFAIK, there is no easy way to type this character with LO. You have to use the Insert Character command. U+202F NARROW NO-BREAK SPACE.

But I can easily add this character with my keyboard.
And now French users can easily add this character with the “text formatter”, an extension for LO I wrote to help users to format texts according to French typographic rules.

http://en.wikipedia.org/wiki/Non-breaking_space (Section Encodings)
http://www.fileformat.info/info/unicode/char/202f/index.htm
Comment 5 Jean-Baptiste Faure 2013-09-14 07:25:51 UTC
Changed status to NEW as it is an Enhancement request.

Best regards. JBF
Comment 6 Gordo 2015-06-24 15:28:51 UTC
As a workaround, copy it from the special character dialogue and put it in a user field.
1. Insert -> Fields -> More Fields -> Variables tab.
2. Under Type, select User Field.
3. Give it a name and paste the special character into the value field.
4. Click on the check mark to add it to the list
5. Insert and Close.
Now it can be reused and hovering over it in the text displays the name.

Windows Vista 64
Version: 4.4.4.2
Build ID: f784c932ccfd756d01b70b6bb5e09ff62e1b3285
Comment 7 Pierre C 2016-06-25 11:52:48 UTC
No Way to have an easy-hack her ?
From my point of view, it should be mostly a copy-paste from normal non breaking space...
Comment 8 Andreas Heinisch 2022-07-26 15:10:32 UTC
Should we use a ligther gray or just use the same gray as for the non-breaking space?
Comment 9 Andreas Heinisch 2022-07-26 15:15:29 UTC
Since even the non-breaking-hyphen has the same background ...
Comment 10 László Németh 2022-07-26 15:24:09 UTC
(In reply to Andreas Heinisch from comment #8)
> Should we use a ligther gray or just use the same gray as for the
> non-breaking space?

I think, it's better to use the same gray, standardized by the user interface to avoid of potential visibility problems. Maybe the size difference is enough to differentiate the (both fixed-length) non-breaking spaces.

@Heiko, what is your opinion?

@Andreas: thanks for handling this issue!
Comment 11 Heiko Tietze 2022-07-27 07:39:38 UTC
(In reply to László Németh from comment #10)
> I think, it's better to use the same gray, standardized by the user
> interface to avoid of potential visibility problems.

Yes, also to allow customization per tools > options > colors > Field Shading. And adding too many options there would be awkward.
Comment 12 Commit Notification 2022-07-27 07:54:41 UTC
Andreas Heinisch committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/bbb57e8198863ee7bdadd3f2aac4420c08da94a3

tdf#67669 - Make narrow no-break space visible by drawing a gray background

It will be available in 7.5.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 13 Pierre C 2022-07-27 10:19:51 UTC
IMHO It would be fine to differentiate theses two spaces. A lighter color for the thin one would be great.
Comment 14 László Németh 2022-07-27 11:02:24 UTC
(In reply to Pierre C from comment #13)
> IMHO It would be fine to differentiate theses two spaces. A lighter color
> for the thin one would be great.

It's possible to add a special sign in formatting mark color, like Adobe InDesign does (with all the other special spaces and characters), see thin space here:

https://redokun.com/blog/show-hidden-characters-indesign
Comment 15 Commit Notification 2022-07-27 20:38:19 UTC
Andreas Heinisch committed a patch related to this issue.
It has been pushed to "libreoffice-7-4":

https://git.libreoffice.org/core/commit/fb63d0a090b049c16993054f1804e440adeba5d7

tdf#67669 - Make narrow no-break space visible by drawing a gray background

It will be available in 7.4.0.2.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 16 BogdanB 2022-08-09 13:26:31 UTC
Did not work in
Version: 7.4.0.2 (x64) / LibreOffice Community
Build ID: 1512ce97d7ed39dce3121f7e15651fd8895f950e
CPU threads: 4; OS: Windows 10.0 Build 19044; UI render: Skia/Raster; VCL: win
Locale: ro-RO (ro_RO); UI: en-US
Calc: threaded

It's still invisibile...
Comment 17 Andreas Heinisch 2022-08-09 18:03:05 UTC
Checked in:
Version: 7.4.0.2 (x64) / LibreOffice Community
Build ID: 1512ce97d7ed39dce3121f7e15651fd8895f950e
CPU threads: 16; OS: Windows 10.0 Build 19044; UI render: Skia/Raster; VCL: win
Locale: de-DE (de_DE); UI: de-DE
Calc: CL

and it is visible. Can other users may check it, too?
Comment 18 Heiko Tietze 2022-08-10 06:09:51 UTC
Works with master and kf5/gtk3/gtk3/gen. Field shadings needs to be on (ctrl+F8) and the respective application color set properly.
Comment 19 BogdanB 2022-08-10 08:30:41 UTC
Created attachment 181678 [details]
demo document

This is the demo document. 
-A non-breaking space between A and B 
-A narrow no breaking space between B and C
Comment 20 BogdanB 2022-08-10 08:31:52 UTC
Created attachment 181679 [details]
how I seen it with Ctrl+F8

how I seen it with Ctrl+F8
Comment 21 Ming Hua 2022-08-10 09:23:07 UTC
(In reply to Andreas Heinisch from comment #17)
> Can other users may check it, too?
I got mixed and "interesting" test results.

If I insert the narrow non-breaking space character from menu "Insert > Formatting Mark > Insert Narrow Non-Break Space", it's invisible (no gray background shading).

OTOH, if I insert the character from the Special Characters dialog (menu "Insert > Special Character..."), it's visible.

Checking the inserted space with Alt+X shows that they are both character U+202F.  The difference is that the first invisible one is in Liberation Serif font, and the second visible one is in Liberation Sans font.  If I change the font of the first character to Liberation Serif, it becomes visible.

(In reply to BogdanB from comment #19)
> Created attachment 181678 [details]
> demo document
The above observation is also true for this sample document.  The string is in Liberation Serif font when I open it, and the narrow NBSP between B and C is invisible.  However if I select only the narrow NBSP and change its font to Liberation Sans, it becomes visible.  Selecting the whole string and changing font doesn't work, though.

All these behavior is rather puzzling to me.  Hope a developer can reproduce what I saw and sort this out.

Version Information:
Version: 7.4.0.2 (x64) / LibreOffice Community
Build ID: 1512ce97d7ed39dce3121f7e15651fd8895f950e
CPU threads: 2; OS: Windows 10.0 Build 19043; UI render: default; VCL: win
Locale: zh-CN (zh_CN); UI: zh-CN
Calc: threaded
Comment 22 BogdanB 2022-08-10 09:28:16 UTC
I confirm the behaviour noticed by Ming Hua in comment 21. It's a corner case.
Comment 23 Ming Hua 2022-08-10 09:29:15 UTC
(In reply to Ming Hua from comment #21)
> Checking the inserted space with Alt+X shows that they are both character
> U+202F.  The difference is that the first invisible one is in Liberation
> Serif font, and the second visible one is in Liberation Sans font.  If I
> change the font of the first character to Liberation Serif,
Typo here.  I meant "If I change... to Liberation *Sans*"
> it becomes
> visible.
Comment 24 BogdanB 2022-08-10 18:42:05 UTC
In content.xml this are differences

---FOR THE FILE WITH A SPACE INSERTED WITH SANS--------
<style:text-properties style:font-name="Liberation Serif" officeooo:rsid="001e498a" officeooo:paragraph-rsid="001e498a"/></style:style><style:style style:name="T1" style:family="text"><style:text-properties style:font-name="Liberation Sans"/></style:style><style:style style:name="T2" style:family="text"><style:text-properties style:font-name="Liberation Sans"/></style:style><

</text:sequence-decls><text:p text:style-name="P1">A B<text:span text:style-name="T1"> </text:span>C</text:p></office:text></office:body></office:document-content>

-------

---FOR THE FILE WITH EVERYTHING IN SERIF--------
<style:text-properties style:font-name="Liberation Sans" officeooo:rsid="001e498a" officeooo:paragraph-rsid="001e498a"/></style:style></

</text:sequence-decls><text:p text:style-name="P1">A B C</text:p></office:text></office:body></office:document-content>
Comment 25 Andreas Heinisch 2022-08-22 20:42:04 UTC
Created attachment 181957 [details]
Both fonts using a narrow no break space

hm, I still cannot reproduce it in:
Version: 7.5.0.0.alpha0+ (x64) / LibreOffice Community
Build ID: 6c0b8669e1f09a8301f3ebd1da21855d84abb2b1
CPU threads: 16; OS: Windows 10.0 Build 19044; UI render: Skia/Raster; VCL: win
Locale: de-DE (de_DE); UI: en-US
Calc: CL
Comment 26 Andreas Heinisch 2022-08-22 20:46:44 UTC
However, I can only reproduce it with the demo document once. After I change the font to Liberation Serif and back to Liberation Sans, it gets visible as well. Maybe after this fix, documents including narrow non-breaking spaces change their xml?
Comment 27 Andreas Heinisch 2022-08-22 20:48:41 UTC
Another observation: if you open the demo document and select the narrow non-breaking space and hit enter in the font box without changing anything, the nbsp gets visible.
Comment 28 Andreas Heinisch 2022-08-22 20:51:03 UTC
So, there is still some place where the NBSP has to be added in order to make it visible.
Comment 29 Commit Notification 2022-08-23 07:35:11 UTC
Andreas Heinisch committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/01e3c998e63fbf456e7f624adb1cae3d89ed7bb2

tdf#67669 - Make narrow no-break space visible by drawing a gray background

It will be available in 7.5.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 30 Andreas Heinisch 2022-08-23 07:39:54 UTC
May be tested again. Thank you for your findings!
Comment 31 BogdanB 2022-08-29 19:03:21 UTC
It's perfect now!
I tested on many fonts! it' ok
Maybe someone can confirm the same on Windows.

Verified with
Version: 7.5.0.0.alpha0+ / LibreOffice Community
Build ID: 27892a5e12dada80226f778ab2bd14b1bdaab58a
CPU threads: 16; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: ro-RO (ro_RO.UTF-8); UI: en-US
Calc: threaded
Comment 32 ⁨خالد حسني⁩ 2022-12-07 14:48:09 UTC
The changes made here are causing a regression in text layout, see bug 152413 for details.
Comment 33 Commit Notification 2022-12-07 23:31:39 UTC
Khaled Hosny committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/f6935ce552ed625281104a10695de977a131b477

tdf#152413: Revert "tdf#67669 - Make narrow no-break space visible by drawing

It will be available in 7.5.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 34 ⁨خالد حسني⁩ 2022-12-07 23:33:20 UTC
Reopening after the revert in bug 152413
Comment 35 Commit Notification 2022-12-08 10:33:53 UTC
Khaled Hosny committed a patch related to this issue.
It has been pushed to "libreoffice-7-4":

https://git.libreoffice.org/core/commit/c1553cf97e54baecb98c805b19e2913d776a33a7

tdf#152413: Revert "tdf#67669 - Make narrow no-break space visible by drawing

It will be available in 7.4.4.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.