Why 'ARABIC LETTER PEH' is not shown correctly on Android 3.x? - android

In Unicode characters the ARABIC LETTER PEH INITIAL FORM 'ﭘ' is 0xFB58. When I use the following code to show Unicode characters, everything is OK for every Unicode character in Android 2.2, 2.3. and 4.x But I have problem with ARABIC LETTER PEH 'ﭘ' on Android 3.x and in this case character '~' is shown.
Typeface tf = Typeface.createFromAsset(context.getAssets(),"TAHOMA.TTF");
strChars = "";
strChars += (char) 0xFB58;
tvChars.setTypeface(tf);
tvChars.setText(strChars);
I should mention that The problem is remained when I change the font or ignore using setTypeface(tf)
Why?
How can I find the code of ARABIC LETTER PEH in Unicode?
EDIT:
Please compare 0xFB58 (ﭘ) and 0xFB5E (ﭞ) with any font programmatically. you will find the problem. the first one is not shown but the second one is shown correctly.

Did you try adding your own fonts?
Get a Persian TTF font file that fits you and use it, this way you won't be OS dependent.
http://twigstechtips.blogspot.com/2012/01/android-how-to-use-true-type-fonts-ttf.html

Related

String replace isn't working for some russian characters

For some reason I need to replace russian letter "Ё" with "Е". So I wrote this simple code
someString = someString.toLowerCase().replace("ё", "е");
It's working perfectly fine on emulators and most of my devices, except Xiaomi Redmi 9a. The app doesn't replace "ё" on Xiaomi at all.
What can be wrong?
Xiaomi Redmi 9a doesn't use russian letter "Ё", it uses "Ë"! :) It's latin letter "E" with diaeresis. I don't know is it because of keyboard or something else.
So we need to change code to this
// The first character of pattern is russian Ё, the second is latin E with diaeresis.
// Some Xiaomi devices use the second variant instead of russian letter
someString = someString.toLowerCase().replaceAll("[ёë]", "е");
or this
someString = someString.toLowerCase().replace("ё", "е").replace("ë", "е");

Displaying Unicode string in Users control in Xamarin (Android)

Basically, i have a list of Nepali Unicode strings something like {"युनिकोड १ ","युनिकोड २","युनिकोड ३"}.
Now, Firstly, I have a text view in Xamarin (Android) and tried to set the text property using couple of methods:
UnicodeTextView.Text="युनिकोड १"; //direct method
var font = Typeface.CreateFromAsset(_activity.Assets, "kantiput.TTF");//kantiput.TTF Is a Nepali font.
UnicodeTextView.Typeface = font;
var font = Typeface.CreateFromAsset(_activity.Assets, "kantiput.TTF");
UnicodeTextView.SetTypeface(font, TypefaceStyle.BoldItalic);
and none of them worked.
When using the first option nothing was displayed, and on working with last two
and there were some BOX character visible.
For first case when i directly tried to set the value:
Before setting value:
After setting value:
Samething with the ListAdapter.
Can anyone suggest me how can we display unicode sentences in TextView, EditText, Toast ?
I want result something like this :
with TextView :
and here is the weird behavior :
and i tried all those code that are in comment too. Still didn't find any luck.
I am working in android.
In toast I checked like the following:
Toast.makeText (this, "\u0c05 \u0c06", Toast.LENGTH_SHORT).Show();
For first two letters of Telugu alphabet s. It worked.
If you have the font file you can obtain unicode codes for the various glyphs in the online software available at
https://opentype.js.org/index.html
Under page glyph inspector.
I tested your code, the first direct method UnicodeTextView.Text="युनिकोड १"; works fine by my side both with single TextView or TextView in ListView.
Or you may try this code:
if (Android.OS.Build.VERSION.SdkInt >= Android.OS.Build.VERSION_CODES.N)
{
UnicodeTextView.Text = Android.Text.Html.FromHtml("युनिकोड १", Android.Text.FromHtmlOptions.ModeLegacy).ToString();
}
else
{
UnicodeTextView.Text = Android.Text.Html.FromHtml("युनिकोड १").ToString();
}

Droid Naskh font and Arabic number 4

I'm using Droid Naskh font in my application to display Arabic characters. One of my users pointed out that the arabic number 4 ٤ displays as number 5 ٥. I have attached a screenshot below of how it's appearing on the device (as well as the emulator).
This is the string:
<string name="num">٠١٢٣٤٥٦٧٨٩</string>
Output:
Why is this happening?
PS: I tried other fonts as well, yet this persists. I tried unicode U+0664, but it displays 5. This is weird.
Okay, figured it out. I was using the ArabicReshaper class and there was a mistake for U+0664.
This:
{0x0664, 0x000B, 0x0665, 0x0664, 0x0664, 0x0664},
Should be:
{0x0664, 0x000B, 0x0664, 0x0664, 0x0664, 0x0664},

Rendering HIndi font on Android 2.3 and lower

I am developing an android App in Hindi but find that few characters are misspelled and broken in Hindi the issue is in http://code.google.com/p/ankidroid/issues/detail?id=1008 but no solution there दिप is rendered as दपि
letters in hindi font above are formed as द + ि + प which should display as दिप but It render as दपि
The same question was put earlier but not resolved so I had to repost it again
Correcting Hindi (Unicode) rendering in Android
Finally I found the solution this is very simple just import the font in my case I am developing web app
#font-face { font-family: hindi; src: url('fonts/k010.TTF'); }
body,h1,h2{ font-family:hindi; }
then type text in your a text editor or MS-word using Kruti devi10 font after You finished change the font to Arial and paste the text in your web App and it will render perfectly
you can use Unicode ...
TextView tv=(TextView)findViewById(R.id.textViewmyView);
final Typeface tf = Typeface.createFromAsset(this.getAssets(), "Hindi-SARAL1.TTF");
tv.setText(Html.fromHtml("&# 2367;&# 2342;&# 2346;"));
tv.setTypeface(tf);
unicode value continues no gap.....
and you can also convert world to unicode via this site...http://mylanguages.org/converter.php but in case of इ 1st use unicode of इ then alphabets Unicode...b/c till android version 4.0 Hindi Unicode not supported proper..

Correcting Hindi (Unicode) rendering in Android

I successfully added a custom typeface (DroidSansFallBack.ttf) to show Hindi characters instead of Blocks on Pre ICS . All is working well on 4.1+ in any case.
But the rendering order is wrong on Froyo and Gingerbread.
I understand it is not resolved http://code.google.com/p/android/issues/detail?id=4153
What are the possible workarounds to correct the rendering? (I don't want to use images )
EDIT:
Example,
दिन string from values-hi renders as दनि
नक्षत्र renders as नक् ष त र
(On 4.1+ everything renders correctly)
I have a alternative solution for your problem but not exact...
use font....
Typeface tf = Typeface.createFromAsset(getAssets(),"Hindi-SARAL1.TTF");
for नक्षत्र use .......
TextView tv = (TextView) findViewById(R.id.textView1);
tv.setText("n95");
tv.setTypeface(tf);
and for दिन........ unicode value continues no gap.. i have given a space between &# and 2367;
tv.setText(Html.fromHtml("&# 2367;&# 2342;&# 2344;"));
tv.setTypeface(tf);
I could not find a simple work around for fixing the rendering everywhere. So finally I had to limit the Hindi language feature to devices having android version 4.0 or later.

Categories

Resources