Bug 163618 - Incorrect joining of characters in justified Arabic/Persian text inside a text box
Summary: Incorrect joining of characters in justified Arabic/Persian text inside a tex...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
5.3.0.3 release
Hardware: All All
: medium normal
Assignee: Jonathan Clark
URL:
Whiteboard: target:25.8.0 target:25.2.4
Keywords:
Depends on:
Blocks: Kashida-Justification, Tatweel
  Show dependency treegraph
 
Reported: 2024-10-25 14:51 UTC by Hossein
Modified: 2025-04-24 10:42 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
Excessive overlap of joined characters in a justified text box (33.04 KB, image/png)
2024-10-25 14:51 UTC, Hossein
Details
Screenshot illustrating the problem (9.06 KB, image/png)
2025-04-16 15:43 UTC, Jonathan Clark
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Hossein 2024-10-25 14:51:20 UTC
Created attachment 197236 [details]
Excessive overlap of joined characters in a justified text box

Description:
Even with the recent fixes for kashida placement (for example, tdf#151748), you can still see places where two joining characters have overlapped excessively, and the result is visible defects in the text rendering.

Steps to Reproduce:
1. Open attachment 183252 [details]
2. Go to the second page and zoom in to see the rendering 

Actual Results:
Excessive overlapping between joining characters

Expected Results:
Joining characters should not overlap excessively. Joining should be done in a way that there is no gap, but it should not be excessive. In a test for such cases in a justified text, I have previously set ~10% overlap at max. But, this is just a rough value.

tdf#139627 Test justified Arabic/Persian text to avoid gaps/big overlaps
https://gerrit.libreoffice.org/c/core/+/138328

Reproducible: Always


User Profile Reset: No


Additional Info:
The problem happens with the latest LO 25.2 dev master:
Version: 25.2.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 9517639bc3189e3ea4dc4d2f7004d4b33d754d47
CPU threads: 12; OS: Linux 6.2; UI render: default; VCL: gtk3
Locale: en-US (en_US.UTF-8); UI: en-US
Calc: threaded

Please note that this issue is not about misplacing an extra kashida character, but rather about slightly misplacing the characters themselves. On the other hand, this issue IS related to kashida, as joining characters (almost always) have a small horizontal half line, in the left and/or right part of them. With this half lines, printed Arabic/Persian characters overlap and join together.
Comment 1 Buovjaga 2025-03-18 17:21:48 UTC
Confirmed.

Arch Linux 64-bit
Version: 25.8.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 0c5953f1adb36ba3c5658050e6fb4b086839f210
CPU threads: 8; OS: Linux 6.13; UI render: default; VCL: kf6 (cairo+wayland)
Locale: fi-FI (fi_FI.UTF-8); UI: en-US
Calc: CL threaded
Built on 18 March 2025
Comment 2 Commit Notification 2025-04-16 15:39:12 UTC
Jonathan Clark committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/3c9fdd9aeb74d76ef7f1c0581582439c8a135532

tdf#163618 editeng: Fix excessive overlap in justified Arabic script

It will be available in 25.8.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 Jonathan Clark 2025-04-16 15:43:52 UTC
Created attachment 200361 [details]
Screenshot illustrating the problem

This screenshot shows editeng was trying to position kashida glyphs in spaces where there clearly isn't enough room for them. On the left side you can see the kashida glyph overlapping the preceding character. The right side shows the real space between the two characters.
Comment 4 Eyal Rozenberg 2025-04-16 18:06:09 UTC
Thanks, Jonathan, for another joining fix.

If only we had a more active Arabic user community to put out the word about these improvements...
Comment 5 Commit Notification 2025-04-24 10:42:03 UTC
Jonathan Clark committed a patch related to this issue.
It has been pushed to "libreoffice-25-2":

https://git.libreoffice.org/core/commit/1f444f3e69df65e484c4f00c72b78a6aa4ed34f2

tdf#163618 editeng: Fix excessive overlap in justified Arabic script

It will be available in 25.2.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.