Bug 139627 - Justified paragraph rendering defect when inserting Arabic diacritics
Summary: Justified paragraph rendering defect when inserting Arabic diacritics
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
6.3.0.4 release
Hardware: All All
: medium normal
Assignee: ⁨خالد حسني⁩
URL:
Whiteboard: target:7.5.0 inReleaseNotes:7.5
Keywords:
Depends on:
Blocks: RTL-CTL Kashida-Justification
  Show dependency treegraph
 
Reported: 2021-01-15 09:17 UTC by افشین
Modified: 2022-12-07 16:19 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
Justified (25.16 KB, image/png)
2021-01-15 09:19 UTC, افشین
Details
dash under letter and space between letter. (6.72 KB, image/png)
2021-01-15 09:19 UTC, افشین
Details
Minimal file to reproduce justified text rendering problem with Arabic diacritics (11.47 KB, application/vnd.oasis.opendocument.text)
2021-02-12 06:16 UTC, Hossein
Details
Bad overlapping of characters in the last line (10.17 KB, application/pdf)
2022-08-20 12:49 UTC, Hossein
Details
Bad overlapping of characters in page 4, shown using a pointer (66.92 KB, image/jpeg)
2022-08-20 12:57 UTC, Hossein
Details

Note You need to log in before you can comment on or make changes to this bug.
Description افشین 2021-01-15 09:17:22 UTC
Description:
Hello.
My documents are in Persian (Farsi) language.
When I set the alignment of the paragraph relative to the "Justified", inserts a dash line under some letters of word and a space between of that word!



Actual Results:
Inserts a dash line under some letters of word and a space between of that word!

Expected Results:
There should be no space between the letters and line under the letters. 


Reproducible: Always


User Profile Reset: No



Additional Info:
I think there is this bug only in RTL direction language, for example Persian (Farsi).
Comment 1 افشین 2021-01-15 09:19:06 UTC
Created attachment 168899 [details]
Justified
Comment 2 افشین 2021-01-15 09:19:59 UTC
Created attachment 168900 [details]
dash under letter and space between letter.
Comment 3 Hossein 2021-02-12 06:11:22 UTC
I can confirm that the bug is present, even in the latest LibreOffice 7.2 Dev master build. The problem arises when some harakat (Arabic diacritic) is inserted.

https://en.wikipedia.org/wiki/Arabic_diacritics

The problem with justified text is a long lasted bug, which is important to fix, because it affects multiple languages that use Arabic script, like Arabic itself and also "Persian (Farsi/Dari), Uyghur, Kurdish, Punjabi, Sindhi, Balochi, Pashto, Lurish, Urdu, Kashmiri, Rohingya, Somali and Mandinka."

https://en.wikipedia.org/wiki/Arabic_script
Comment 4 Hossein 2021-02-12 06:16:55 UTC
Created attachment 169697 [details]
Minimal file to reproduce justified text rendering problem with Arabic diacritics

This is the minimal file to reproduce justified text rendering problem with Arabic diacritics.

This file is tested with the latest LibreOffice master build (7.2 Dev).
Comment 5 Buovjaga 2021-03-24 08:46:25 UTC
In 6.3 there happened two changes. The rendering of attachment 169697 [details] in the oldest of 6.3 shows the first paragraph on page 1 is shown as not justified and the others on page 1 with a huge gap. With this change, even the first paragraph is shown with a huge gap:
https://git.libreoffice.org/core/commit/0a8e9cc5c1782f1cd50ef338ec2aa4f6776a4c0e
tdf#124109: Revert "Only do kashida insertion with fonts that have non-zero width kashidas"

The other change in 6.3 brought the current state:
https://git.libreoffice.org/core/commit/f8ca6e0a59bff51fcb09af4fa6d9cd458b32f223
tdf#124109: Fix missing kashida glyphs

Also seen on Windows

Version: 7.2.0.0.alpha0+ (x64) / LibreOffice Community
Build ID: bdbb5d0389642c0d445b5779fe2a18fda3e4a4d4
CPU threads: 2; OS: Windows 10.0 Build 19042; UI render: default; VCL: win
Locale: fi-FI (fi_FI); UI: en-US
Calc: threaded
Comment 6 Commit Notification 2022-08-14 19:12:43 UTC
Khaled Hosny committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/72e56537d4bb9411229346da977d1d669ccfca9a

tdf#139627: Don’t set Kashida insertion position after combining marks

It will be available in 7.5.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 7 Hossein 2022-08-20 12:49:12 UTC
Created attachment 181901 [details]
Bad overlapping of characters in the last line

If you look carefully to the output, in the last line the characters are overlapped together incorrectly. By incorrect, I mean that they are overlapped too much, and the result a break is visible in the joining point of the characters.

This is happening on Windows.

Version: 7.5.0.0.alpha0+ (x64) / LibreOffice Community
Build ID: f505d8fee149f089090b208db99a7b4107af76e9
CPU threads: 4; OS: Windows 10.0 Build 19044; UI render: Skia/Raster; VCL: win
Locale: fa-IR (fa_IR); UI: en-US
Calc: threaded
Comment 8 ⁨خالد حسني⁩ 2022-08-20 12:51:34 UTC
(In reply to Hossein from comment #7)
> Created attachment 181901 [details]
> Bad overlapping of characters in the last line
> 
> If you look carefully to the output, in the last line the characters are
> overlapped together incorrectly. By incorrect, I mean that they are
> overlapped too much, and the result a break is visible in the joining point
> of the characters.
> 
> This is happening on Windows.
> 
> Version: 7.5.0.0.alpha0+ (x64) / LibreOffice Community
> Build ID: f505d8fee149f089090b208db99a7b4107af76e9
> CPU threads: 4; OS: Windows 10.0 Build 19044; UI render: Skia/Raster; VCL:
> win
> Locale: fa-IR (fa_IR); UI: en-US
> Calc: threaded

There are small overlaps like this, but I have not been able to track them down. They usually happen when we added Kashidas more than there is enough space for them.
Comment 9 Hossein 2022-08-20 12:57:01 UTC
Created attachment 181902 [details]
Bad overlapping of characters in page 4, shown using a pointer
Comment 10 Hossein 2022-08-20 12:58:29 UTC
@Khaled,
Please see the above overlapping problem.

Also, there is a glitch on 100% zoom level which I have filed as another issue, bug 150516.
Comment 11 Hossein 2022-08-20 13:01:26 UTC
(In reply to خالد حسني from comment #8)
> (In reply to Hossein from comment #7)
> > Created attachment 181901 [details]
> > Bad overlapping of characters in the last line
> > 
> > If you look carefully to the output, in the last line the characters are
> > overlapped together incorrectly. By incorrect, I mean that they are
> > overlapped too much, and the result a break is visible in the joining point
> > of the characters.
> > 
> > This is happening on Windows.
> > 
> > Version: 7.5.0.0.alpha0+ (x64) / LibreOffice Community
> > Build ID: f505d8fee149f089090b208db99a7b4107af76e9
> > CPU threads: 4; OS: Windows 10.0 Build 19044; UI render: Skia/Raster; VCL:
> > win
> > Locale: fa-IR (fa_IR); UI: en-US
> > Calc: threaded
> 
> There are small overlaps like this, but I have not been able to track them
> down. They usually happen when we added Kashidas more than there is enough
> space for them.

Let me check with the exact version of Tahoma font from Windows 10 to see if it is Windows-specific or not. With the version of Tahoma on Linux, I don't see this overlap right now.
Comment 12 Commit Notification 2022-08-31 19:17:43 UTC
Hossein committed a patch related to this issue.
It has been pushed to "master":

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

tdf#139627 Test justified Arabic/Persian text to avoid gaps/big overlaps

It will be available in 7.5.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 13 Stéphane Guillou (stragu) 2022-12-07 16:19:36 UTC
Fix verified in:

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