Bug 106653 - RTL Arabic text has some gaps between characters
Summary: RTL Arabic text has some gaps between characters
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
5.3.0.3 release
Hardware: All Linux (All)
: medium normal
Assignee: خالد حسني
URL:
Whiteboard: target:7.5.0
Keywords: bibisected, bisected, regression
Depends on: 104921
Blocks: Font-Rendering Kashida-Justification
  Show dependency treegraph
 
Reported: 2017-03-20 01:45 UTC by Munzir Taha
Modified: 2022-08-20 16:40 UTC (History)
7 users (show)

See Also:
Crash report or crash signature:
Regression By: Khaled Hosny


Attachments
libO introduced gaps in some words (12.34 KB, application/vnd.oasis.opendocument.text)
2017-03-20 01:47 UTC, Munzir Taha
Details
PDF export also has the same issue (7.91 KB, application/pdf)
2017-03-20 01:48 UTC, Munzir Taha
Details
reproduceable without marks (9.47 KB, application/vnd.oasis.opendocument.text)
2017-03-23 05:06 UTC, Munzir Taha
Details
reproduceable without marks (screenshot) (28.76 KB, image/png)
2017-03-23 05:07 UTC, Munzir Taha
Details
source document (8.15 KB, application/vnd.oasis.opendocument.text)
2017-07-06 01:55 UTC, Munzir Taha
Details
The good (127.92 KB, image/png)
2017-07-06 01:57 UTC, Munzir Taha
Details
The bad (114.02 KB, image/png)
2017-07-06 01:58 UTC, Munzir Taha
Details
A repeated text in Farsi with several fonts (17.31 KB, application/vnd.oasis.opendocument.text)
2019-04-04 16:15 UTC, Babak Razmjoo
Details
The PDF generated by LibreOffice 6.1.5.2 from the previous file (154.56 KB, application/pdf)
2019-04-04 16:16 UTC, Babak Razmjoo
Details
The PDF generated by LibreOffice 6.2.2.2 from the previous file (154.81 KB, application/pdf)
2019-04-04 16:17 UTC, Babak Razmjoo
Details
How LibreOffice 6.2.2.2 actually displays this text- part 1 (42.32 KB, image/png)
2019-04-04 16:21 UTC, Babak Razmjoo
Details
How LibreOffice 6.2.2.2 actually displays this text- part 2 (41.48 KB, image/png)
2019-04-04 16:22 UTC, Babak Razmjoo
Details
How LibreOffice 6.2.2.2 actually displays this text- part 3 (40.13 KB, image/png)
2019-04-04 16:23 UTC, Babak Razmjoo
Details
How LibreOffice 6.2.2.2 actually displays this text- part 4 (32.24 KB, image/png)
2019-04-04 16:24 UTC, Babak Razmjoo
Details
How LibreOffice 6.2.2.2 actually displays this text- part 5 (36.07 KB, image/png)
2019-04-04 16:25 UTC, Babak Razmjoo
Details
How LibreOffice 6.2.2.2 actually displays this text- part 6 (29.29 KB, image/png)
2019-04-04 16:27 UTC, Babak Razmjoo
Details
How LibreOffice 6.2.2.2 actually displays this text- part 1-revised (42.96 KB, image/png)
2019-04-04 16:49 UTC, Babak Razmjoo
Details
Gaps inside Arabic/Persian text with diacritics in justified paragraphs (11.79 KB, application/vnd.oasis.opendocument.text)
2022-08-06 12:09 UTC, Hossein
Details
Gaps inside Arabic/Persian text with diacritics in justified paragraphs (7.78 KB, image/png)
2022-08-06 12:11 UTC, Hossein
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Munzir Taha 2017-03-20 01:45:37 UTC
Description:
I am attaching a document where I repeated three words many times and set the text to be justified. Some of the words got a gap between characters that shouldn't be there. I marked those with the problem with a red color, and one can easily see what's wrong by comparing them to the other non-red words. I am also attaching a PDF that's an export of the document that shows the problem persists in the pdf.

Steps to Reproduce:
1. Open my attached file
2. The red words should look similar to the black words

Actual Results:  
gaps are introduced between characters.

Expected Results:
No gaps should be introduced in justified text.


Reproducible: Always

User Profile Reset: Yes

Additional Info:


User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0
Comment 1 Munzir Taha 2017-03-20 01:47:04 UTC
Created attachment 132020 [details]
libO introduced gaps in some words
Comment 2 Munzir Taha 2017-03-20 01:48:10 UTC
Created attachment 132021 [details]
PDF export also has the same issue
Comment 3 V Stuart Foote 2017-03-20 05:12:04 UTC
Is this another manifestation of needing floating point glyph positioning for enhancement bug 103322?
Comment 4 Xisco Faulí 2017-03-20 09:05:37 UTC
I can't reproduce it in

Version: 5.4.0.0.alpha0+
Build ID: d3b5bd4a07a619db6bee1c39c32280ac3c620532
CPU threads: 4; OS: Linux 4.8; UI render: default; VCL: gtk2; 
Locale: ca-ES (ca_ES.UTF-8); Calc: group

Khaled should be able to comment more on this...
Comment 5 خالد حسني 2017-03-20 13:32:59 UTC
That is a kashida issue, in the gap there should be a kashida but it moves to the wrong direction due to the presence of combining mark on the right of it. I don’t have the same font, but other fonts show the issue as well.

I recall fixing this exact issue at some point, but I can reproduce with 5.3, may be it was fixed on 5.4 but I can’t test it right now.
Comment 6 Munzir Taha 2017-03-20 14:09:03 UTC
@Khaled: Yes, I noticed the bug with many fonts including Amiri but it happens in a random way that even closing the file and reopening it could make it disappear in one place and appear in another. The current sample shows a more consistent case.

Shouldn't there be a way to disable kashida justification and resort to space justification only?
Comment 7 خالد حسني 2017-03-20 14:27:46 UTC
(In reply to Munzir Taha from comment #6)
> Shouldn't there be a way to disable kashida justification and resort to
> space justification only?

Probably yes, but it might require both changes to the UI and the file format, I don’t know for sure.
Comment 8 Munzir Taha 2017-03-23 05:05:21 UTC
@Khaled: you mentioned that
> the gap there should be a kashida but it moves to the wrong direction
> due to the presence of combining mark on the right of it

However, I can reproduce it with no marks on the right of it. Attached is an example file and a screenshot
Comment 9 Munzir Taha 2017-03-23 05:06:38 UTC
Created attachment 132086 [details]
reproduceable without marks
Comment 10 Munzir Taha 2017-03-23 05:07:11 UTC
Created attachment 132087 [details]
reproduceable without marks (screenshot)
Comment 11 Munzir Taha 2017-07-06 01:55:43 UTC
Created attachment 134506 [details]
source document
Comment 12 Munzir Taha 2017-07-06 01:57:48 UTC
Created attachment 134507 [details]
The good

The good
Comment 13 Munzir Taha 2017-07-06 01:58:17 UTC
Created attachment 134508 [details]
The bad

The bad
Comment 14 Munzir Taha 2017-07-06 01:59:08 UTC
I've just attached another extreme case example, where the kashida messed up the text though I haven't even used justification! Just by changing the zoom from 351% to 352% I got the bad text. Attached is the source document and two screenshots; one shows the good, the other shows the bad.
Comment 15 Babak Razmjoo 2019-04-04 16:15:15 UTC Comment hidden (off-topic)
Comment 16 Babak Razmjoo 2019-04-04 16:16:40 UTC Comment hidden (off-topic)
Comment 17 Babak Razmjoo 2019-04-04 16:17:31 UTC Comment hidden (off-topic)
Comment 18 Babak Razmjoo 2019-04-04 16:21:35 UTC Comment hidden (off-topic)
Comment 19 Babak Razmjoo 2019-04-04 16:22:30 UTC Comment hidden (off-topic)
Comment 20 Babak Razmjoo 2019-04-04 16:23:17 UTC Comment hidden (off-topic)
Comment 21 Babak Razmjoo 2019-04-04 16:24:09 UTC Comment hidden (off-topic)
Comment 22 Babak Razmjoo 2019-04-04 16:25:32 UTC Comment hidden (off-topic)
Comment 23 Babak Razmjoo 2019-04-04 16:27:25 UTC Comment hidden (off-topic)
Comment 24 Babak Razmjoo 2019-04-04 16:37:44 UTC Comment hidden (off-topic)
Comment 25 Babak Razmjoo 2019-04-04 16:39:34 UTC Comment hidden (off-topic)
Comment 26 Babak Razmjoo 2019-04-04 16:49:41 UTC Comment hidden (off-topic)
Comment 27 خالد حسني 2019-04-05 05:30:19 UTC Comment hidden (off-topic)
Comment 28 QA Administrators 2021-04-06 03:38:01 UTC Comment hidden (obsolete)
Comment 29 Buovjaga 2021-07-27 12:13:32 UTC
*** Bug 137530 has been marked as a duplicate of this bug. ***
Comment 30 Hossein 2022-08-06 12:09:52 UTC
Created attachment 181637 [details]
Gaps inside Arabic/Persian text with diacritics in justified paragraphs

This problem happens when you use diacritics. To show the problem better, I attach an example from Ask LibreOffice, in which the problem is more clearly visible:

Justified Persian (Farsi) paragraphs! 
https://ask.libreoffice.org/t/justified-persian-farsi-paragraphs/60605
Comment 31 Hossein 2022-08-06 12:11:39 UTC
Created attachment 181638 [details]
Gaps inside Arabic/Persian text with diacritics in justified paragraphs

This is the PNG version of the above attachment.
Comment 32 Hossein 2022-08-06 12:22:33 UTC
This is a regression, bibisected to:

commit 8f2dd1df1d6cc94ebbc1149de72bc6d6dffa6533
Author: Khaled Hosny <khaledhosny@eglug.org>
Date:   Wed Nov 2 23:52:06 2016 +0200

    Revert "Revert "Enable the new text layout engine by default""
    
    This reverts commit 3950166877bf1308f9e449992e20b558342af825.

This problem first appeared in LibreOffice 5.3, after enabling the new text engine that uses HarfBuzz as the default for rendering text on all platforms.
Comment 33 Munzir Taha 2022-08-08 12:14:15 UTC
(In reply to Hossein from comment #30)
> Gaps inside Arabic/Persian text with diacritics in justified paragraphs
> 
> This problem happens when you use diacritics

I already demonstrated that the problem happens even with no diacritics and no justification. Check comment #8. I will revert the original title since it's more accurate.
Comment 34 Munzir Taha 2022-08-08 12:14:52 UTC
(In reply to Hossein from comment #30)
> This problem happens when you use diacritics

I already demonstrated that the problem happens even with no diacritics and no justification. Check comment #8. I will revert the original title since it's more accurate.
Comment 35 Commit Notification 2022-08-14 19:12:56 UTC
Khaled Hosny committed a patch related to this issue.
It has been pushed to "master":

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

tdf#106653: Try harder not to return 0 for Kashida width

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 36 Munzir Taha 2022-08-20 16:40:08 UTC
@Khaled: Thanks a lot for fixing my most annoying bug in libO.
@Hossein: Thanks too for the bibisecting and pointing it's a regression.