Cheesebaron.FontSample.MyEditText.SetCustomFont C# (CSharp) Method

SetCustomFont() public method

public SetCustomFont ( string asset ) : void
asset string
return void
        public void SetCustomFont(string asset)
        {
            Typeface tf;
            try
            {
                tf = Typeface.CreateFromAsset(Context.Assets, asset);
            }
            catch (Exception e)
            {
                Log.Error(Tag, string.Format("Could not get Typeface: {0} Error: {1}", asset, e));
                return;
            }

            if (null == tf) return;

            var tfStyle = TypefaceStyle.Normal;
            if (null != Typeface) //Takes care of android:textStyle=""
                tfStyle = Typeface.Style;
            SetTypeface(tf, tfStyle);
        }
    }