Example usage for android.graphics Typeface createFromAsset

List of usage examples for android.graphics Typeface createFromAsset

Introduction

In this page you can find the example usage for android.graphics Typeface createFromAsset.

Prototype

public static Typeface createFromAsset(AssetManager mgr, String path) 

Source Link

Document

Create a new typeface from the specified font data.

Usage

From source file:Main.java

public static Typeface createTypeface(Context context, int typeface) {
    return Typeface.createFromAsset(context.getAssets(),
            String.format("fonts/%s.ttf", context.getString(typeface)));
}

From source file:Main.java

public static Typeface getTypeFace(Context context, String typeFace) {
    Typeface tf = Typeface.createFromAsset(context.getAssets(), "fonts/" + typeFace);
    return tf;//  w  ww .j  a  v  a2 s . c  o  m
}

From source file:Main.java

public static void applyFont(TextView textView, String fontPath) {
    Typeface fontFace = Typeface.createFromAsset(textView.getContext().getAssets(), fontPath);
    textView.setTypeface(fontFace);/*from w  w  w .j  a  v  a2  s  .c o m*/
}

From source file:Main.java

public static Typeface getFontRoboto(Context context) {
    return Typeface.createFromAsset(context.getAssets(), "Roboto-Regular.ttf");
}

From source file:Main.java

public static Typeface getCustomTypefaceByName(Context context, String faceName) {
    Typeface typeface = Typeface.createFromAsset(context.getAssets(), "fonts/" + faceName);
    return typeface;
}

From source file:Main.java

public static void setLightFontFamily(Context context, TextView view) {
    Typeface tf = Typeface.createFromAsset(context.getAssets(), "Gill Sans/Gill Sans MT Light.ttf");
    view.setTypeface(tf);//w  ww.  j av  a2s.  c  om
}

From source file:Main.java

public static void setTextViewTypeface(TextView textView) {
    String font = "LockScreen_Clock.ttf";
    textView.setTypeface(Typeface.createFromAsset(textView.getContext().getAssets(), font));
}

From source file:Main.java

public static void setFengGe(Context context, TextView tv, String ttf) {
    Typeface fontFace = Typeface.createFromAsset(context.getAssets(), ttf);
    tv.setTypeface(fontFace);//from  www  .  j  av a 2 s . c  o  m
}

From source file:Main.java

public static Typeface getTypeFace(Context context, String typefaceName) {

    return Typeface.createFromAsset(context.getAssets(), typefaceName);

}

From source file:Main.java

public static void changeToComicSansItalic(CheckBox checkBox, AssetManager asset) {
    Typeface typeface = Typeface.createFromAsset(asset, "fonts/comicsans.ttf");
    checkBox.setTypeface(typeface, Typeface.ITALIC);
}