Example #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;
    }
Example #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;
        }
Example #3
0
 public XTypefaceHack(string typefaceName, XFontStyle style, XFontWeight weight)
   : this(typefaceName, style, weight, new XFontStretch())
 { }
Example #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);
        }
Example #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);
 }
Example #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;
    }
Example #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;
 }
Example #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;
    }
Example #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);
        }
Example #10
0
 public XTypefaceHack(string typefaceName, XFontStyle style, XFontWeight weight)
     : this(typefaceName, style, weight, new XFontStretch())
 {
 }