Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to correctly show Arabic letters in Android?

My application shows letters and words on arabic language. But these letters looks wrong. For example symbols بَ and شَ :

Correct (from iOS):

Correct

Wrong (from Android):

Wrong

As you can see, the little line on the top of letters must be centered. But it's not. How to show Arabic symbols on Android like on iOS?

UPDATE: I am trying to use Better-Arabic-Shapper, but it's also displaying incorrectly:

Better-Arabic-Shapper

Better-Arabic-Shapper

I am trying to set custom fonts (Arial, Simpo, nassim_latn_rg) with the code below but it also doesn't work correctly:

private const val FONT_PATH = "fonts/"

val font = "nassim_latn_rg.otf"
val typeface = Typeface.createFromAsset(context.assets, FONT_PATH + font)
textView.typeface = typeface
like image 206
BArtWell Avatar asked Sep 10 '18 10:09

BArtWell


1 Answers

I tried with Roboto font, it works fine. All app settings are default. I did not have to add android:supportsRtl="true" in my manifest.

<style name="RobotoRegular">
    <item name="android:fontFamily">sans-serif</item>
</style>

Result:

enter image description here

Please try this font and revert if you still encounter the issue. I have a feeling this is a font-related issue.

like image 65
user1506104 Avatar answered Nov 01 '22 23:11

user1506104