Bug 155557 - Wrong rendering of underline for justified mixed RTL/LTR script text
Summary: Wrong rendering of underline for justified mixed RTL/LTR script text
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
7.6.0.0 alpha1+
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Kashida-Justification
  Show dependency treegraph
 
Reported: 2023-05-30 13:46 UTC by Hossein
Modified: 2024-05-15 13:06 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments
Screenshot of italic text (402.61 KB, image/png)
2023-06-01 11:49 UTC, ⁨خالد حسني⁩
Details
Overline for mixed RTL-LTR text (16.70 KB, application/vnd.oasis.opendocument.text)
2024-05-15 13:06 UTC, Hossein
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Hossein 2023-05-30 13:46:05 UTC
Description:
This is spin off of tdf#152048. If you underline the text for a paragraph with mixed RTL/LTR justified text, rendering of the underline for the text will be incorrect. In the above mentioned bug, the problem with RTL only text was fixed.

Steps to Reproduce:
1. Open attachment 183604 [details]. All the text should have underline

Actual Results:
The underline is cut off or rendered out of the correct region

Expected Results:
The underline should be rendered consistently below all of the text.


Reproducible: Always


User Profile Reset: No

Additional Info:
Version: 7.6.0.0.alpha1+ (X86_64) / LibreOffice Community
Build ID: d785d26a5599d3d546b96958b0f1c6d5ed777a0d
CPU threads: 12; OS: Linux 5.19; UI render: default; VCL: gtk3
Locale: en-US (en_US.UTF-8); UI: en-US
Calc: CL threaded
Comment 1 ⁨خالد حسني⁩ 2023-05-31 14:02:16 UTC
Is this a regression?
Comment 2 Commit Notification 2023-06-01 05:10:50 UTC
Khaled Hosny committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/99d22fd79c5532fd6c1b167996e1c27216b92469

tdf#155557: Fix drawing mixed direction underlined text

It will be available in 7.6.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 3 Hossein 2023-06-01 10:32:07 UTC
(In reply to خالد حسني from comment #1)
> Is this a regression?
No, as you have also mentioned in the commit description, this problem is inherited from OpenOffice.org. In the tdf#152048 attachments, I've previously attached these two files from LibreOffice 3.5, and OpenOffice.org 3.2, which both have the same problem.

Justified Persian/English text (PDF), all the text is underlined (LO 3.5)
https://bugs.documentfoundation.org/attachment.cgi?id=183614

Justified Persian/English text (PDF), all the text is underlined (OOo 3.2)
https://bugs.documentfoundation.org/attachment.cgi?id=183615
Comment 4 Hossein 2023-06-01 10:52:38 UTC
Thanks Khaled for the fix. Verified the fix with the latest master:

Version: 7.6.0.0.alpha1+ (X86_64) / LibreOffice Community
Build ID: f15a6e1b1b186bf42e1ade05630d17841add2c46
CPU threads: 12; OS: Linux 5.19; UI render: default; VCL: gtk3
Locale: en-US (en_US.UTF-8); UI: en-US
Calc: threaded

A side issue that is visible now is tdf#155623. Please take a look.
Comment 5 Hossein 2023-06-01 11:09:27 UTC
OK, let me re-open the issue because when making the text bold/italic causes the underline gap to appear again.
Comment 6 ⁨خالد حسني⁩ 2023-06-01 11:16:48 UTC
(In reply to Hossein from comment #5)
> OK, let me re-open the issue because when making the text bold/italic causes
> the underline gap to appear again.

I see a gap with italic, but it is independent of the justification, so a different bug (it is a cane of worms), but with bold I get the same tiny gap as the regular.
Comment 7 ⁨خالد حسني⁩ 2023-06-01 11:45:30 UTC
(In reply to خالد حسني from comment #6)
> (In reply to Hossein from comment #5)
> > OK, let me re-open the issue because when making the text bold/italic causes
> > the underline gap to appear again.
> 
> I see a gap with italic, but it is independent of the justification, so a
> different bug (it is a cane of worms), but with bold I get the same tiny gap
> as the regular.

Scratch that, I see the issue now. I don’t know what I was looking at last time.
Comment 8 ⁨خالد حسني⁩ 2023-06-01 11:49:38 UTC
Created attachment 187639 [details]
Screenshot of italic text

(In reply to خالد حسني from comment #7)
> (In reply to خالد حسني from comment #6)
> > (In reply to Hossein from comment #5)
> > > OK, let me re-open the issue because when making the text bold/italic causes
> > > the underline gap to appear again.
> > 
> > I see a gap with italic, but it is independent of the justification, so a
> > different bug (it is a cane of worms), but with bold I get the same tiny gap
> > as the regular.
> 
> Scratch that, I see the issue now. I don’t know what I was looking at last
> time.

Actually, my first comment was right. I attached a screenshot now.
Comment 9 Commit Notification 2023-06-01 13:50:00 UTC
Khaled Hosny committed a patch related to this issue.
It has been pushed to "master":

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

tdf#155623: Revert "tdf#155557: Fix drawing mixed direction underlined text"

It will be available in 7.6.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 10 Hossein 2024-05-15 13:06:38 UTC
Created attachment 194133 [details]
Overline for mixed RTL-LTR text

A nice observation is that if you enable "overline" via "Character Properties > Font Effects > Overlining > Single", then you will see that overlining is drawn as expected, in correct places.
One exception is that it covers some unprintable characters like "end of line", when "Toggle Formatting Marks (Ctrl + F10)" is enabled, which seems to be a different issue, probably related to tdf#150710.
Therefore, the way overline is implemented can probably be re-used for correcting the way underline is implemented.