Bug 163878 - Wrong rendering of Arabic texts
Summary: Wrong rendering of Arabic texts
Status: RESOLVED NOTOURBUG
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
7.2.7.2 release
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-11-13 09:23 UTC by Francesc Dorca Badia
Modified: 2024-11-13 10:57 UTC (History)
0 users

See Also:
Crash report or crash signature:


Attachments
Screenshot showing wrong Arabic text rendering on screen (178.24 KB, image/png)
2024-11-13 10:04 UTC, Francesc Dorca Badia
Details
LO Writer Arabic text file in order to simplify bug replication (17.23 KB, application/vnd.oasis.opendocument.text)
2024-11-13 10:06 UTC, Francesc Dorca Badia
Details
Output of rendering Arabic and Persian yah from pango-view utility (4.93 KB, image/png)
2024-11-13 10:57 UTC, Hossein
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Francesc Dorca Badia 2024-11-13 09:23:11 UTC
Description:
Wenn typing a document in Arabic in LO Writer, I realised that the rendering was not correct. This happens both in displaying the text and in printing. The letters RA (ر) and YA (ي),often are sticked together with the previous letters without keeping the right distance ore even are superposed to the preceding letter. The text can still be read, but in my opinion this bug makes LibreOffice unusable for professional Arabic texts. I cutted and pasted the same text in LO Impress getting the same result. When I did it in Google Docs, everything was correct. For me this is an Arabic text rendering bug from Libre Office in general.

Steps to Reproduce:
1. Type or paste a text in Arabic using LO Writer or LO Impress. 
2. Look at the text on the screen.
3. Look at the printed text.


Actual Results:
Both texts renderings (screen and print) are WRONG. They are readable, but look ugly and not professional.

Expected Results:
Proper Arabic text rendering.


Reproducible: Always


User Profile Reset: No

Additional Info:
I made screenshots. I will attach them to the bug when it is filled.
Comment 1 Francesc Dorca Badia 2024-11-13 10:04:13 UTC
Created attachment 197583 [details]
Screenshot showing wrong Arabic text rendering on screen
Comment 2 Francesc Dorca Badia 2024-11-13 10:06:40 UTC
Created attachment 197584 [details]
LO Writer Arabic text file in order to simplify bug replication
Comment 3 Hossein 2024-11-13 10:57:12 UTC
Created attachment 197585 [details]
Output of rendering Arabic and Persian yah from pango-view utility

> The text can still be read, but in my opinion this bug makes LibreOffice unusable for professional Arabic texts.

The problem here is with two things:

1. Incorrect text language: the language set for the text is incorrectly set to "Hindi". You can change that by going to "Character" and then setting "Arabic (...)" in "Complex" section. You need to activate "Complex text layout" and set it to "Arabic (...)" in "Tools > Options > Languages and Locales > General".

2. Fallback font: You have not set an appropriate Arabic font for the text. You can use "Amiri" for example.

Other than that, I think even with a fallback font, shaping algorithm should work correctly.

The fallback font here is "FreeSerif", and the digits font is "Lohit Devanagari", because of the incorrect language, Hindi set for the text. You can see the incorrect type of the digits for Arabic text.

The problem seems to be from the font itself. You can see how the underlying HarfBuzz library renders the text:

$ pango-view --font="FreeSerif 100" --text 'في'

On the other hand, with Persian ی it is rendered correctly:

$ pango-view --font="FreeSerif 100" --text 'فی'

I think this is a font problem. FreeSerif font is provided by "GNU FreeFont", and you can see the related bug here:

bug #65979: Arabic Alif Maqsura, Kaf and Lam Alif problems
https://savannah.gnu.org/bugs/?65979