Bug 157612 - Calc blank digit ('?') format have the wrong width
Summary: Calc blank digit ('?') format have the wrong width
Status: RESOLVED DUPLICATE of bug 158890
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
7.6.2.1 release
Hardware: x86-64 (AMD64) All
: medium enhancement
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: needsDevAdvice
: 165562 (view as bug list)
Depends on:
Blocks: Number-Format
  Show dependency treegraph
 
Reported: 2023-10-05 09:43 UTC by Vincent Boudry
Modified: 2025-03-16 15:39 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:


Attachments
Misalignement, using Liberation Sans Narrow font and 0,??? format (5.77 KB, image/png)
2023-10-05 09:46 UTC, Vincent Boudry
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Vincent Boudry 2023-10-05 09:43:50 UTC
Description:
The new format "Blank digit ('?') in clacl number format work fine in 7.6.2, but the width of the blank is incorrect in non-mono spacing fonts.
It should be the wdith of a digit (0), not a standard blank.

Steps to Reproduce:
1. Create a range of number in calc:
0,442  
1,169  
7,6    

2.Format the cells using the personnalised format: 0,???
3.Check alignment (see attachement)

Actual Results:
the dots (comma in French example here) are not aligned.

Expected Results:
dot/comma should be aligned


Reproducible: Always


User Profile Reset: No

Additional Info:
Version: 7.6.2.1 (X86_64) / LibreOffice Community
Build ID: 56f7684011345957bbf33a7ee678afaf4d2ba333
CPU threads: 4; OS: Mac OS X 13.6; UI render: default; VCL: osx
Locale: fr-FR (fr_FR.UTF-8); UI: fr-FR
Calc: threaded
Comment 1 Vincent Boudry 2023-10-05 09:46:13 UTC
Created attachment 190038 [details]
Misalignement, using Liberation Sans Narrow font and 0,??? format
Comment 2 Mike Kaganski 2023-10-05 10:41:04 UTC
It is just a normal space - even if it would be nice if it were a special space.
And it's not new - it was there ~always. Some work was on this character lately to improve its round-trip, but that wasn't introduction of the feature. So - changing it isn't really easy, because of documents already using it (where the change could introduce problems).
Comment 3 Mike Kaganski 2023-10-05 10:47:25 UTC
Also: can we assume that U+2007 FIGURE SPACE is universally available in fonts?
Comment 4 Vincent Boudry 2023-10-05 11:21:59 UTC
I was thinking that the mechanism behind the "_C" format inserting a blank the width of character C could be used.
(see Spaces on file:///Applications/Editing/LibreOffice7.6.2.app/Contents/Resources/help/en-US/text/shared/01/05020301.html?&DbPAR=CALC&System=MAC)
Here ? inserting _0 (no idea how this is implemented).

But this doesn't solve any back compatibility.

Bests,
Vincent.
Comment 5 Stéphane Guillou (stragu) 2023-10-23 19:44:19 UTC
(In reply to Vincent Boudry from comment #4)
> (see Spaces on
> file:///Applications/Editing/LibreOffice7.6.2.app/Contents/Resources/help/en-
> US/text/shared/01/05020301.html?&DbPAR=CALC&System=MAC)

Direct link: https://help.libreoffice.org/7.6/en-US/text/shared/01/05020301.html#hd_id3154330

I only realise now that Calc aligns digits regardless of if the font used is monospace or not. (Easily visible when comparing some right-aligned numbers using Liberation Sans Narrow in Calc vs Writer.)

Mike, I obviously know nothing about how it is implemented, but why couldn't the same mechanics be used here? (Keep the space character that is already used, but with the extra padding that results in having the same width as all other digits.)

In any case, agreeing that the display should be improved, but making this an enhancement request.
Comment 6 Mike Kaganski 2023-10-23 20:45:36 UTC
(In reply to Stéphane Guillou (stragu) from comment #5)
> (In reply to Vincent Boudry from comment #4)
> 
> Direct link:
> https://help.libreoffice.org/7.6/en-US/text/shared/01/05020301.
> html#hd_id3154330
> 
> why couldn't the same mechanics be used here?

I agree that it is likely reasonable and doable.
Comment 7 Mike Kaganski 2025-03-04 05:51:25 UTC
*** Bug 165562 has been marked as a duplicate of this bug. ***
Comment 8 studog 2025-03-09 04:55:35 UTC
(In reply to Vincent Boudry from comment #4)
> I was thinking that the mechanism behind the "_C" format inserting a blank
> the width of character C could be used.
> (see Spaces on
> file:///Applications/Editing/LibreOffice7.6.2.app/Contents/Resources/help/en-
> US/text/shared/01/05020301.html?&DbPAR=CALC&System=MAC)
> Here ? inserting _0 (no idea how this is implemented).

I just tried this with my example from https://bugs.documentfoundation.org/show_bug.cgi?id=165562 using '_0' to specify [ a space the width of the 0 ].
_0.???
._0???
.?_0??
.??_0?
.???_0
all produce incorrect results. Mainly, it seems that the meta formatting is treated as actual formatting, and a space is inserted at the point where the '_0' part appears.


Version: 24.8.4.2 (X86_64) / LibreOffice Community
Build ID: 480(Build:2)
CPU threads: 16; OS: Linux 6.8; UI render: default; VCL: gtk3
Locale: en-US (C.UTF-8); UI: en-US
Ubuntu package version: 4:24.8.4~rc2-0ubuntu0.24.04.1~lo1
Calc: threaded
Comment 9 Laurent Balland 2025-03-16 15:39:15 UTC
It should be fixed in 24.8, as U+2007 FIGURE SPACE is now used. See:
https://opengrok.libreoffice.org/xref/core/svl/source/numbers/zformat.cxx#69

*** This bug has been marked as a duplicate of bug 158890 ***