ironmantis7x
ironmantis7x

Reputation: 827

having trouble with arabic font rendering correctly android app

My android app is not displaying the arabic font correctly on the view that displays the radio player and the text. I get symbols in the arabic text (percent sings, copyright and registered trade mark symbols, double greater thann signs, +/- sign, double commas ... ALL mixed with arabaic characters).

Here is a snippet from the java class file:

private void setTypeFace(){
        int os_version = ((MiraathRadio)getApplication()).os_version;
        if(os_version < 9){
            Typeface tf = Typeface.createFromAsset(getAssets(), fontpath);
            audioTitle.setTypeface(tf);

            tf = Typeface.createFromAsset(getAssets(), fontpathFroyo2);
            stationTitle.setTypeface(tf);

            tf = Typeface.createFromAsset(getAssets(), fontpathmotlak);
            listenerNomber.setTypeface(tf);

        }

        else {

            Typeface tf = Typeface.createFromAsset(getAssets(), fontpath2);
            audioTitle.setTypeface(tf);

            tf = Typeface.createFromAsset(getAssets(), fontpathArabic2);
            stationTitle.setTypeface(tf);

            tf = Typeface.createFromAsset(getAssets(), fontpathmotlak);
            listenerNomber.setTypeface(tf);

        }
    }

I have installed Tahoma, Froyo, and mcs_jf2 fonts (all TTF) and still it will not render correctly.

I have tried to use a Arabizer and Farsi class file to connect, but to now avail.

I have a screen shot of the problem if anyone wants to see it.

What am I doing wrong???

Any help would be greatly appreciated!!

Thanks!! ironmantis7x

strange arabic text

I am posting the code where I am setting the text:

private void setTypeFace(){
        int os_version = ((MiraathRadio)getApplication()).os_version;
        if(os_version < 9){
            Typeface tf = Typeface.createFromAsset(getAssets(), fontpath);
            audioTitle.setTypeface(tf);

            tf = Typeface.createFromAsset(getAssets(), fontpathFroyo2);
            stationTitle.setTypeface(tf);

            tf = Typeface.createFromAsset(getAssets(), fontpathmotlak);
            listenerNomber.setTypeface(tf);

        }

        else {

            Typeface tf = Typeface.createFromAsset(getAssets(), fontpathArabic3);
            audioTitle.setTypeface(tf);

            tf = Typeface.createFromAsset(getAssets(), fontpathArabic3);
            stationTitle.setTypeface(tf);

            tf = Typeface.createFromAsset(getAssets(), fontpathArabic3);
            listenerNomber.setTypeface(tf);

I am lost here. Any pointers and help would be great.

ironmantis7x

Upvotes: 0

Views: 872

Answers (1)

ironmantis7x
ironmantis7x

Reputation: 827

Alhamdulillah!!! Found the issue!!!

The encoding was wrong ... The previous developer put "windows-1256" as the encoding type. I changed it to "utf-8" and it works just fine!!!

Thanks everyone for all your help!!!

Upvotes: 1

Related Questions