List of usage examples for android.graphics Typeface createFromAsset
public static Typeface createFromAsset(AssetManager mgr, String path)
From source file:Main.java
public static Typeface getTypeFaceRobotoRegular(Context context) { if (typeFaceRobotoRegular == null) { typeFaceRobotoRegular = Typeface.createFromAsset(context.getAssets(), "fonts/Roboto-Regular.ttf"); }/*from w w w . j av a 2 s. c o m*/ return typeFaceRobotoRegular; }
From source file:Main.java
private static Typeface getChronicaProRegular(Context context) { if (mChronicaProRegularFont == null) mChronicaProRegularFont = Typeface.createFromAsset(context.getAssets(), "fonts/ChronicaPro-Regular.otf"); return mChronicaProRegularFont; }
From source file:Main.java
public static void setFontFace(TextView v, Context context) { if (font == null) font = Typeface.createFromAsset(context.getAssets(), "fontawesome-webfont.ttf"); v.setTypeface(font);/*from ww w .j av a2s. c om*/ }
From source file:Main.java
public static void init(Context context) { typefaceLatoRegular = Typeface.createFromAsset(context.getAssets(), "fonts/Lato-Regular.ttf"); typefaceLatoHairline = Typeface.createFromAsset(context.getAssets(), "fonts/Lato-Hairline.ttf"); typefaceLatoLight = Typeface.createFromAsset(context.getAssets(), "fonts/LatoLatin-Light.ttf"); }
From source file:Main.java
/** * //from w w w .ja v a 2 s.c o m * @param context * @param assetsPah:"fonts/xxx.ttf" * @return * usage:textView.setTypeface(typeface); */ public static Typeface getTypeface(Context context, String assetsPah) { Typeface typeface = Typeface.createFromAsset(context.getAssets(), assetsPah); return typeface; }
From source file:Main.java
private static void initFonts(Context context) { if (robotoRegular == null) { robotoRegular = Typeface.createFromAsset(context.getAssets(), "Roboto-Regular.ttf"); }/* ww w.j ava 2 s. co m*/ if (robotoMedium == null) { robotoMedium = Typeface.createFromAsset(context.getAssets(), "Roboto-Medium.ttf"); } }
From source file:Main.java
/** * * @param context//from ww w. ja va 2 s . c o m * @return The custom Typeface for RobotoSlab-Bold.ttf */ public static Typeface robotoBold(Context context) { return Typeface.createFromAsset(context.getAssets(), "fonts/RobotoSlab-Bold.ttf"); }
From source file:Main.java
/** * * @param context//from w w w . ja v a2 s. co m * @return The custom Typeface for RobotoSlab-Light.ttf */ public static Typeface robotoThin(Context context) { return Typeface.createFromAsset(context.getAssets(), "fonts/RobotoSlab-Light.ttf"); }
From source file:Main.java
/** * * @param context//from www . j a v a 2 s . c o m * @return The custom Typeface for RobotoSlab-Regular.ttf */ public static Typeface robotoRegular(Context context) { return Typeface.createFromAsset(context.getAssets(), "fonts/RobotoSlab-Regular.ttf"); }
From source file:Main.java
public static Typeface get(Context c, String name) { synchronized (cache) { if (!cache.containsKey(name)) { Typeface t = Typeface.createFromAsset(c.getAssets(), String.format("fonts/%s.ttf", name)); cache.put(name, t);//from w w w.ja va2 s .c om return t; } return cache.get(name); } }