示例#1
0
    public XTypefaceHack(string fontFamilyName, XFontStyle style, XFontWeight weight, XFontStretch stretch)
    {
      if (String.IsNullOrEmpty(fontFamilyName))
        throw new ArgumentNullException("fontFamilyName");

      this.fontFamilyName = fontFamilyName;
      this.style = style;
      this.weight = weight;
      this.stretch = stretch;
    }
示例#2
0
        public XTypefaceHack(string fontFamilyName, XFontStyle style, XFontWeight weight, XFontStretch stretch)
        {
            if (String.IsNullOrEmpty(fontFamilyName))
            {
                throw new ArgumentNullException("fontFamilyName");
            }

            this.fontFamilyName = fontFamilyName;
            this.style          = style;
            this.weight         = weight;
            this.stretch        = stretch;
        }
示例#3
0
 public XTypefaceHack(string typefaceName, XFontStyle style, XFontWeight weight)
   : this(typefaceName, style, weight, new XFontStretch())
 { }
示例#4
0
        //public static XFontWeight FromOpenTypeWeight(int weightValue)
        //{
        //  if (weightValue < 1 || weightValue > 999)
        //    throw new ArgumentOutOfRangeException("weightValue", "Parameter must be between 1 and 999.");
        //  return new XFontWeight(weightValue);
        //}

        /// <summary>
        /// Compares the specified font weights.
        /// </summary>
        public static int Compare(XFontWeight left, XFontWeight right)
        {
            return(left.weight - right.weight);
        }
示例#5
0
 /// <summary>
 /// Determines whether the specified <see cref="XFontWeight"/> is equal to the current <see cref="XFontWeight"/>.
 /// </summary>
 public bool Equals(XFontWeight obj)
 {
     return(this == obj);
 }
示例#6
0
    //public static XFontWeight FromOpenTypeWeight(int weightValue)
    //{
    //  if (weightValue < 1 || weightValue > 999)
    //    throw new ArgumentOutOfRangeException("weightValue", "Parameter must be between 1 and 999.");
    //  return new XFontWeight(weightValue);
    //}

    /// <summary>
    /// Compares the specified font weights.
    /// </summary>
    public static int Compare(XFontWeight left, XFontWeight right)
    {
      return left.weight - right.weight;
    }
示例#7
0
 /// <summary>
 /// Determines whether the specified <see cref="XFontWeight"/> is equal to the current <see cref="XFontWeight"/>.
 /// </summary>
 public bool Equals(XFontWeight obj)
 {
   return this == obj;
 }
示例#8
0
    internal static bool FontWeightStringToKnownWeight(string s, IFormatProvider provider, ref XFontWeight fontWeight)
    {
      int num;
      switch (s.ToLower())
      {
        case "thin":
          fontWeight = Thin;
          return true;

        case "extralight":
          fontWeight = ExtraLight;
          return true;

        case "ultralight":
          fontWeight = UltraLight;
          return true;

        case "light":
          fontWeight = Light;
          return true;

        case "normal":
          fontWeight = Normal;
          return true;

        case "regular":
          fontWeight = Regular;
          return true;

        case "medium":
          fontWeight = Medium;
          return true;

        case "semibold":
          fontWeight = SemiBold;
          return true;

        case "demibold":
          fontWeight = DemiBold;
          return true;

        case "bold":
          fontWeight = Bold;
          return true;

        case "extrabold":
          fontWeight = ExtraBold;
          return true;

        case "ultrabold":
          fontWeight = UltraBold;
          return true;

        case "heavy":
          fontWeight = Heavy;
          return true;

        case "black":
          fontWeight = Black;
          return true;

        case "extrablack":
          fontWeight = ExtraBlack;
          return true;

        case "ultrablack":
          fontWeight = UltraBlack;
          return true;
      }

      if (Int32.TryParse(s, NumberStyles.Integer, provider, out num))
      {
        fontWeight = new XFontWeight(num);
        return true;
      }
      return false;
    }
示例#9
0
        internal static bool FontWeightStringToKnownWeight(string s, IFormatProvider provider, ref XFontWeight fontWeight)
        {
            int num;

            switch (s.ToLower())
            {
            case "thin":
                fontWeight = Thin;
                return(true);

            case "extralight":
                fontWeight = ExtraLight;
                return(true);

            case "ultralight":
                fontWeight = UltraLight;
                return(true);

            case "light":
                fontWeight = Light;
                return(true);

            case "normal":
                fontWeight = Normal;
                return(true);

            case "regular":
                fontWeight = Regular;
                return(true);

            case "medium":
                fontWeight = Medium;
                return(true);

            case "semibold":
                fontWeight = SemiBold;
                return(true);

            case "demibold":
                fontWeight = DemiBold;
                return(true);

            case "bold":
                fontWeight = Bold;
                return(true);

            case "extrabold":
                fontWeight = ExtraBold;
                return(true);

            case "ultrabold":
                fontWeight = UltraBold;
                return(true);

            case "heavy":
                fontWeight = Heavy;
                return(true);

            case "black":
                fontWeight = Black;
                return(true);

            case "extrablack":
                fontWeight = ExtraBlack;
                return(true);

            case "ultrablack":
                fontWeight = UltraBlack;
                return(true);
            }

            if (Int32.TryParse(s, NumberStyles.Integer, provider, out num))
            {
                fontWeight = new XFontWeight(num);
                return(true);
            }
            return(false);
        }
示例#10
0
 public XTypefaceHack(string typefaceName, XFontStyle style, XFontWeight weight)
     : this(typefaceName, style, weight, new XFontStretch())
 {
 }