private void Init(Context context, Icon icon) { _context = context; _icon = icon; _paint = new TextPaint(); _paint.SetTypeface(Iconify.FindTypefaceOf(icon).GetTypeface(context)); _paint.SetStyle(Paint.Style.Fill); _paint.TextAlign = Paint.Align.Center; _paint.UnderlineText = false; _paint.Color = Color.Black; _paint.AntiAlias = true; }
/// <summary> /// Create an IconDrawable. /// </summary> /// <param name="context"> Your activity or application context. </param> /// <param name="icon"> The icon you want this drawable to display. </param> public IconDrawable(Context context, Icon icon) { Init(context, icon); }
/// <summary> /// Finds the Typeface to apply for a given icon. /// </summary> /// <param name="icon"> The icon for which you need the typeface. </param> /// <returns> /// The font descriptor which contains info about the typeface to apply, or null /// if the icon cannot be found. In that case, check that you properly added the modules /// using <seealso cref="#With(IconFontDescriptor)" />} prior to calling this method. /// </returns> public static IconFontDescriptorWrapper FindTypefaceOf(Icon icon) { return iconFontDescriptors.FirstOrDefault(iconFontDescriptor => iconFontDescriptor.HasIcon(icon)); }