Bug 161153 - Inserting tashdid (a.k.a. shaddah) character (Unicode 0651) breaks or distorts Persian text
Summary: Inserting tashdid (a.k.a. shaddah) character (Unicode 0651) breaks or distort...
Status: RESOLVED DUPLICATE of bug 135778
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
7.3.7.2 release
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Font-Rendering
  Show dependency treegraph
 
Reported: 2024-05-17 14:37 UTC by arham.amouei
Modified: 2024-05-22 12:26 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
a sample Persian document, its font, and screenshots illustrating the text before and after the insertion of the tashdid character (458.43 KB, application/zip)
2024-05-17 15:59 UTC, arham.amouei
Details

Note You need to log in before you can comment on or make changes to this bug.
Description arham.amouei 2024-05-17 14:37:33 UTC

    
Comment 1 Xisco Faulí 2024-05-17 15:22:12 UTC
Thank you for reporting the bug.
Unfortunately without clear steps to reproduce it, we cannot track down the origin of the problem.
Please provide a clearer set of step-by-step instructions on how to reproduce the problem.
I have set the bug's status to 'NEEDINFO'. Please change it back to 'UNCONFIRMED' once the steps are provided
Comment 2 arham.amouei 2024-05-17 15:59:18 UTC
Created attachment 194179 [details]
a sample Persian document, its font, and screenshots illustrating the text before and after the insertion of the tashdid character
Comment 3 arham.amouei 2024-05-17 16:00:49 UTC
ّIn some cases, inserting a tashdid character (Unicode 0651) in a Persian text breaks it or causes the text to be rendered in a bad way. Since Arabic and Persian writing systems are very similar, this may also affect Arabic texts.

I have also observed instances where inserting this character does not cause any problems. I am not certain about the specific conditions that lead to this issue; however, it appears to be font-dependent.

Thus far, I have encountered this problem in Writer 7.3.7.2 (on Xubuntu 22.04) and Writer 24.2.2.2 (on Ubuntu 24.04).

When this occurs, pressing Ctrl+Z does not restore the text to its normal appearance, necessitating a document reload.

The attached file (example.zip) contains a sample Persian document, the font I have used, and screenshots illustrating the text before and after the insertion of the tashdid character.

This font is widely used for Persian script, and we do not encounter this issue in Microsoft Word.

I am willing to conduct any tests you suggest and provide any additional information required. Thank you for your excellent work!
Comment 4 افشین 2024-05-17 16:25:06 UTC
I tested too with B Nazanin font and other Persian font (B Mitra) and confirm this bug.
Comment 5 arham.amouei 2024-05-17 18:45:00 UTC
When I change the font of the same document to "Noto Sans Arabic" in Ubuntu, the tashdid character is always displayed perfectly. So this seems to be a font-dependent issue.
Comment 6 افشین 2024-05-18 05:31:46 UTC
Persian fonts of the IR series for example "IR Nazanin" also have no problem in displaying the tashdid character.
Comment 7 ahangarha 2024-05-19 16:21:46 UTC
On v7.6.6.3 on Ubuntu I have no issue with any font I tried.
Comment 8 ahangarha 2024-05-19 16:36:23 UTC
This is my finding.

I could reproduce the issue on the shared document. The issue is observed only when editing that document, meaning that if the user types the same text in another document (no copy/paste) there is no issue.

Someone needs to check for hidden characters in the document, otherwise in normal situation, there is no issue even with B Nazanin.
Comment 9 arham.amouei 2024-05-19 18:21:12 UTC
(In reply to ahangarha from comment #8)
> This is my finding.
> 
> I could reproduce the issue on the shared document. The issue is observed
> only when editing that document, meaning that if the user types the same
> text in another document (no copy/paste) there is no issue.
> 
> Someone needs to check for hidden characters in the document, otherwise in
> normal situation, there is no issue even with B Nazanin.

The issue may be related to the presence of diacritics (kasreh, fatheh, etc) in text. In any text with B Nazanin font and possibly similar fonts, if a sentence contains a diacritic such as kasreh, inserting a tashdid in the sentence, at least displaces the diacritic to a wrong position.
Comment 10 Hossein 2024-05-22 12:26:01 UTC
This is a duplicate of the tdf#135778, which is essentially a problem with the "B Nazanin" font itself. Please read Khaled's note in tdf#135778 comment 7:

"These fonts are essentially broken and depend on undocumented quirks of Windows OpenType implementation. The issue might be fixed in HarfBuzz, but there is nothing to fix in LibreOffice itself."

It may be possible to provide a workaround in HarfBuzz itself. You can follow the bug report for HarfBuzz here:

https://github.com/harfbuzz/harfbuzz/issues/2647

Meanwhile, you may use a fixed "B Nazanin" font created by Khaled:

https://github.com/harfbuzz/harfbuzz/files/5093421/BNazanin.2.zip

*** This bug has been marked as a duplicate of bug 135778 ***