private void init(AttributeSet attrs, int defStyleAttr, int defStyleRes) {
        if (attrs == null)
            return;

        final Context context = getContext();
        final Resources resources = getResources();
        final float density = resources.getDisplayMetrics().density;

        TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.TextView, defStyleAttr, defStyleRes);
        int border = a.getInt(R.styleable.TextView_gBorder, 0);
        int borderSize = a.getDimensionPixelOffset(R.styleable.TextView_gBorderSize, (int) density);
        int borderColor = a.getColor(R.styleable.TextView_gBorderColor, UiCompat.getColor(resources, R.color.g_default_base_secondary));
        String fontFile = a.getString(R.styleable.TextView_gFont);
        a.recycle();

        setBorder(border, borderSize, borderColor);

        // Check for IDE preview render
        if (!this.isInEditMode() && fontFile != null && fontFile.length() > 0) {
            Typeface typeface = Ui.getFont(getContext(), fontFile);
            if (typeface != null) setTypeface(typeface);
        }
    }
TextView this is quickly setup
This supper custom font and custom border
<p>
<p><strong>XML attributes</strong></p>
<p>
See {@link net.qiujuer.genius.ui.R.styleable#TextView_gBorder Attributes},
{@link net.qiujuer.genius.ui.R.styleable#TextView_gBorderColor Attributes},
{@link net.qiujuer.genius.ui.R.styleable#TextView_gBorderSize Attributes}
{@link net.qiujuer.genius.ui.R.styleable#TextView_gFont Attributes}
caprice/ui/src/main/java/net/qiujuer/genius/ui/widget/TextView.java