I want to install custom font which is .ttf file in android device when my application start. Actually I need to install Burmese font in my android device when I run my application. Is it possible? If yes, then how? I don't need typeface. I want to install in system.
4 Answers
See here @CommonsWare answer, You cannot add fonts to an existing device, except as part of a custom firmware build, or possibly by rooting the device.
but you can add fonts in your appliction. like:
TextView txtvw=(TextView)findViewById(R.id.textviewname);
Typeface typface=Typeface.createFromAsset(getAssets(),"fonts/burmese.ttf");
txtvw.setTypeface(typface);
Note: put your font in assets/fonts
dir in project
OR if your device is rooted then see this tuts for installing Custom Fonts on Your Android Device
-
+1 for rply fast. Thanks for your reply i see this and also other links like http://www.android-devs.com/?p=33 http://www.androidzoom.com/android_applications/productivity/gurmukhi-keyboard_rppe.html but is it possible to all device rooted. – kalpana c Apr 07 '12 at 05:19
-
@khushi : this app installing fonts on all unrooted devices? – ρяσѕρєя K Apr 07 '12 at 05:24
-
probably should be another question but if several fragments/etc execute the same code to "createFromAsset" does it smartly access a font cache or does it create another instance each time? ie: do I need to manage it application wide and only use one instance to save memory? – peterk Sep 16 '15 at 15:34
-
Hi, I am using LG G4 with Android 6.0 and I want to add a new font to Word. My phone is not rooted. How Can I do it? I don't understand the codes above and how to apply it.... – Jun 17 '17 at 15:27
you need to be on root of the device
for that you can use this application EasyRoot.apk
Download and install ES File Explorer (https://market.android.com/details?id=com.estrongs.android.pop)
After that you need to enable root explorer. More info can obtained from this link
save fonts on your device’s /system/font folder
More info can obtained from this link

- 9,776
- 6
- 41
- 66
if you have custom font then use following code:::
TextView tv=(TextView)findViewById(R.id.custom);
Typeface face=Typeface.createFromAsset(getAssets(),"fonts/Verdana.ttf");
tv.setTypeface(face);
also place your font in assets/fonts folder

- 34,573
- 7
- 66
- 64
I created a FontWrapper Class for my project.
public static Typeface getTypeface(Context c, Fonts name) {
synchronized (typefaces) {
if (!typefaces.containsKey(name)) {
try {
String fontPath = getFontsPath(name);
if (!StringUtil.isNullOrEmpty(fontPath)) {
InputStream inputStream = c.getAssets().open(fontPath);
File file = createFileFromInputStream(inputStream);
if (file == null) {
return Typeface.DEFAULT;
}
Typeface t = Typeface.createFromFile(file);
typefaces.put(name, t);
} else {
return Typeface.DEFAULT;
}
} catch (Throwable e) {
e.printStackTrace();
return Typeface.DEFAULT;
}
}
return typefaces.get(name);
}
}
private static File createFileFromInputStream(InputStream inputStream) {
try {
File f = File.createTempFile("font", null);
OutputStream outputStream = new FileOutputStream(f);
byte buffer[] = new byte[1024];
int length = 0;
while ((length = inputStream.read(buffer)) > 0) {
outputStream.write(buffer, 0, length);
}
outputStream.close();
inputStream.close();
return f;
} catch (Exception e) {
e.printStackTrace();
}
return null;
}

- 599
- 3
- 20
-
From Android O onwards you can specify fonts directly in XML : https://developer.android.com/guide/topics/ui/look-and-feel/fonts-in-xml.html – Harsh Apr 16 '18 at 04:44
-