static String pullFontPathFromStyle ( Context context , AttributeSet attrs , int [ ] attributeId ) { if ( attributeId == null || attrs == null ) return null ; final TypedArray typedArray = context . obtainStyledAttributes ( attrs , attributeId ) ; if ( typedArray != null ) { try { // First defined attribute String fontFromAttribute = typedArray . getString ( 0 ) ; if ( ! TextUtils . isEmpty ( fontFromAttribute ) ) { return fontFromAttribute ; } } catch ( Exception ignore ) { // Failed for some reason. } finally { typedArray . recycle ( ) ; } } return null ; }
Tries to pull the Font Path from the View Style as this is the next decendent after being defined in the View s xml .