Bug 140767 - Tatweel/kashida justification should be applied to Syriac, not just Arabic
Summary: Tatweel/kashida justification should be applied to Syriac, not just Arabic
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: medium normal
Assignee: Jonathan Clark
URL:
Whiteboard: target:25.2.0
Keywords: text:rtl
Depends on:
Blocks: Kashida-Justification, Tatweel
  Show dependency treegraph
 
Reported: 2021-03-03 04:03 UTC by maronitetreasury
Modified: 2024-09-27 08:05 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
sample image (102.59 KB, image/png)
2021-03-03 04:13 UTC, maronitetreasury
Details
Sample Doc (9.44 KB, application/vnd.oasis.opendocument.text)
2021-03-23 13:34 UTC, maronitetreasury
Details
Document illustrating the problem (15.98 KB, application/vnd.oasis.opendocument.text)
2021-11-12 17:57 UTC, Eyal Rozenberg
Details
The illustrating document exported to PDF (31.58 KB, application/pdf)
2021-11-12 18:01 UTC, Eyal Rozenberg
Details
First attachment in docx format (5.61 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2022-08-12 21:19 UTC, Hossein
Details
First attachment in PDF format created by MS Word (123.00 KB, application/pdf)
2022-08-12 21:22 UTC, Hossein
Details
Documentation on Syriac Justified-Alignment (68.08 KB, application/pdf)
2022-09-04 17:39 UTC, maronitetreasury
Details
Corrected sample document (15.77 KB, application/vnd.oasis.opendocument.text)
2022-09-04 18:02 UTC, maronitetreasury
Details
Corrected sample document: pdf output from libreoffice (30.79 KB, application/pdf)
2022-09-04 18:04 UTC, maronitetreasury
Details
Before and after (31.92 KB, image/png)
2024-09-27 01:52 UTC, Jonathan Clark
Details

Note You need to log in before you can comment on or make changes to this bug.
Description maronitetreasury 2021-03-03 04:03:14 UTC
Description:
Requesting that text justification be done by stretching the word-line (called "Kashida" or "tatweel") rather than the spaces between the words. This was fixed in arabic, and it's essentially the same feature with similar rules to arabic.

(This type of feature is essential for many use cases of Syriac: virtually all Syriac texts are justified.)

Steps to Reproduce:
1. Paste in or type in a Syriac text.
2. Justify the text.
3. Set Right-to-Left (need complex layouts enabled).
4. Put line-breaks to test the justification.
5. Pick a font like "Noto Sans Syriac Western"

Actual Results:
There are wide spaces between words.

Expected Results:
The connecting line of the words should stretch so that there is minimal white space, very similar to Arabic.


Reproducible: Always


User Profile Reset: No



Additional Info:
sample text for convenience:

ܐܰܒܓܰܕ ܗܰܘܰܙ ܚܰܛܺܝ ܟܰܠܡܰܢ ܣܰܥܦܰܨ ܩܰܪܫܰܬ
ܐܲܒܓܲܕ ܗܲܘܲܙ ܚܲܛܲܝ ܟܲܠܡܲܢ ܣܲܥܦܲܨ ܩܲܪܫܲܬ
ܐܒܓܕ ܗܘܙ ܚܛܝ ܟܠܡܢ ܣܥܦܨ ܩܪܫܬ


Help - About LibreOffice:
Version: 7.0.3.1
Build ID: 00(Build:1)
CPU threads: 6; OS: Linux 5.8; UI render: default; VCL: gtk3
Locale: en-CA (en_CA.UTF-8); UI: en-US
Ubuntu package version: 1:7.0.3-0ubuntu0.20.10.1
Calc: threaded
Comment 1 maronitetreasury 2021-03-03 04:13:15 UTC
Created attachment 170189 [details]
sample image
Comment 2 Dieter 2021-03-21 05:29:52 UTC
Thank you for reporting the bug. Please attach a sample document, as this makes it easier for us to verify the bug. You've also mentioned, that the problem has been fixed for arabic. Do you know the bug number or can you search for it (meta bug 112810 could be one starting point)
I have set the bug's status to 'NEEDINFO'. Please change it back to 'UNCONFIRMED' once the requested document is provided.
(Please note that the attachment will be public, remove any sensitive information before attaching it)
Comment 3 maronitetreasury 2021-03-23 13:34:30 UTC
Created attachment 170659 [details]
Sample Doc
Comment 4 maronitetreasury 2021-03-23 13:57:30 UTC
Thank you. I have attached the document sample.


As for other Arabic bugs that are related I am not sure: I just noticed that it started to work when I decided to try again.

Here's a related bug, but not the same issue exactly:

https://bugs.documentfoundation.org/show_bug.cgi?id=112849

The implementation in Arabic may be here if I'm not mistaken:

https://git.libreoffice.org/core/+/HEAD/vcl/source/gdi/CommonSalLayout.cxx#643
Comment 5 Dieter 2021-04-17 13:39:33 UTC
Thank you for the document. I'm not sure, if I can see the problem or not. So I hope somebody who is familiar with Syriac texts can confirm it.
Comment 6 Eyal Rozenberg 2021-11-12 17:57:22 UTC
Created attachment 176213 [details]
Document illustrating the problem

The attached document has justified and unjustified paragraphs, with Syriac and then with Arabic text, to illustrate how tatweel is _not_ applied to Syriac.
Comment 7 Eyal Rozenberg 2021-11-12 18:01:06 UTC
Created attachment 176214 [details]
The illustrating document exported to PDF

The same document, exported to PDF.

I was using:

Version: 7.3.0.0.alpha0+ / LibreOffice Community
Build ID: c998691e22ceda15c89d55cf7005201f0392dadb
CPU threads: 4; OS: Linux 5.10; UI render: default; VCL: gtk3
Locale: en-US (en_IL); UI: en-US
TinderBox: Linux-rpm_deb-x86_64@86-TDF, Branch:master, Time: 2021-10-14_11:54:20


but obviously this bug dates back for as long as we've had Tatweel.
Comment 8 Caolán McNamara 2022-03-30 15:32:07 UTC
some code pointers at least:
sw/source/core/text/porlay.cxx SwScriptInfo::InitScriptInfo the code before the "m_Kashida.insert" only knows about Arabic rules and not any Syriac equivalents. If that was implemented, it might then be necessary to undo the change associated with bug 116344 to get the right final effect.
Comment 9 ⁨خالد حسني⁩ 2022-08-12 17:37:21 UTC
So far I have not been able to find any documentation for Kashida insertion rule for justifying Syriac text. Without such documentation there is no way to implement this feature. Also it would be nice to know if there exists any other software that does such justification.
Comment 10 Hossein 2022-08-12 21:19:09 UTC
(In reply to Khaled Hosny from comment #9)
> So far I have not been able to find any documentation for Kashida insertion
> rule for justifying Syriac text. Without such documentation there is no way
> to implement this feature. Also it would be nice to know if there exists any
> other software that does such justification.

Does this help?

Developing OpenType Fonts for Syriac Script
https://docs.microsoft.com/en-us/typography/script-development/syriac

Also, here I read:

"Syriac and Mongolian have properties similar to Arabic, and in the absence of additional information should be given similar treatment for justification."
https://www.w3.org/International/articles/typography/justification.en

which means the Mongolian script should also be considered.
Comment 11 Hossein 2022-08-12 21:19:54 UTC
Created attachment 181744 [details]
First attachment in docx format
Comment 12 Hossein 2022-08-12 21:22:15 UTC
Created attachment 181745 [details]
First attachment in PDF format created by MS Word
Comment 13 ⁨خالد حسني⁩ 2022-08-12 21:58:14 UTC
(In reply to Hossein from comment #10)
> (In reply to Khaled Hosny from comment #9)
> > So far I have not been able to find any documentation for Kashida insertion
> > rule for justifying Syriac text. Without such documentation there is no way
> > to implement this feature. Also it would be nice to know if there exists any
> > other software that does such justification.
> 
> Does this help?
> 
> Developing OpenType Fonts for Syriac Script
> https://docs.microsoft.com/en-us/typography/script-development/syriac

Only passing mention of Kashida (the respective Arabic section doesn’t either, the Arabic rules we use were documented on some MS page about Internet Explorer that is no longer online https://web.archive.org/web/20130308140133/http://www.microsoft.com/middleeast/msdn/JustifyingText-CSS.aspx)
 
 
> Also, here I read:
> 
> "Syriac and Mongolian have properties similar to Arabic, and in the absence
> of additional information should be given similar treatment for
> justification."
> https://www.w3.org/International/articles/typography/justification.en
> 
> which means the Mongolian script should also be considered.

I read that as well, also nk'o is said to use similar technique, but no rules to implement either.
Comment 14 ⁨خالد حسني⁩ 2022-08-12 21:59:42 UTC
(In reply to Hossein from comment #12)
> Created attachment 181745 [details]
> First attachment in PDF format created by MS Word

You might need to change the type of justification in Word to get Kashida (it has low, medium, and high, IIRC and low always uses inter-word spacing).
Comment 15 maronitetreasury 2022-09-04 17:39:52 UTC
Created attachment 182206 [details]
Documentation on Syriac Justified-Alignment
Comment 16 maronitetreasury 2022-09-04 17:42:05 UTC
I've added a new document "Documentation on Syriac Justified-Alignment" which should help with the rules. It was provided to me by a friend of mine whom I consider to be an expert in the language.
Comment 17 maronitetreasury 2022-09-04 18:02:30 UTC
Created attachment 182208 [details]
Corrected sample document

I've corrected the sample document, the RTL was not set on the first syriac line. This mistake makes both the odt sample and the docx sample obsolete.
Comment 18 maronitetreasury 2022-09-04 18:04:09 UTC
Created attachment 182209 [details]
Corrected sample document: pdf output from libreoffice
Comment 19 AvidSeeker 2022-09-08 10:35:26 UTC
This reddit post might contain helpful resources for implementing Kashida justification:
https://www.reddit.com/r/arabic_linux/comments/x8wwxa/kashida_justification/
Comment 20 Eyal Rozenberg 2023-04-05 21:20:14 UTC
(In reply to AvidSeeker from comment #19)
I didn't see any Syriac-specific resources there...
Comment 21 Commit Notification 2024-09-27 01:50:41 UTC
Jonathan Clark committed a patch related to this issue.
It has been pushed to "master":

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

tdf#140767 Implemented Syriac justification

It will be available in 25.2.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 22 Jonathan Clark 2024-09-27 01:52:35 UTC
Created attachment 196739 [details]
Before and after

Comparison screenshot illustrating the change, using the sample text.
Comment 23 Jonathan Clark 2024-09-27 01:56:48 UTC
Basic Syriac justification is now implemented, based on the information provided in Attachment 182206 [details].

The justification rules may need adjustment. Please file bugs for any Syriac typesetting issues you encounter.
Comment 24 Eyal Rozenberg 2024-09-27 08:05:25 UTC
Thanks, Jonathan, for also picking bugs to work on for issues relevant to smaller-community (or at least less-well-represented) scripts, like Syriac, Tibetan, Mongolian etc. this year.