Bug 153878 - Right-aligned list numbers in table cells show left-aligned when the cell width is decreased, but still enough
Summary: Right-aligned list numbers in table cells show left-aligned when the cell wid...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Writer-Tables-Alignment
  Show dependency treegraph
 
Reported: 2023-02-28 08:48 UTC by Mike Kaganski
Modified: 2023-03-14 15:56 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
List with right alignment of numbers in a table (15.51 KB, application/vnd.oasis.opendocument.text)
2023-02-28 08:48 UTC, Mike Kaganski
Details
LibreOffice 3.5 (244.20 KB, image/png)
2023-03-14 12:06 UTC, Caolán McNamara
Details
patch to illustrate the problem better (4.30 KB, patch)
2023-03-14 15:56 UTC, Caolán McNamara
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mike Kaganski 2023-02-28 08:48:02 UTC
Created attachment 185632 [details]
List with right alignment of numbers in a table

In the attachment, the list has "Numbering 123" style. The latter is edited to have right-aligned numbers, "Aligned at" 0.5 cm, "Numbering followed by" nothing, and Indent 0.

The table has spacing set to 0, to avoid size additional factors. The tab stop in the document is set to 0.8 cm.

The document uses the default Liberation Serif font, 12 pt.

The first column of the table is currently 0.92 cm. This is the width that is larger than the 0.5 cm that is provided for the number (the "Aligned at" property). The numbers (including 10 and 11) fit into 0.5 cm.

However, already at this width of 0.92 cm, the number 10 gets misaligned. If the column width is decreased further to 0.90 cm, both 10 and 11 get misaligned, as if they are left-aligned. If the column width is 0.93 cm and larger, the numbers align their right digits, as expected.

At least until the space available for the numbered paragraph is no less than the "Aligned at" property, the right-aligned list must not behave this odd.
Comment 1 Stéphane Guillou (stragu) 2023-03-14 09:59:21 UTC
Confirmed in:

Version: 7.6.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 98f35cf85ee66e995610fec92ea5224fbf28dff3
CPU threads: 8; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: en-AU (en_AU.UTF-8); UI: en-US
Calc: threaded

Regression bibisected with linux-64-7.4 repository to first bad commit 5cf430af43b97e4130348b5075ed4af004e5a624 which points to core commit:

commit ae406d7acc985c56bacd7c0e0c9658170afa907d
author	Caolán McNamara <caolanm@redhat.com>	Wed Jan 05 14:16:46 2022 +0000
committer	Caolán McNamara <caolanm@redhat.com>	Wed Jan 05 20:54:27 2022 +0100
upgrade to latest harfbuzz
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128007

Caolán, can you please have a look?
Comment 2 Caolán McNamara 2023-03-14 10:24:08 UTC
seeing as its a third party package upgrade that's been identified the route to go is probably to bisect within harfbuzz to identify what change there triggered this
Comment 3 Caolán McNamara 2023-03-14 12:06:53 UTC
Created attachment 185952 [details]
LibreOffice 3.5

back in 3.5 long before we began to use harfbuzz (IIRC) then 10 is also not right aligned so bisecting into harfbuzz probably won't fundamentally help after all
Comment 4 Caolán McNamara 2023-03-14 15:56:06 UTC
Created attachment 185955 [details]
patch to illustrate the problem better

I debugged this a little and:

The column is 0.92cm wide, so ~521 twips wide.
The numbering is aligned at 0.50cm, so there are 283 twips to the left of the alignment and 238 to the right of the alignment.

As far as I can see the initial calculation for these numbering portions is done with a width of *238*, not 283. So the width of 11 is 231 and is considered ok, but 10 is 240 which is wider than the 238, so 10 is line wrapped to give just 1 and that 10 positioned as if it was only 1. So calculation appears to be done as if the numbering was left aligned.

attached is a debugging patch to illustrate the problem if someone else wants to take on the task of figuring out what the right thing to do is. I find the problem in both the earliest version of LibreOffice I have and AOO, so I think its fundamentally inherited from OOo