Konash / arabic-support-unity

This plugin allows you to use accurate and correct Arabic text in your game or 3D application. Supports Tashkeel and Hindu numbers. Supports C# and JavaScript. Supports 4 Persian Characters.
MIT License
216 stars 64 forks source link

Make combined Tashkeel cases optional #23

Closed darrencperry closed 6 years ago

darrencperry commented 6 years ago

I'm using a font that does not support combined Tashkeel, only individual Tashkeel. Any chance we can make this optional?

My font renders combined Tashkeel fine in all programs, so most programs must be rendering each Tashkeel individually, so I need to replicate that in my applications...

Konash commented 6 years ago

Hi darren. Can you please support your issue with images and examples? I'm trying to follow it but I fear there might be a room for misinterpretation.

darrencperry commented 6 years ago

Thanks for your reply Konash.

I'm referring to the changes made in Pull Request #11

For example, this converts a 0x064E FATHA and 0x0651 SHADDA to 0xFC60 Shadda With Fatha

My font supports individual Fatha and Shadda and renders them on top of each other correctly but it does not support the combined glyph 0xFC60, this reverts to a fallback font. So it would be handy to make this combination process optional...

For now, I've just commented out these additional lines.

e.g.

internal static string RemoveTashkeel(string str, out List<TashkeelLocation> tashkeelLocation)
{
    tashkeelLocation = new List<TashkeelLocation>();
    char[] letters = str.ToCharArray();

    int index = 0;
    for (int i = 0; i < letters.Length; i++) {
        if (letters [i] == (char)0x064B) { // Tanween Fatha
            tashkeelLocation.Add (new TashkeelLocation ((char)0x064B, i));
            index++;
        } else if (letters [i] == (char)0x064C) { // DAMMATAN
            tashkeelLocation.Add (new TashkeelLocation ((char)0x064C, i));
            index++;
        } else if (letters [i] == (char)0x064D){ // KASRATAN
            tashkeelLocation.Add (new TashkeelLocation ((char)0x064D, i));
            index++;
        }else if (letters [i] == (char)0x064E) { // FATHA
            //if(index > 0)
            //{
            //  if(tashkeelLocation[index-1].tashkeel == (char)0x0651 ) // SHADDA
            //  {
            //      tashkeelLocation [index - 1].tashkeel = (char)0xFC60; // Shadda With Fatha
            //      continue;
            //  }
            //}

            tashkeelLocation.Add (new TashkeelLocation ((char)0x064E, i));
            index++;
Konash commented 6 years ago

Interesting. I never thought of this before. I will see what can be done.

Konash commented 6 years ago

I just pushed the addition. Please let me know if it is working well for you for both fonts!