Bug 164522 - Intra-letter kashida / tatweel
Summary: Intra-letter kashida / tatweel
Status: RESOLVED DUPLICATE of bug 116969
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: All All
: medium enhancement
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Font-Rendering Kashida-Justification, Tatweel
  Show dependency treegraph
 
Reported: 2024-12-31 05:46 UTC by AvidSeeker
Modified: 2025-01-06 19:13 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
Examples (140.42 KB, image/jpeg)
2024-12-31 05:47 UTC, AvidSeeker
Details

Note You need to log in before you can comment on or make changes to this bug.
Description AvidSeeker 2024-12-31 05:46:39 UTC
Description:
Currently, LO applies justification by adding "ـ" U+0640 ARABIC TATWEEL between
letters. However, there is another way of applying Kashida by stretching
specific letter within words. This method is popular with old scriptures,
calligraphy, and handwritten messages.

Here is a rough estimate of the algorithm for the improved Kashida.

-   Start with the last word in a line, and apply stretching to the
    final letter in that word.
-   However, if the letter is not "stretch-able" (e.g: Arabic Meem م),
    then look for middle-form Kaaf (ك) and stretch that
-   If there is no Kaaf, apply the fallback Kashida by adding TATWEEL
    between letters.
-   TATWEEL is usually added to the last two connected letters. These
    letters are not necessarily the last letters of the word since they
    could be in isolated form (e.g: "الماء" --> "المـــاء") Notice
    that "اء" are isolated (they cannot connect).
-   Stretch-able letter forms are: كـ, ـن, ن, ت, ـت, س, ـس, ص, ـص, ـى,
    ى, ف, ـف (where س and ت also their dotted variants e.g: ش and ث).
    Also have a look on
    <https://en.wikipedia.org/wiki/Arabic_alphabet#Table_of_basic_letters>
    for reference.

Examples are attached. Examples are taken from KFGQPC print of Quran <https://books.islamway.net/1/01_Mushaf_AlMadinah_L_549.pdf>.

Steps to Reproduce:
.

Actual Results:
.

Expected Results:
.


Reproducible: Always


User Profile Reset: No

Additional Info:
.
Comment 1 AvidSeeker 2024-12-31 05:47:11 UTC
Created attachment 198335 [details]
Examples
Comment 2 Eyal Rozenberg 2025-01-04 10:56:19 UTC
I would guess this would really depend on whether the font rendering mechanisms underlying LibreOffice support this extension of letter forms themselves - and whether the font formats, and fonts, support this. I am not at all sure this is the case.
Comment 3 Jonathan Clark 2025-01-06 12:42:59 UTC
In my opinion, bug 116969 also requests this type of justification. I'm therefore marking this bug a duplicate.

(In reply to Eyal Rozenberg from comment #2)
> I would guess this would really depend on whether the font rendering
> mechanisms underlying LibreOffice support this extension of letter forms
> themselves - and whether the font formats, and fonts, support this. I am not
> at all sure this is the case.

In theory the font formats do support this, but few programs seem capable of using those features so I'm not sure how many fonts provide them.

HarfBuzz developers are working in this area. There's an experimental hb_shape_justify API, but I haven't had a chance to test it yet.

*** This bug has been marked as a duplicate of bug 116969 ***
Comment 4 AvidSeeker 2025-01-06 19:13:08 UTC
(In reply to Eyal Rozenberg from comment #2)
> depends on whether the font rendering mechanisms support this

OpenType supports this. It's `jalts` (Justification Alternates). See
this Tex SE discussion: https://tex.stackexchange.com/questions/595220/