Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to define spaces in Urdu (Jameel Noori Nastaleeq) font in android?

I want to define like that enter image description here, used Urdu (Jameel Noori Nastaleeq) font, string define like that <string name="spaces">خوش آمدید</string> in TextView,

ttf = Typeface.createFromAsset(getAssets(),
            "fonts/Jameel Noori Nastaleeq.ttf");

tvRandomLabel = (TextView) findViewById(R.id.tvRandomLabel);
    tvRandomLabel.setTypeface(ttf);

But after the build application not show the spaces, enter image description here

like image 324
Engr Waseem Arain Avatar asked Jan 20 '26 06:01

Engr Waseem Arain


1 Answers

try this unicode "No-BREAK_SPACE":

ttf = Typeface.createFromAsset(getAssets(),
            "fonts/Jameel Noori Nastaleeq.ttf");

tvRandomLabel = (TextView) findViewById(R.id.tvRandomLabel);
    tvRandomLabel.setTypeface(ttf);
    // use this unicode for single space \u00A0
    tvRandomLabel.setText(yourtext+"\u00A0"+your text);

more unicodes here.

like image 157
Hamad Avatar answered Jan 22 '26 18:01

Hamad