material/src/main/java/com/rey/material/util/TypefaceUtil.java
public static Typeface load(Context context, String familyName, int style) {
        if (familyName != null && familyName.startsWith(PREFIX_ASSET))
            synchronized (sCachedFonts) {
                try {
                    if (!sCachedFonts.containsKey(familyName)) {
                        final Typeface typeface = Typeface.createFromAsset(context.getAssets(), familyName.substring(PREFIX_ASSET.length()));
                        sCachedFonts.put(familyName, typeface);
                        return typeface;
                    }
                } catch (Exception e) {
                    return Typeface.DEFAULT;
                }

                return sCachedFonts.get(familyName);
            }

        return Typeface.create(familyName, style);
    }
/**
     * @param familyName if start with 'asset:' prefix, then load font from asset folder.
     */
@param familyName if start with 'asset:' prefix, then load font from asset folder.
@param familyName if start with ' asset : ' prefix then load font from asset folder .
public static Typeface load(Context context, String familyName, int style) {
        if (familyName != null && familyName.startsWith(PREFIX_ASSET))
            synchronized (sCachedFonts) {
                try {
                    if (!sCachedFonts.containsKey(familyName)) {
                        final Typeface typeface = Typeface.createFromAsset(context.getAssets(), familyName.substring(PREFIX_ASSET.length()));
                        sCachedFonts.put(familyName, typeface);
                        return typeface;
                    }
                } catch (Exception e) {
                    return Typeface.DEFAULT;
                }
                return sCachedFonts.get(familyName);
            }
        return Typeface.create(familyName, style);
    }
public static Typeface load ( Context context , String familyName , int style ) { if ( familyName != null && familyName . startsWith ( PREFIX_ASSET ) ) synchronized ( sCachedFonts ) { try { if ( ! sCachedFonts . containsKey ( familyName ) ) { final Typeface typeface = Typeface . createFromAsset ( context . getAssets ( ) , familyName . substring ( PREFIX_ASSET . length ( ) ) ) ; sCachedFonts . put ( familyName , typeface ) ; return typeface ; } } catch ( Exception e ) { return Typeface . DEFAULT ; } return sCachedFonts . get ( familyName ) ; } return Typeface . create ( familyName , style ) ; }
@param familyName if start with 'asset:' prefix, then load font from asset folder.
@param familyName if start with ' asset : ' prefix then load font from asset folder .