I faced an issue with rendering Urdu on UITextView. I have used NSAttributedString to render text, but some characters are not appearing well using Jameel-Noori-Nastaleeq styled Regular and AlviLahoriNastaleeqfont. You can see in first picture how a character on the second line is not correctly rendered
Here is another reference screenshot, please see lines 5 and 13 where some characters are not rendered correctly.
What I have Tried
1-
There are some characters that do not appear well i.e. ["بڑ", "ئز", "یز", "ڈ", "ز"] I
tried to find all the occurrences of these characters using this tutorial [Find and Return the Ranges of All the Occurrences of a Given String in Swift][3]
Then change the font of all these occurrences to Jameel-Noori-Nastaleeq-Kasheeda because this little change will not impact overall looking, but finding all occurrences of a single character in a string does not work well in urdu, but only the case when we find the first occurrence this will work well using string.range(of: "ئز")
.
I have tested finding all occurrences of a substring in English that work well using the above tutorial method. . [3]: https://betterprogramming.pub/find-and-return-the-ranges-of-all-the-occurrences-of-a-given-string-in-swift-2a2015907a0e
2- Text is rendered well with Jameel-Noori-Nastaleeq-Kasheeda, but I have to use Jameel-Noori-Nastaleeq styled Regular
Is there any workaround that displays all characters well for Urdu in Jameel-Noori-Nastaleeq styled Regular.
Finally get solved, use UILabel instead of UITextView
Actually, UILabel renders Jameel Noori Nastaleeq without any issue but in the same context, UITextView causes issues.
According to my experience, issue is with UITextView compatibility with Jameel-Noori-Nastaleeq and AlviLahoriNastaleeq also Apple should see into this issue.