iOS Development

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

Spread the love


I am encountering a visible glitch when displaying Arabic textual content in a UILabel with textual content alignment set to justified. Particularly, the Arabic diacritics (Harakat) are being misplaced, which disrupts the readability of the textual content. The problem appears to stem from the UILabel‘s try to justify the content material, leading to incorrect positioning of the Harakat. The problem will be seen in varied font sizes, reminiscent of 34, 36, and doubtless extra. Additionally the issue doesn’t stem because of the code, as I’ve tried a contemporary code with solely a UILabel and the textual content.

Curiously, after I swap the textual content alignment to right-to-left, the issue disappears, and the Harakat are appropriately positioned. Nonetheless, my requirement is to have the textual content justified to make sure a clear {and professional} format.

Has anybody confronted an identical subject or can present perception on tips on how to keep correct placement of Arabic diacritics in a justified UILabel? Any recommendations or workarounds to attain a justified alignment with out compromising the integrity of the Arabic script could be enormously appreciated. For Reference, right here is the spesific textual content which you could see on the picture:

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

The Right means:

The Correct way

The Improper means:
The Wrong way

I’ve tried something and every little thing that I may consider, reminiscent of to alter the font, tried so as to add further areas between the phrases, tried it in a contemporary code, tried totally different sources to fetch the identical textual content. None of them labored up to now.

4 thoughts on “ios – Arabic Diacritics (Harakat) Misaligned in UILabel with Justified Textual content Alignment SwiftUI

  1. You could never find the words to describe how much I loved you. No matter how beautiful the picture is or how polished your writing is, you read it quickly. To be honest, I think you should give it another chance soon. I will probably try to go on this hike again and again if you make sure it is safe.

  2. You could never find the words to describe how much I loved you. No matter how beautiful the picture is or how polished your writing is, you read it quickly. To be honest, I think you should give it another chance soon. I will probably try to go on this hike again and again if you make sure it is safe.

Leave a Reply

Your email address will not be published. Required fields are marked *