ios – Arabic Diacritics (Harakat) Misaligned in UILabel with Justified Text Alignment SwiftUI


I’m encountering a visual glitch when displaying Arabic text in a UILabel with text alignment set to justified. Specifically, the Arabic diacritics (Harakat) are being misplaced, which disrupts the readability of the text. The issue seems to stem from the UILabel’s attempt to justify the content, resulting in incorrect positioning of the Harakat. The issue can be seen in various font sizes, such as 34, 36, and probably more. Also the problem does not stem due to the code, as i have tried a fresh code with only a UILabel and the text.

Interestingly, when I switch the text alignment to right-to-left, the problem disappears, and the Harakat are correctly placed. However, my requirement is to have the text justified to ensure a clean and professional layout.

Has anyone faced a similar issue or can provide insight on how to maintain proper placement of Arabic diacritics in a justified UILabel? Any suggestions or workarounds to achieve a justified alignment without compromising the integrity of the Arabic script would be greatly appreciated. For Reference, here is the spesific text that you can see on the image:

وَلَنْ تَرْضَىٰ عَنْكَ الْيَهُودُ وَلَا النَّصَارَىٰ حَتَّىٰ تَتَّبِعَ مِلَّتَهُمْ ۗ قُلْ إِنَّ هُدَى اللَّهِ هُوَ الْهُدَىٰ ۗ وَلَئِنِ اتَّبَعْتَ أَهْوَاءَهُمْ بَعْدَ الَّذِي جَاءَكَ مِنَ الْعِلْمِ ۙ مَا لَكَ مِنَ اللَّهِ مِنْ وَلِيٍّ وَلَا نَصِيرٍ ‎﴿١٢٠﴾‏ الَّذِينَ آتَيْنَاهُمُ الْكِتَابَ يَتْلُونَهُ حَقَّ تِلَاوَتِهِ أُولَٰئِكَ يُؤْمِنُونَ بِهِ ۗ وَمَنْ يَكْفُرْ بِهِ فَأُولَٰئِكَ هُمُ الْخَاسِرُونَ ‎﴿١٢١﴾‏ يَا بَنِي إِسْرَائِيلَ اذْكُرُوا نِعْمَتِيَ الَّتِي أَنْعَمْتُ عَلَيْكُمْ وَأَنِّي فَضَّلْتُكُمْ عَلَى الْعَالَمِينَ ‎﴿١٢٢﴾‏ وَاتَّقُوا يَوْمًا لَا تَجْزِي نَفْسٌ عَنْ نَفْسٍ شَيْئًا وَلَا يُقْبَلُ مِنْهَا عَدْلٌ وَلَا تَنْفَعُهَا شَفَاعَةٌ وَلَا هُمْ يُنْصَرُونَ ‎﴿١٢٣﴾‏ ۞ وَإِذِ ابْتَلَىٰ إِبْرَاهِيمَ رَبُّهُ بِكَلِمَاتٍ فَأَتَمَّهُنَّ ۖ قَالَ إِنِّي جَاعِلُكَ لِلنَّاسِ إِمَامًا ۖ قَالَ وَمِنْ ذُرِّيَّتِي ۖ قَالَ لَا يَنَالُ عَهْدِي الظَّالِمِينَ ‎﴿١٢٤﴾‏ وَإِذْ جَعَلْنَا الْبَيْتَ مَثَابَةً لِلنَّاسِ وَأَمْنًا وَاتَّخِذُوا مِنْ مَقَامِ إِبْرَاهِيمَ مُصَلًّى ۖ وَعَهِدْنَا إِلَىٰ إِبْرَاهِيمَ وَإِسْمَاعِيلَ أَنْ طَهِّرَا بَيْتِيَ لِلطَّائِفِينَ وَالْعَاكِفِينَ وَالرُّكَّعِ السُّجُودِ ‎﴿١٢٥﴾‏ وَإِذْ قَالَ إِبْرَاهِيمُ رَبِّ اجْعَلْ هَٰذَا بَلَدًا آمِنًا وَارْزُقْ أَهْلَهُ مِنَ الثَّمَرَاتِ مَنْ آمَنَ مِنْهُمْ بِاللَّهِ وَالْيَوْمِ الْآخِرِ ۖ قَالَ وَمَنْ كَفَرَ فَأُمَتِّعُهُ قَلِيلًا ثُمَّ أَضْطَرُّهُ إِلَىٰ عَذَابِ النَّارِ ۖ وَبِئْسَ الْمَصِيرُ ‎

The Correct way
The Wrong way

I have tried anything and everything that i could think of, such as to change the font, tried to add additional spaces between the words, tried it in a fresh code, tried different sources to fetch the same text. None of them worked so far.

Latest articles

spot_imgspot_img

Related articles

Leave a reply

Please enter your comment!
Please enter your name here

spot_imgspot_img