示例#1
0
        /// <summary>
        /// Convert from the font boldness enumiration to string to be used in CSS
        /// </summary>
        /// <param name="fontBoldnessEnum">boldness to convert</param>
        /// <returns>resulting width as string</returns>
        public static string FromWidth(FontBoldnessEnum fontBoldnessEnum)
        {
            switch (fontBoldnessEnum)
            {
            case FontBoldnessEnum.B100:
                return("100");

            case FontBoldnessEnum.B200:
                return("200");

            case FontBoldnessEnum.B300:
                return("300");

            case FontBoldnessEnum.B400:
                return("normal");

            case FontBoldnessEnum.B500:
                return("500");

            case FontBoldnessEnum.B600:
                return("600");

            case FontBoldnessEnum.B700:
                return("bold");

            case FontBoldnessEnum.B800:
                return("800");

            case FontBoldnessEnum.B900:
                return("900");

            case FontBoldnessEnum.Lighter:
                return("lighter");

            case FontBoldnessEnum.Bolder:
                return("bolder");
            }
            return(string.Empty);
        }
示例#2
0
 public void CopyFrom(ICSSFont cssFont)
 {
     if (cssFont == null)
     {
         throw new ArgumentNullException("cssFont");
     }
     if (cssFont == this)
     {
         return;
     }
     _width      = cssFont.FontWidth;
     FontStyle   = cssFont.FontStyle;
     FontVariant = cssFont.FontVariant;
     FontStretch = cssFont.FontStretch;
     _sources.Clear();
     foreach (var fontSource in cssFont.Sources)
     {
         var newSource = new FontSource();
         newSource.CopyFrom(fontSource);
         _sources.Add(newSource);
     }
 }
示例#3
0
 public void CopyFrom(ICSSFont cssFont)
 {
     if (cssFont == null)
     {
         throw new ArgumentNullException("cssFont");
     }
     if (cssFont == this)
     {
         return;
     }
     _width = cssFont.FontWidth;
     FontStyle = cssFont.FontStyle;
     FontVariant = cssFont.FontVariant;
     FontStretch = cssFont.FontStretch;
     _sources.Clear();
     foreach (var fontSource in cssFont.Sources)
     {
         var newSource = new FontSource();
         newSource.CopyFrom(fontSource);
         _sources.Add(newSource);
     }
 }
 /// <summary>
 /// Convert from the font boldness enumiration to string to be used in CSS
 /// </summary>
 /// <param name="fontBoldnessEnum">boldness to convert</param>
 /// <returns>resulting width as string</returns>
 public static string FromWidth(FontBoldnessEnum fontBoldnessEnum)
 {
     switch (fontBoldnessEnum)
     {
         case FontBoldnessEnum.B100:
             return "100";
         case FontBoldnessEnum.B200:
             return "200";
         case FontBoldnessEnum.B300:
             return "300";
         case FontBoldnessEnum.B400:
             return "normal";
         case FontBoldnessEnum.B500:
             return "500";
         case FontBoldnessEnum.B600:
             return "600";
         case FontBoldnessEnum.B700:
             return "bold";
         case FontBoldnessEnum.B800:
             return "800";
         case FontBoldnessEnum.B900:
             return "900";
         case FontBoldnessEnum.Lighter:
             return "lighter";
         case FontBoldnessEnum.Bolder:
             return "bolder";
     }
     return string.Empty;
 }
        private void SetWidthBox(FontBoldnessEnum fontBoldnessEnum)
        {
            switch (fontBoldnessEnum)
            {
                case FontBoldnessEnum.Normal:
                    comboBoxWidth.SelectedItem = "400 (normal)";
                    break;
                case FontBoldnessEnum.Lighter:
                    comboBoxWidth.SelectedItem = "lighter";
                    break;
                case FontBoldnessEnum.Bolder:
                    comboBoxWidth.SelectedItem = "bolder";
                    break;
                case FontBoldnessEnum.B100:
                    comboBoxWidth.SelectedItem = "100";
                    break;
                case FontBoldnessEnum.B200:
                    comboBoxWidth.SelectedItem = "200";
                    break;
                case FontBoldnessEnum.B300:
                    comboBoxWidth.SelectedItem = "300";
                    break;
                case FontBoldnessEnum.B500:
                    comboBoxWidth.SelectedItem = "500";
                    break;
                case FontBoldnessEnum.B600:
                    comboBoxWidth.SelectedItem = "600";
                    break;
                case FontBoldnessEnum.B800:
                    comboBoxWidth.SelectedItem = "800";
                    break;
                case FontBoldnessEnum.B900:
                    comboBoxWidth.SelectedItem = "900";
                    break;
                case FontBoldnessEnum.Bold:
                    comboBoxWidth.SelectedItem = "700 (bold)";
                    break;

            }
        }