Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tashkeel not working correctly #79

Closed
ghost opened this issue Nov 2, 2021 · 3 comments
Closed

Tashkeel not working correctly #79

ghost opened this issue Nov 2, 2021 · 3 comments

Comments

@ghost
Copy link

ghost commented Nov 2, 2021

Hello,

Thank you very much for this add-on.
I've tried to use it for writing text with tashkeel, but the diacritics aren't working correctly unfortunately.
I've tried to use many different fonts and most fonts don't even have all the characters at the right hex ranges. But I found out that the fonts by google have much better hex ranges than other fonts (224/225 characters were found with google fonts, while most other fonts have about 175/225 characters). Unfortunatly the tashkeel isn't working well on any font, whether it's a google font or not.

I've tried the Amiri, noto Naskh and noto Sans Arabic fonts. All 3 of them work great except for the tashkeel. Here is the link to the google fonts: https://fonts.google.com/?subset=arabic

image

@hk1ll3r
Copy link
Collaborator

hk1ll3r commented Nov 2, 2021

Can you be a bit more specific about what is not working. The tashkeel overlapping with letters like م, ا, ل ?

Does the text with tashkeel look fine in your browser or windows notepad? If not there is little chance we can fix it in our plugin either.

If the text looks fine in MS notepad or browser textboxes, please include the text as text here (so I can copy it), plus how is looks like in our plugin (i assume the one you provided) and how it should look like correctly.

@ghost
Copy link
Author

ghost commented Nov 3, 2021

I'm really, sorry, I'm not used to reporting bugs or issues and I've really left out a lot of information.
The tashkeel isn't going up or down to adapt to the letter height, so it overlaps with all high letters like ا and ل and it also overlaps with all low letters like م, ن, ر and ز.
Yes, the text works fine on web browsers and on microsoft word, here is a picture of the same text on word:
image

And here is the same thing in unity using the RTL TMPro plugin:
image

image

I tried to used the plugin directly in my project but after I saw this error, I've cloned the github repository and I've opened it directly as a unity project and I added many fonts to it, but the tashkeel is still overlapping with the text.

I've even tried it with the default font that was included in the github repository (segoeui Arabic SDF) and even there the tashkeel is overlapping with some letters of the text.

I've tried many different texts in case that this is a bug related to my text only, but the results are always the same.
This is the text that I'm using in the pictures above:
29679حَدَّثَنَا عَبْدُ اللَّهِ بْنُ إِدْرِيسَ، عَنْ ‌عَاصِمِ بْنِ كُلَيْبٍ، عَنْ أَبِيهِ، عَنْ ‌وَائِلِ بْنِ حُجْرٍ، قَالَ: «رَأَيْتُ النَّبِيَّ صَلَّى اللهُ عَلَيْهِ وَسَلَّمَ جَعَلَ حَدَّ مِرْفَقِهِ الْأَيْمَنِ عَلَى فَخِذِهِ الْيُمْنَى، ‌وَحَلَّقَ بِالْإِبْهَامِ وَالْوُسْطَى، وَرَفَعَ الَّتِي تَلِي الْإِبْهَامَ يَدْعُو بِهَا

And this is the range that I'm using:
000621,000627,000623,000624,000625,000649,000626,000628,00062A,00062B,00062C,00062D,00062E,00062F,000630,000631,000632,000633,000634,000635,000636,000637,000638,000639,00063A,000641,000642,000643,000644,000645,000646,000647,000648,00064A,000622,000629,00067E,000686,000698,0006AF,0006A9,0006CC,00FBFD,00FBFE,00FBFF,00FE82,00FE84,00FE85,00FE86,00FE87,00FE88,00FE89,00FE8A,00FE8E,00FE8F,00FE90,00FE8B,00FE8C,00FE91,00FE92,00FE96,00FE97,00FE98,00FE9A,00FE9B,00FE9C,00FE9E,00FE9F,00FEA0,00FEA2,00FEA3,00FEA4,00FEA6,00FEA7,00FEA8,00FEAA,00FEAB,00FEAC,00FEAD,00FEAE,00FEAF,00FEB0,00FEB1,00FEB2,00FEB3,00FEB4,00FEB6,00FEB7,00FEB8,00FEBA,00FEBB,00FEBC,00FEBE,00FEBF,00FEC0,00FEC2,00FEC3,00FEC4,00FEC6,00FEC7,00FEC8,00FECA,00FECB,00FECC,00FECE,00FECF,00FED0,00FED2,00FED3,00FED4,00FED6,00FED7,00FED8,00FEDA,00FEDB,00FEDC,00FEDE,00FEDF,00FEE0,00FEE2,00FEE3,00FEE4,00FEE6,00FEE7,00FEE8,00FEEA,00FEEB,00FEEC,00FEEE,00FEEF,00FEF0,00FEF2,00FEF3,00FEF4,00FE83,00FE94,00FE95,00FB57,00FB58,00FB59,00FB7B,00FB7C,00FB7D,00FB8B,00FB8C,00FB8D,00FB93,00FB94,00FB95,00FB8E,00FB8F,00FB90,00FB91,00FEF5,00FEF6,00FEF7,00FEF8,00FEF9,00FEFA,00FEFB,00FEFC,00FFFF,00060C,00061B,00061F,000640,000030-000039,000660-000669,0006F0-0006F9,00064b-00065f,000670,00FC5E-00FC63,000020

@hk1ll3r
Copy link
Collaborator

hk1ll3r commented Nov 3, 2021

Thanks for the info @programer786 .

The problem stems from TextMeshPro's font asset creator not importing font's transformation info which includes the glyph placement adjustments. The fix needs to happen in TextMeshPro and is beyond the scope of this plugin.

However I found a workarounds for your case!

The lazy way
You can adjust the distance of tashkeel characters from the baseline. By moving all kasra farther down, you will get rid of the overlaps. This is the "lazy" fix, you just need to do it for roughly 8 characters.

Adjust the height of the tashkeel character (Kasra ِ in this case) to a value farther from the baseline.

  1. select the fond asset
  2. under "character table" look up the tashkeel character (Kasra is 650 in unicode hex). You find the glyph id (2353 in the above font asset, will be different for you).
  3. under "glyph table" lookup the glyph id you found, then change the "BY" value.

This will fix the issue, but the tashkeel will move everywhere in any text that uses the font. In this case the Kasra under the la ل character also moved farther down.
glyphfix-after

The more correct way
If you want to make the tashkeel sit at appropriate distance for every character, you can instead make adjustments using the "glyph adjustments table" of the font asset. The process is fairly similar to the previous case, instead of adjusting the glyph for each tashkeel character, you adjust the values for a pair of normal glyph + tashkeel. Potentially you'd have to create hundreds of such entries in the table for each font.

Before picture:
glyphadjust-before

After picture: Note that kasra sits at different heights for ل and ب characters.
glyphadjust-after

@hk1ll3r hk1ll3r closed this as completed Nov 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant