Esempio n. 1
0
        public static MSFontWeight PreferredFontWeight(MSFontStyle style)
        {
            switch (style)
            {
            case MSFontStyle.SU:
            case MSFontStyle.XXL:
            case MSFontStyle.XL:
                return(MSFontWeight.Light);

            case MSFontStyle.L:
                return(MSFontWeight.SemiLight);

            case MSFontStyle.MPlus:
            case MSFontStyle.M:
            case MSFontStyle.SPlus:
            case MSFontStyle.S:
            case MSFontStyle.XS:
                return(MSFontWeight.Regular);

            case MSFontStyle.MI:
                return(MSFontWeight.Semibold);

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
Esempio n. 2
0
 public static void MSLabel(this UILabel self, MSFontStyle style = MSFontStyle.L, UIColor textColor = null)
 {
     if (textColor == null)
     {
         textColor = UIColorMS.NeutralPrimary;
     }
     self.Font      = UIFontMS.FromStyle(style, MSFontConstants.PreferredFontWeight(style));
     self.TextColor = textColor;
 }
 public static UIFont FromStyle(MSFontStyle style, MSFontWeight weight)
 {
     if (UIDevice.CurrentDevice.CheckSystemVersion(8, 2))
     {
         return(UIFont.SystemFontOfSize(MSFontConstants.FontSize(style), MSFontConstants.FontWeight(weight)));
     }
     else
     {
         return(UIFont.SystemFontOfSize(MSFontConstants.FontSize(style)));
     }
 }
        public static nfloat FontSize(MSFontStyle style)
        {
            switch (style)
            {
            case MSFontStyle.SU:
                return(42);

            case MSFontStyle.XXL:
                return(28);

            case MSFontStyle.XL:
                return(21);

            case MSFontStyle.L:
                return(17);

            case MSFontStyle.MPlus:
                return(15);

            case MSFontStyle.M:
                return(14);

            case MSFontStyle.SPlus:
                return(13);

            case MSFontStyle.S:
                return(12);

            case MSFontStyle.XS:
                return(11);

            case MSFontStyle.MI:
                return(10);

            default:
                throw new ArgumentOutOfRangeException();
            }
        }