Bug 156681 - The underline line in Writer doesn't match the length of the sentence, even in simple cases
Summary: The underline line in Writer doesn't match the length of the sentence, even i...
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
7.5.5.2 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL: https://ask.libreoffice.org/t/problem...
Whiteboard: target:7.6.1 target:7.5.7 target:7.5.6
Keywords: bibisected, bisected, regression
: 156786 156923 157056 157345 (view as bug list)
Depends on:
Blocks: Zoom Kashida-Justification, Tatweel
  Show dependency treegraph
 
Reported: 2023-08-08 17:06 UTC by Victor Graus
Modified: 2023-09-21 03:29 UTC (History)
12 users (show)

See Also:
Crash report or crash signature:


Attachments
Example of underlining and text that don't match. (121.42 KB, image/jpeg)
2023-08-08 17:17 UTC, Victor Graus
Details
Underline Bug At Different Zoom Levels (52.06 KB, image/png)
2023-08-14 07:53 UTC, Tex2002ans
Details
Sample ODT with Buggy Underlining (14.21 KB, application/vnd.oasis.opendocument.text)
2023-08-14 07:54 UTC, Tex2002ans
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Victor Graus 2023-08-08 17:06:42 UTC
Description:
Many underlining bugs have been reported, I've read them but I don't know exactly if my bug is new or known.
I use both Windows 10 and 11, LibreOffice Writer, english language, font Times New Roman 12 (but it happens with other fonts), character spacing 0.0 pt (the default), line spacing 1 (the default), and I always save the documents as docx.
I open Writer (font Times New Roman 12), I press the underline button "U" and I write a long sentence, e.g:
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
which of course appears underlined, but in this case the line is two characters longer than the text.
Depending on the font and what I write, the line is longer or shorter than the text. Occasionally it has the same length.
But if I save the document as .docx and I open it with Word, the underline lines always look perfect.
I would like to attach a picture of the screen, I don't know if it's possible.

Steps to Reproduce:
1. I use both Windows 10 and 11, LibreOffice Writer, english language, font Times New Roman 12 (but it happens with other fonts), character spacing 0.0 pt (the default), line spacing 1 (the default), and I always save the documents as docx.
2. I open Writer (font Times New Roman 12)
3. I press the underline button "U" and I write a long sentence, e.g:
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
which of course appears underlined, but in this case the line is two characters longer than the text.

Actual Results:
The underline line is two characters longer than the text.

Expected Results:
The underline line should match the length of the text.


Reproducible: Always


User Profile Reset: No

Additional Info:
It happens with other fonts and sentences that I write, but then the line can be longer, shorter, or occasionally the same length.

Version:          7.5.5.2 (X86_64) / LibreOffice Community
Build:            ca8fe7424262805f223b9a233...
Environment:      CPU threats: 4; OS: Windows 10.0 Build 19044
User Interface:   UI render: Skia/Raster; VCL: win
Locale:           en-GB (en_GB); UI: en-US
Misc:             Calc threaded
Comment 1 Victor Graus 2023-08-08 17:17:13 UTC
Created attachment 188855 [details]
Example of underlining and text that don't match.
Comment 2 Victor Graus 2023-08-08 20:00:49 UTC
I have discovered that the bug depends on the zoom (bottom right corner). I always use a 123% zoom, and if I change it to 122% or 124% or others then the mismatch of the lengths changes. So the bug could be in a defective zoom tool.
Comment 3 LeroyG 2023-08-08 22:11:01 UTC
Related question:

https://ask.libreoffice.org/t/problema-con-la-sottolineatura-del-testo-errore-di-visualizzazione/94045/18

I can confirm that there is an issue with the zoom level.
Comment 4 ysui2022 2023-08-10 05:00:00 UTC
Can't produce with

Version: 7.5.4.2 (X86_64) / LibreOffice Community
Build ID: 36ccfdc35048b057fd9854c757a8b67ec53977b6
CPU threads: 8; OS: Windows 10.0 Build 22621; UI render: Skia/Vulkan; VCL: win
Locale: en-US (en_US); UI: en-US
Calc: CL threaded
Comment 5 Aaron 2023-08-11 01:09:44 UTC
Thank you for reporting the bug. I can confirm I can reproduce the bug in

Version: 7.5.5.2 (X86_64) / LibreOffice Community
Build ID: ca8fe7424262805f223b9a2334bc7181abbcbf5e
CPU threads: 4; OS: Windows 10.0 Build 19045; UI render: Skia/Raster; VCL: win
Locale: en-AU (fr_FR); UI: en-US
Calc: threaded

I can also confirm about the zoom level. It seems the issue appears for me when I change the zoom levels. I started at 100% zoom level and when I write something the line is perfect such that I thought there was no bug. But when I move to 80% zoom level then I can see the line becomes two characters longer, then I move to 120% zoom level and I can see the line becomes two characters shorter, then I move to 140% and the line changes again etc.
Comment 6 Victor Graus 2023-08-11 10:44:13 UTC
I appreciate all the comments, many thanks.
I hope that soon (several months?) we can download a new Writer version with the zoom tool fixed.
Comment 7 Tex2002ans 2023-08-14 07:53:39 UTC
Created attachment 188957 [details]
Underline Bug At Different Zoom Levels
Comment 8 Tex2002ans 2023-08-14 07:54:47 UTC
Created attachment 188958 [details]
Sample ODT with Buggy Underlining
Comment 9 Tex2002ans 2023-08-14 07:57:25 UTC
I attached a sample document + screenshot at different zoom levels.

Thanks to user "guarom" at the Collabora Office forum who created that sample document + reported the bug too.

He also said:

- Printing the document out is fine.
- Only the display of underlines inside the program is off.

- - -

There are 2 more users who have had this issue within the past 2 weeks too:

- https://www.reddit.com/r/libreoffice/comments/15h04k4/underline_doesnt_work_properly/
- https://forum.collaboraonline.com/t/writer-text-underline-preview-and-print-bug-regression/2001/6

- - -

I was able to reproduce with the attached ODT in:

Version: 7.5.5.2 (X86_64) / LibreOffice Community
Build ID: ca8fe7424262805f223b9a2334bc7181abbcbf5e
CPU threads: 8; OS: Windows 10.0 Build 19045; UI render: Skia/Vulkan; VCL: win
Locale: en-US (en_US); UI: en-US
Calc: CL threaded

so it definitely seems like it occurred between 7.5.4 + 7.5.5.
Comment 10 Aron Budea 2023-08-17 11:57:43 UTC
This is a regression that was introduced by the following commit, and its backports, as far as 7.5:
https://cgit.freedesktop.org/libreoffice/core/commit/?id=43a5400063b17ed4ba4cbb38bdf5da4a991f60e2
author		Khaled Hosny <khaled@libreoffice.org>	2023-05-25 10:59:18 +0300
committer	خالد حسني <khaled@libreoffice.org>	2023-05-25 14:18:07 +0200

"tdf#152048: Fix underline width for Kashida-justified text"

Then it got fixed by the following commit in 24.2:
https://cgit.freedesktop.org/libreoffice/core/commit/?id=507a8745870e9a755be3a72f59c6e9a9d811fdcf
author		Khaled Hosny <khaled@libreoffice.org>	2023-07-16 16:06:59 +0300
committer	خالد حسني <khaled@libreoffice.org>	2023-07-23 06:01:17 +0200

"vcl: Use doubles for glyph item coordinates"

@خالد, I'm not sure how risky the fixing commit is, would it be possible to backport at least the part that fixes this bug to 7.6 and 7.5?
Comment 11 ⁨خالد حسني⁩ 2023-08-17 14:37:09 UTC
(In reply to Aron Budea from comment #10)
> This is a regression that was introduced by the following commit, and its
> backports, as far as 7.5:
> https://cgit.freedesktop.org/libreoffice/core/commit/
> ?id=43a5400063b17ed4ba4cbb38bdf5da4a991f60e2
> author		Khaled Hosny <khaled@libreoffice.org>	2023-05-25 10:59:18 +0300
> committer	خالد حسني <khaled@libreoffice.org>	2023-05-25 14:18:07 +0200
> 
> "tdf#152048: Fix underline width for Kashida-justified text"
> 
> Then it got fixed by the following commit in 24.2:
> https://cgit.freedesktop.org/libreoffice/core/commit/
> ?id=507a8745870e9a755be3a72f59c6e9a9d811fdcf
> author		Khaled Hosny <khaled@libreoffice.org>	2023-07-16 16:06:59 +0300
> committer	خالد حسني <khaled@libreoffice.org>	2023-07-23 06:01:17 +0200
> 
> "vcl: Use doubles for glyph item coordinates"
> 
> @خالد, I'm not sure how risky the fixing commit is, would it be possible to
> backport at least the part that fixes this bug to 7.6 and 7.5?

This commit depends on a few other commits and it wouldn’t be easy to port it to release branches, and it is probably too a big of change any way.

If the bug here is considered more severe than tdf#152048, the commit for this can be reverted in the release branches.
Comment 12 Aron Budea 2023-08-17 17:03:09 UTC
@Stéphane, @Xisco, what do you suggest?
Comment 13 LeroyG 2023-08-20 20:41:45 UTC
Maybe a Windows issue.

I can't reproduce with (note that it is not the last version):

Version: 7.4.3.2 / LibreOffice Community
Build ID: 40(Build:2)
CPU threads: 1; OS: Linux 5.14; UI render: default; VCL: gtk3
Locale: es-MX (en_US.UTF-8); UI: en-US
Calc: threaded
Comment 14 LeroyG 2023-08-20 20:43:57 UTC
(In reply to LeroyG from comment #13)
> Maybe a Windows issue.

Also repro in Linux. See
https://bugs.documentfoundation.org/show_bug.cgi?id=156786#c2
Comment 15 Aron Budea 2023-08-20 21:12:51 UTC
(In reply to LeroyG from comment #13)
> I can't reproduce with (note that it is not the last version):
> 
> Version: 7.4.3.2 / LibreOffice Community
Yes, as can be seen in bug 152048, the fix causing this regression was introduced in 7.5.5.
Comment 16 Stéphane Guillou (stragu) 2023-08-21 11:57:30 UTC
*** Bug 156786 has been marked as a duplicate of this bug. ***
Comment 17 Stéphane Guillou (stragu) 2023-08-21 12:16:38 UTC
(In reply to ⁨خالد حسني⁩ from comment #11)
> If the bug here is considered more severe than tdf#152048, the commit for
> this can be reverted in the release branches.

(In reply to Aron Budea from comment #12)
> @Stéphane, @Xisco, what do you suggest?

In my opinion, the broken underline from bug 152048 is more severe than slightly extended or shorter underline, but as a regression, I think we'll see further duplicates and I'd suggest reverting the partial fix in 7.5, and recommend people affected by bug 152048 to move to 7.6, released today.

Khaled and Xisco, do you agree?
Comment 18 ⁨خالد حسني⁩ 2023-08-21 14:22:36 UTC
(In reply to Stéphane Guillou (stragu) from comment #17)
> (In reply to ⁨خالد حسني⁩ from comment #11)
> > If the bug here is considered more severe than tdf#152048, the commit for
> > this can be reverted in the release branches.
> 
> (In reply to Aron Budea from comment #12)
> > @Stéphane, @Xisco, what do you suggest?
> 
> In my opinion, the broken underline from bug 152048 is more severe than
> slightly extended or shorter underline, but as a regression, I think we'll
> see further duplicates and I'd suggest reverting the partial fix in 7.5, and
> recommend people affected by bug 152048 to move to 7.6, released today.
> 
> Khaled and Xisco, do you agree?

I have no strong opinion here, whatever the others are happy with is fine by me.
Comment 19 Xisco Faulí 2023-08-23 08:33:01 UTC
(In reply to Stéphane Guillou (stragu) from comment #17)
> (In reply to ⁨خالد حسني⁩ from comment #11)
> > If the bug here is considered more severe than tdf#152048, the commit for
> > this can be reverted in the release branches.
> 
> (In reply to Aron Budea from comment #12)
> > @Stéphane, @Xisco, what do you suggest?
> 
> In my opinion, the broken underline from bug 152048 is more severe than
> slightly extended or shorter underline, but as a regression, I think we'll
> see further duplicates and I'd suggest reverting the partial fix in 7.5, and
> recommend people affected by bug 152048 to move to 7.6, released today.
> 
> Khaled and Xisco, do you agree?

Yep, I think reverting it in release branches is the correct move here considering bug 152048 is an inherited from OOo issue
Comment 20 Commit Notification 2023-08-23 10:01:09 UTC
Xisco Fauli committed a patch related to this issue.
It has been pushed to "libreoffice-7-6":

https://git.libreoffice.org/core/commit/8e5534b478efe4f383f214b9ab41fd3383e98296

tdf#156681: Revert "tdf#152048: Fix underline width for Kashida-justified text"

It will be available in 7.6.1.

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 21 Commit Notification 2023-08-23 11:39:30 UTC
Xisco Fauli committed a patch related to this issue.
It has been pushed to "libreoffice-7-5":

https://git.libreoffice.org/core/commit/7ead6fd72bef4713baf55e786f30b6870cc85609

tdf#156681: Revert "tdf#152048: Fix underline width for Kashida-justified text"

It will be available in 7.5.7.

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 22 Stéphane Guillou (stragu) 2023-08-23 19:42:41 UTC
(In reply to ⁨خالد حسني⁩ from comment #11)
> This commit depends on a few other commits and it wouldn’t be easy to port
> it to release branches

Ah, I misunderstood that.
So yes, delaying until 24.2 then.
Thanks for reverting, Xisco, and thanks for all the fixes, Khaled! And thanks Victor, Leroy and Aron for the QA :)
Comment 23 Commit Notification 2023-08-30 10:27:51 UTC
Xisco Fauli committed a patch related to this issue.
It has been pushed to "libreoffice-7-5-6":

https://git.libreoffice.org/core/commit/0b5d67a3514f6b5f183733fa994906b9af47bbfe

tdf#156681: Revert "tdf#152048: Fix underline width for Kashida-justified text"

It will be available in 7.5.6.

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 24 Xisco Faulí 2023-09-01 15:12:14 UTC
*** Bug 157056 has been marked as a duplicate of this bug. ***
Comment 25 Stéphane Guillou (stragu) 2023-09-01 15:14:16 UTC
verified the fix in:

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

Thank you!
Comment 26 Adalbert Hanßen 2023-09-02 11:59:24 UTC
The bug is still present in 

Version: 24.2.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 78d9d0d8dccb6fd8952435b8a13d525c7606f467
CPU threads: 4; OS: Linux 5.4; UI render: default; VCL: gtk3
Locale: de-DE (de_DE.UTF-8); UI: en-US
Calc: threaded

of 2023-09-02 04:40:59. Was I too early to look at it there?
Comment 27 Adalbert Hanßen 2023-09-03 10:17:55 UTC
(In reply to Adalbert Hanßen from comment #26)
> The bug is still present in 
> 
> Version: 24.2.0.0.alpha0+ (X86_64) / LibreOffice Community
> Build ID: 78d9d0d8dccb6fd8952435b8a13d525c7606f467
> CPU threads: 4; OS: Linux 5.4; UI render: default; VCL: gtk3
> Locale: de-DE (de_DE.UTF-8); UI: en-US
> Calc: threaded
> 
> of 2023-09-02 04:40:59. Was I too early to look at it there?

Today I looked at
Version: 24.2.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 3c7a35dd28fbc337a23473873b3dd47392b883ae
CPU threads: 4; OS: Linux 5.4; UI render: default; VCL: gtk3
Locale: de-DE (de_DE.UTF-8); UI: en-US
Calc: threaded

of 2023-09-03 04:30:48 where the bug is mended.
Comment 28 BogdanB 2023-09-11 19:55:52 UTC
*** Bug 156923 has been marked as a duplicate of this bug. ***
Comment 29 Stéphane Guillou (stragu) 2023-09-20 10:21:40 UTC
*** Bug 157345 has been marked as a duplicate of this bug. ***
Comment 30 BogdanB 2023-09-21 03:29:24 UTC Comment hidden (obsolete)