<div dir="ltr">I think this is actually off the topic, because the actual question was &quot;if there is any Kashida algorithm, then where should it be?&quot;, my answer to that is &quot;polyglossia&quot;.<br><br>To answer to Khaled and others:<br>
<br>I agree that the Kasida hack Jonathan provided is not perfect, but what do we call a Perfect Kashida? I am afraid, there is no complete standard rule that states how Perfect Kashida should be done.  If you look at Persian computing discussion, we talked about hyphenation and Kashida in Persian typography and a number of us believe that we should have a combination of hyphenation and Kashida for Persian. I am Persian not Arab, so I do not know about Arabic typography but in Persian we could have hyphenation as well for example the word شناگر can be broken into شنا and گر . Now doing any of these (either Persian hyphenation or Persian Kashida) is difficult partially because There is no such standadrd rule for Persian hyphenation and Persian Kashida and partially because implementing Perfect persian hyphenation and Persian Kashida is a tedious task. But it is not impossible, honestly who has got the time to sit down and takes care of every single detail? But of course we should have some support for Persian hyphenation and Persian Kashida that is quite acceptable. Ahmad YazdiPour had done Kashida quite well, so if anyone of you are interested, then you can look at TeX-e-Parsi&#39;s source code.<br>
<br>Best wishes,<br>Vafa<br></div>