i have used many punjabi fonts as like bulara_f.ttf , anmollipi , Akaash and many more but every time prolem with one word of punjabi "sihari"
Sihari : Sihari is equivalent to i in pin or thin. Hence forth in this module we will denote sihari vowel with /i/.
in my application only this one word is not shown properly as like in following snapshot... please help...
EDIT
i am using this method
Typeface myfont;
myfont=Typeface.createFromAsset(getAssets(),"font.ttf");
TextView textview = (TextView)findViewById(R.id.TextView01);
//textview.setText("punjabi Text");
textview.setTypeface(myfont);
}
Use bulara_5.ttf and run the code on device it will show correct punjabi words
mTvAbout = (TextView) findViewById(R.id.tv_about);
font = Typeface.createFromAsset(this.getAssets(), "bulara_5.ttf");
mTvAbout.setTypeface(font);
mTvAbout.setText(" ਜਾਣਕਾਰੀ");
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 am getting code from server for set icon in application, code is
but not getting icon in textview display code only.
i will try to set like - [] , 0xf003, but not getting icon.
Typeface font = Typeface.createFromAsset(context.getAssets(), "fontawesome-webfont.ttf");
String s = obj.msg_icon;
holder.txticonnotify.setText(s);
holder.txticonnotify.setTypeface(font);
Output
if set same code from string.xml it will work fine.
How to get Icon
you should convert it:
Html.fromHtml(s).toString();
*note that createFromAsset is an expensive call, so don't use it in a cycle.
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 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.
According to android 2.3 some RTL languages such as Arabic is supported in this new version. However, emulator does not show the fount correctly. In code I have written:
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
TextView txt = (TextView) findViewById(R.id.myText);
Typeface font = Typeface.createFromAsset(getAssets(), "Larabieb.ttf");
txt.setTypeface(font);
txt.setTextSize(26);
txt.setText("السلام علیک یا حبیبی");
}
but in the output it shows separated characters instead of connected characters.
How can I connect the characters?
As of this date only Samsung's phones running on android support bidi and display of arabic characters. There is nothing wrong with your code. Open the web browser and browse an arabic website you will see the same problem on non-samsung phones.
you can use this tools
Tools.fa("سلام علیکم");
sample image: