Esempio n. 1
0
        public static FontAttributes GetFont(this View view, FontAttributes defaultFont)
        {
            var size   = view.GetEnvironment <float?>(EnvironmentKeys.Fonts.Size) ?? defaultFont.Size;
            var name   = view.GetEnvironment <string>(EnvironmentKeys.Fonts.Family) ?? defaultFont.Family;
            var weight = view.GetEnvironment <Weight?>(EnvironmentKeys.Fonts.Weight) ?? defaultFont.Weight;
            var italic = view.GetEnvironment <bool?>(EnvironmentKeys.Fonts.Italic) ?? defaultFont.Italic;

            return(new FontAttributes
            {
                Size = size,
                Family = name,
                Italic = italic,
                Weight = weight,
            });
        }
Esempio n. 2
0
 public static T Font <T>(this T view, FontAttributes value) where T : View
 => view.FontFamily(value.Family)
 .FontSize(value.Size)
 .FontItalic(value.Italic)
 .FontWeight(value.Weight);