I have created an android application where I want to display unicoded bengali sentences.
For this I have done the following steps.
Step1: I store my bengali font named Siyamrupali.ttf in the Assets folder.
Step2: In main.xml file I took a text view where I display characters.
Step3: In my MainActivity. Java I wrote this...
public class mainAc extends Activity
{
AssetManager arabi_font;
TextView tx;
#Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
tx=(TextView)findViewById(R.id.tv);
try
{
String str="\u0986";
tx.setTypeface(Typeface.createFromAsset(getAssets(),"Siyamrupali.ttf"));
tx.setText(str);
}
catch(Exception ex)
{
tx.setText("font cannot load: "+ ex.toString() );
}
}
Then output show আ Which one is correct But When i wrote String str="\u0986\u09AE\u09Bf";
In MainActivity. Java
Then output shows আমই But i should be আমি
What can I do now to solve this problem. Any body give me some advice or link or sample code.
\u0986\u09A\u09BF is not a valid unicode character. I am afraid why you didnot get error. please have a look on the following like
Unicode character of Bengali scripts
Thanks
Android doesn't have full complex text layout support for all of Unicode yet, and Bengali matras are one feature that isn't rendered right. See issue 5925. Sorry!
Related
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();
}
I have a problem with localizing Zendesk to french. You can see in the below screenshot the word Contacteznous which is not the correct one.
This is not the only word that is incorrect, there are some english words which are not translated at all.
I think that based on the language, the appropriate words should be taken from values-fr file in Zendesk library package. The correct word sits there but is not used as you can see from the screenshot.
The code I use for setting up Zendesk is:
public void initZenDesk() {
ZendeskConfig.INSTANCE.setDeviceLocale(Locale.FRANCE);
ZendeskConfig.INSTANCE.init(getActivity(), Constant.ZenDesk_Support_Site, Constant.ZenDesk_ApplicationId, Constant.ZenDesk_Auth_CLientId,
new ZendeskCallback<String>() {
#Override
public void onSuccess(String s) {
Identity identity = new AnonymousIdentity.Builder()
.withNameIdentifier(globals.getUserDetails().get(Constant.MM_UserName))
.withEmailIdentifier(globals.getUserDetails().get(Constant.MM_Email))
.withExternalIdentifier(globals.getUserDetails().get(Constant.MM_UserId))
.build();
ZendeskConfig.INSTANCE.setIdentity(identity);
ZendeskConfig.INSTANCE.setContactConfiguration(new BaseZendeskFeedbackConfiguration() {
#Override
public String getRequestSubject() {
return "Support request";
}
});
new SupportActivity.Builder().show(getActivity());
}
#Override
public void onError(ErrorResponse errorResponse) {
Toast.makeText(getActivity(), errorResponse.getReason() + errorResponse.getResponseBody(), Toast.LENGTH_SHORT).show();
}
});
}
I cannot understand what I am doing wrong, I followed the steps from the official Zendesk webpage. Everything is properly set in the admin back office as well. What am I missing guys?
The missing hyphen is a subtle bug in our translation file, thanks for pointing it out! It will be fixed in our next release.
The hyphen you see in the strings.xml file is a soft hyphen, U+00AD (see https://en.wikipedia.org/wiki/Soft_hyphen), instead of a regular hyphen, U+2010. As such, it is not displaying in this case, because the text is not being broken over multiple lines.
As a workaround in the meantime, you can override the contact_fragment_title in your app, making sure to use a real hyphen character (or a space, or whatever you prefer).
I think you have a ticket open with us at the moment. We'll be looking at the issue tomorrow and we'll get back to you on that channel. We can post the result back here too.
Thanks,
Barry.
I,m trying to show Sinhala Unicode characters in android app.
when i am using Samsung tabs or phones Unicode is running it on without problem.but it does not work on other phones or tab.cause there is no Sinhala Unicode.How to do this for an example i run this code on Samsung tab successfully.
Toast.makeText(this, "අන්තර්ජාල සම්බන්දතාවය තිබේ ", Toast.LENGTH_SHORT).show();
but other phones or tab does n't work.
You might need to have a Sinhalese font file (say, Sinhalese.ttf) in the directory assets/fonts in the root of your project. You create a dummy text view because it has a method called setTypeface, which sets the font for next code:
import android.graphics.Typeface;
public class FontSampler extends Activity {
#Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.main);
TextView tv=(TextView)findViewById(R.id.custom); // a dummy text view
Typeface face=Typeface.createFromAsset(getAssets(),
"fonts/Sinhalese.ttf");
tv.setTypeface(face);
Toast.setView(tv).makeText(this, "අන්තර්ජාල සම්බන්දතාවය තිබේ ", Toast.LENGTH_SHORT).show();
}
}
This way, even if an android phone doesn't have a font installed, then the font embedded in your app will serve. Hope this helps.
If you want to render the Both sinhala and English in same text box then use Iskolapota font file.And do the same as #Nonymous answer says. It works for me.
I want to create a database in which i can add and retrieve the Urdu words. for this purpose i installed Inpage 2009 professional and copied its fonts (.ttf) into assets folder but it gave an error i.e
I also installed UrduFonts.exe and copied its font JameelNooriNastaleeq.ttf but it also gave the same error. i need the Urdu font that is compatible to the android , the font that can add and retrieve Urdu to and from the database using android.
this is how i coded foa a Lcd2Mono.ttf and i am having the true experience of that font but i am unsuccessful. here is my piece of code..
private EditText txt,start,urdu;
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
urdu=(EditText) findViewById(R.id.urdu);
try
{
urdu.setTypeface(Typeface.createFromAsset(this.getAssets(),"urdu.ttf"));
urdu.setText("ur text");
}
catch(Exception ex)
{
start.setText(ex.toString());
}
i did some with Inpage Fonts and got Exception that Native Font.....
i think JameelNooriNastaleeq.ttf font is very huge, more than 10M (maybe somehow connected to your problem), i recommend to try something much more smaller like: http://www.quran.or.kr/urdu/font/asunaskh.ttf
but still issue with connecting the urdu characters, like in this question:
how to add language support to android
what exception you got?
I'm already working on an Android application that displays RSS feed.
My problem is that this feed has some lines in Tamil(which Android still doesn't support)
I found a font online that displays the text right(without converting to Bamini) but the problem is that textStyle doesn't have any effect on it.
so you know any font that can do the job or any thing i have to do to make textStyling?
thanks in advance
What you need to do is import custom fonts on to the phone before using them.
A good way to do that is to include them in the package - in the APK file
Hence you should be having the font in your project when you build the APK file.
Let me give you an example. Assuming your tamil font's name is Harabara.ttf and you have copied it to /assets/fonts
Use this method (anywhere in your activity)
private void initializeFonts() {
font_harabara = Typeface.createFromAsset(getAssets(), "fonts/Harabara.ttf");
}
and call this API from your onCreate like this
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
initializeFonts();
setContentView(getViewResourceId());
}
Make sure you have declared this class level variable
Typeface font_harabara = null;
Finally, simply use
myTextField.setTypeface(font_harabara);
tada ! tamil font should now start displaying.
nandri vanakkam,
vaidyanathan
There are hundreds of fonts available online. Did you check some TSCII fonts?
I've written some solutions for Tamil and Android issues. Check it out too.