Display the Tifinagh alphabet on Android emulator - android

To display Tifinagh characters on Android emulator I tried this method:
TextView tv=(TextView)findViewById(R.id.font);
Typeface face=Typeface.createFromAsset(getAssets(),"fonts/MZTIFIYU.TTF");
tv.setTypeface(face);
However it didn't work. I still see boxes instead of characters.
Is there any other way to resolve this?

Azul :)
I'm able to see the Tifinagh characters using this font: t_ircam-webfont.ttf
You could also check this answer for additional help.

Related

TextVIew does not display "ț" symbol

I have a simple TextView, where I put a string like that: "Curăță corect urechile copilașului tău!". But I see the string on display like this "Cură ă corect urechile copilașului tău!" - just space between chars, where must be a "ț" symbol.
I checked the string in TextView by TextView.getText(), and I get my original string.
This is a screenshot, also the same problem in first title:
Try to set text in TextView using HTML. I hope this will work and may help you out.
myTextView.setText(Html.fromHtml("your_string"));
There is still space for the letters, so perhaps it's an issue with the styling.
Change the style to default, do the letters show up?
Try adding a shadow to the textviews and see if the shadow exists (maybe the letters are somehow transparent, or the same color as the background?)
It is more related to a font issue, default Android font doesn't support some characters. You need to try from a different font.
You can try from the following (but I think its not free)
http://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&id=FontDownloads

Change font of superscript text

I am writing an view where I need to display superscript data. I am following this to achieve this.
Along this is there any way to change font size(in number) of superscript text.
EDIT
Commanware suggested link work great, except one thing. I need superscript bit above of base text. I'm updating image for same, please refer. I'm using same code with mention in reference code.
Here either can go for separate text view could be second priority solution. Any suggestion !
try this one this is working code:
((TextView)findViewById(R.id.text)).setText(Html.fromHtml("04:30<sup><small>pm</small></sup>"));
you cant pass text size in numbers, yo have to change the size to string :
<font size="3" color="red">This is some text!</font>
Use this Code :
((TextView)findViewById(R.id.text)).setText(Html.fromHtml("your Text <sup style="font-size:5(yourfontsize);">subscript</sup>"));
Try this and Let me know :)

Custom ttf fonts are not showing properly in TextView on Android 4.4 KitKat

I have some text which has some bolded parts. Until KitKat this strategy (as mentioned in this post) worked perfectly well
My strings resources file:
<string name="multi_style_text">NON-BOLD TEXT \n<b>BOLD</b></string>
My application code in fragment:
txtView.setTypeface(FontUtils.getOstrichRegular(this.getActivity()));
...
public static Typeface getOstrichRegular(Context context) {
return Typeface.createFromAsset(context.getAssets(),
"fonts/ostrich_regular.ttf");
}
Currently (in KitKat), the bolded part is not shown in the custom font, the non-bolded part is shown in the custom font. In previous versions of Android, all of the text was shown in the custom font.
What gives?
So, after being frustrated by this bug, I searched around and found a solution to the problem.
In my current project we use calibri.ttf font. that was working fine up to 4.4. Once i got the update to my nexus 4, All the TextViews with Calibri font were showing "ff" instead of the entire text.
THE FIX - get an .otf (open type font) version of your font, and put in the project, works like a charm. Too bad google didn't inform the developers on this and there's very little documentation on the matter.
Apparently this is a bug in KitKat and has been fixed in an internal tree.
Put your custom font in android assets under folder name "font" or whatever you want
Try this
myTypeface = Typeface.createFromAsset(this.getAssets(),
"fonts/<<your font>>.ttf");
in onCreate() then
[use youcontroll].setTypeface(myTypeface);
Best of Luck...
I resolved the problem by converting my file.ttf to file.otf
remplace :
Typeface typeface = Typeface.createFromAsset(activity.getAssets(), "fonts/ostrich_regular.ttf");
yourTextView.setTypeface(typeface);
by :
Typeface typeface = Typeface.createFromAsset(activity.getAssets(), "fonts/ostrich_regular.otf");
yourTextView.setTypeface(typeface);
FYI : the .otf format work for all android version (not only on kitkat)
After many hours searching for roboto.otf (2014 year) I understood that it was a mistake. Simply download a normal ttf font from https://www.fontsquirrel.com/fonts/roboto-2014 and copy to assets folder, then use setTypeface.
Also you may convert it to otf with any web-site.

How to show arabic text in android?

I want to show Arabic text from text file in android. in some phones and tablets it seems to be correct, but on some android devices it looks like the below text:
ا ل س ل ا م ع ل ي ك م
Please help me how to show them correctly on every device.
I assume that the problem here is that the text is not shown right-to-left. You should try using the Bidi class, or by specifying the following in your XML:
<EditText android:layout_width="match_parent" android:layout_height="wrap_content"android:id="#+id/editText1" android:gravity="right">/EditText>
Copy the ttf file to the assets folder in your android project folder..Then set the typeface of the textview in the code.

How to return to default font in TextView

I know how to change the font of a TextView to my own font:
catTextView = (TextView)findViewById(R.id.CatText);
catTextView.setTypeface(Typeface.createFromAsset(getAssets(), "my_font_in_assets"));
However at a point during the app execution, I would like to set it back to the default font. I don't want to hardcode the font (write "Droid Sans") since the default font could change in future versions of Android (I think it actually did in ICS).
Is there any way to get the default font name of a TextView, and set it back to this after changing it?
Also, can I be sure the default font will always be able to show Russian or Japanese characters?
Thanks!
Use setTypeface(Typeface.SANS_SERIF) on a TextView
Have you tried calling getTypeface() in your TextView before you change it and store the result somewhere?
http://developer.android.com/reference/android/widget/TextView.html#getTypeface()
Use this:
textView.setTypeface(null);
You can restore default typeface using
Typeface.defaultFromStyle(R.style.YourTheme);

Categories

Resources