/// <summary> /// To the font family. /// </summary> /// <param name="module">The module.</param> /// <returns></returns> public static FontFamily ToFontFamily(this IIconModule module) { var moduleType = module.GetType(); if (_fontCache.ContainsKey(moduleType) == false) { _fontCache.Add(moduleType, new FontFamily($"ms-appx:///{module.GetType().GetTypeInfo().Assembly.GetName().Name}/{module.FontPath}#{module.FontFamily}")); } return(_fontCache[moduleType]); }
/// <summary> /// To the typeface. /// </summary> /// <param name="module">The module.</param> /// <param name="context">The context.</param> /// <returns></returns> public static Typeface ToTypeface(this IIconModule module, Context context) { var moduleType = module.GetType(); if (_fontCache.ContainsKey(moduleType) == false) { _fontCache.Add(moduleType, Typeface.CreateFromAsset(context.Assets, module.FontPath)); } return(_fontCache[moduleType]); }
/// <summary> /// To the font family. /// </summary> /// <param name="module">The module.</param> /// <returns></returns> public static FontFamily ToFontFamily(this IIconModule module) { var moduleType = module.GetType(); if (!FontCache.ContainsKey(moduleType)) { FontCache.Add(moduleType, new FontFamily($"ms-appx:///{moduleType.GetTypeInfo().Assembly.GetName().Name}/{module.FontPath}#{module.FontFamily.Replace(" Regular","")}")); } return(FontCache[moduleType]); }
/// <summary> /// To the typeface. /// </summary> /// <param name="module">The module.</param> /// <param name="context">The context.</param> /// <returns></returns> public static Typeface ToTypeface(this IIconModule module, Context context) { var moduleType = module.GetType(); if (!FontCache.ContainsKey(moduleType)) { FontCache.Add(moduleType, Typeface.CreateFromAsset(Application.Context.Assets, module.FontPath)); } return(FontCache[moduleType]); }
/// <summary> /// To the font family. /// </summary> /// <param name="module">The module.</param> /// <returns></returns> public static FontFamily ToFontFamily(this IIconModule module) { var moduleType = module.GetType(); if (!FontCache.ContainsKey(moduleType)) { FontCache.Add(moduleType, new FontFamily(new Uri("pack://application:,,,/"), $"/#{module.FontFamily}")); } return(FontCache[moduleType]); }