internal static FontFamily FontFor(IconChar iconChar) { if (Orphans.Contains(iconChar)) { return(null); } var typeFace = Typefaces.Find(iconChar.UniCode(), out _, out _); return(typeFace?.FontFamily); }
/// <summary> /// Renders an image for the specified font, style and icon /// </summary> /// <param name="iconChar">The icon to render</param> /// <param name="iconFont">The icon font style</param> /// <param name="brush">The icon brush / color</param> /// <param name="size">The icon size in pixels</param> /// <returns>The rendered image</returns> public static ImageSource ToImageSource(this IconChar iconChar, IconFont iconFont, Brush brush = null, double size = DefaultSize) { var typeface = TypefaceFor(iconChar, iconFont); if (typeface == null) { return(null); } return(typeface.TryFind(iconChar.UniCode(), out var gt, out var glyphIndex) ? ToImageSource(brush, size, gt, glyphIndex) : null); }
internal static Typeface TypefaceFor(IconChar iconChar) { return(Orphans.Contains(iconChar) ? null : Typefaces.Find(iconChar.UniCode(), out _, out _)); }