예제 #1
0
 ///<summary>
 /// Creates a new DrawableFont instance.
 ///</summary>
 ///<param name="family">The font family or the full path to the font file.</param>
 ///<param name="style">The style of the font.</param>
 ///<param name="weight">The weight of the font.</param>
 ///<param name="stretch">The font stretching type.</param>
 public DrawableFont(string family, FontStyleType style, FontWeight weight, FontStretch stretch)
 {
     Family  = family;
     Style   = style;
     Weight  = weight;
     Stretch = stretch;
 }
예제 #2
0
 public ReportFont(FontStyleType fontStyle, string fontFamily, Unit fontSize, ReportFontWeight fontWeight)
 {
     FontStyle  = fontStyle;
     FontFamily = fontFamily;
     FontSize   = fontSize;
     FontWeight = fontWeight;
 }
        public static IFontStyle GetStyleWithWeightNearestTo(
            this IFontFamily family,
            int weight,
            FontStyleType type = FontStyleType.Normal)
        {
            if (family == null)
            {
                return(null);
            }

            IFontStyle closest           = null;
            var        closestDifference = int.MaxValue;

            foreach (var font in family.GetFontStyles())
            {
                if (font.StyleType == type)
                {
                    var difference = Math.Abs(font.Weight - weight);
                    if (difference == 0)
                    {
                        return(font);
                    }

                    if (difference < closestDifference)
                    {
                        closest           = font;
                        closestDifference = difference;
                    }
                }
            }

            return(closest);
        }
예제 #4
0
 ///<summary>
 /// Creates a new DrawableFont instance.
 ///</summary>
 ///<param name="family">The font family or the full path to the font file.</param>
 ///<param name="style">The style of the font.</param>
 ///<param name="weight">The weight of the font.</param>
 ///<param name="stretch">The font stretching type.</param>
 public DrawableFont(string family, FontStyleType style, FontWeight weight, FontStretch stretch)
 {
   Family = family;
   Style = style;
   Weight = weight;
   Stretch = stretch;
 }
예제 #5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="DrawableFont"/> class.
        /// </summary>
        /// <param name="family">The font family or the full path to the font file.</param>
        /// <param name="style">The style of the font.</param>
        /// <param name="weight">The weight of the font.</param>
        /// <param name="stretch">The font stretching type.</param>
        public DrawableFont(string family, FontStyleType style, FontWeight weight, FontStretch stretch)
        {
            Throw.IfNullOrEmpty(nameof(family), family);

            Family  = family;
            Style   = style;
            Weight  = weight;
            Stretch = stretch;
        }
예제 #6
0
    /// <summary>
    /// Initializes a new instance of the <see cref="DrawableFont"/> class.
    /// </summary>
    /// <param name="family">The font family or the full path to the font file.</param>
    /// <param name="style">The style of the font.</param>
    /// <param name="weight">The weight of the font.</param>
    /// <param name="stretch">The font stretching type.</param>
    public DrawableFont(string family, FontStyleType style, FontWeight weight, FontStretch stretch)
    {
      Throw.IfNullOrEmpty(nameof(family), family);

      Family = family;
      Style = style;
      Weight = weight;
      Stretch = stretch;
    }
 public NativeFontStyle(NativeFontFamily family, string id, string name, string fullName, int weight, FontStyleType styleType)
 {
     _family   = family;
     Id        = id;
     Name      = name;
     FullName  = fullName;
     Weight    = weight;
     StyleType = styleType;
 }
예제 #8
0
 public NativeFontStyle(NativeFontFamily family, string id, string name, string fullName, int weight, FontStyleType styleType, string path, bool resource = false)
 {
     _family   = family;
     Id        = id;
     Name      = name;
     FullName  = fullName;
     Weight    = weight;
     StyleType = styleType;
     Path      = path;
     Resource  = resource;
 }
예제 #9
0
        public DXFontStyle(DXFontFamily family, string id, string name, string fullName, FontStyle style, FontWeight weight, FontFace fontFace)
        {
            _family    = family;
            _id        = id;
            _name      = name;
            _fullName  = fullName;
            _styleType = style.AsStyleType();
            _weight    = (int)weight;

            _dxFontStyle  = style;
            _dxFontWeight = weight;
            _dxFontFace   = fontFace;
        }
예제 #10
0
 internal static FontStyle EnsureFontStyle(FontStyleType style)
 {
     switch (style)
     {
         case FontStyleType.Normal:
         case FontStyleType.Italic:
             {
                 return new FontStyle(style);
             }
         default:
             {
                 throw new ArgumentOutOfRangeException("style");
             }
     }
 }
예제 #11
0
 /**
  * @ 生成验证图片
  * @ codeLength 验证码长度4-16
  * @ fineNess 图片清晰度0-100
  * @ imgWidth 图片宽度16-360
  * @ imgHeight 图片高度16-320
  * @ fontFamily 字体家族名称"宋体"
  * @ fontSize 字体大小8-72
  * @ fontStyle 字体样式
  * @ pointX 绘制起始 X 坐标点
  * @ pointY 绘制起始 Y 坐标点
  * @ sessionKey 保存验证码值到 Session 的 key
  * @ codeStyle 验证码类型
  * */
 public byte[] WriterCode(int codeLength, int fineNess, int imgWidth, int imgHeight, string fontFamily, int fontSize, FontStyleType fontStyle, int pointX, int pointY, string sessionKey, CodeStyleType codeStyle)
 {
     this.codeLen    = codeLength;
     this.fineness   = fineNess;
     this.imgWidth   = imgWidth;
     this.imgHeight  = imgHeight;
     this.fontFamily = fontFamily;
     this.fontSize   = fontSize;
     this.fontStyle  = fontStyle;
     this.posX       = pointX;
     this.posY       = pointY;
     this.sessionkey = sessionKey;
     this.codestyle  = codeStyle;
     return(WriterCode());
 }
    public void AssignDefaultValues()
    {
        m_id           = "HelloWorldMessage";
        _mesg          = "Hello World";
        _x             = 10;
        _y             = 20;
        _width         = 100;
        _height        = 30;
        _drawBorder    = true;
        _fontType      = FontType.TIMES_ROMAN;
        _fontStyleType = FontStyleType.NORMAL;
        _fontSize      = 10;
        _color         = new Color(0, 0, 0, 1);

        hasContent = false;
    }
예제 #13
0
        internal static FontStyle EnsureFontStyle(FontStyleType style)
        {
            switch (style)
            {
            case FontStyleType.Normal:
            case FontStyleType.Italic:
            {
                return(new FontStyle(style));
            }

            default:
            {
                throw new ArgumentOutOfRangeException("style");
            }
            }
        }
    public void AssignValues(string msgId, string mesg, short x, short y, ushort width, ushort height, bool drawBorder,
                             FontType fontType, FontStyleType fontStyleType, byte fontSize, Color color)
    {
        m_id           = msgId;
        _mesg          = mesg;
        _x             = x;
        _y             = y;
        _width         = width;
        _height        = height;
        _drawBorder    = drawBorder;
        _fontType      = fontType;
        _fontStyleType = fontStyleType;
        _fontSize      = fontSize;
        _color         = color; // should be converted prior to this function

        hasContent = false;
    }
예제 #15
0
        /// <summary>
        /// Generates an Footer from its RDL representation.
        /// </summary>
        /// <param name="reader">The <typeparamref name="XmlReader"/> stream from which the Footer is deserialized</param>
        public void ReadXml(XmlReader reader)
        {
            while (reader.Read())
            {
                if (reader.NodeType == XmlNodeType.EndElement && reader.Name == XML_REPORT_FONT)
                {
                    break;
                }
                else if (reader.NodeType == XmlNodeType.Element)
                {
                    switch (reader.Name)
                    {
                    case XML_FONT_FAMILY: _fontFamily = reader.ReadString(); break;

                    case XML_FONT_SIZE: _fontSize = new Unit(reader.ReadString(), null, UnitType.Point); break;

                    case XML_FONT_STYLE: _fontStyle = (FontStyleType)Enum.Parse(typeof(FontStyleType), reader.ReadString()); break;

                    case XML_FONT_WEIGHT: _fontWeight.Value = reader.ReadString(); break;
                    }
                }
            }
        }
예제 #16
0
		public DrawableFont(String family, FontStyleType style, FontWeight weight, FontStretch stretch)
			: base(AssemblyHelper.CreateInstance(Types.DrawableFont, new Type[] {typeof(String), Types.FontStyleType, Types.FontWeight, Types.FontStretch}, family, style, weight, stretch))
		{
		}
예제 #17
0
 public TextStyle FontStyle(FontStyleType fontStyle)
 {
     this.fontStyle = fontStyle;
     return(this);
 }
 internal static extern void DrawSetFontStyle(IntPtr wand, FontStyleType style);
예제 #19
0
 /// <summary>
 /// Applies the DrawableFont operation to the <see cref="Drawables" />.
 /// </summary>
 /// <param name="family">The font family or the full path to the font file.</param>
 /// <param name="style">The style of the font.</param>
 /// <param name="weight">The weight of the font.</param>
 /// <param name="stretch">The font stretching type.</param>
 /// <returns>The <see cref="Drawables" /> instance.</returns>
 public IDrawables <QuantumType> Font(string family, FontStyleType style, FontWeight weight, FontStretch stretch)
 {
     _drawables.Add(new DrawableFont(family, style, weight, stretch));
     return(this);
 }
 public static IFontStyle GetBoldStyle(
     this IFontFamily family,
     FontStyleType type = FontStyleType.Normal)
 {
     return(family?.GetStyleWithWeightNearestTo(500, type));
 }
예제 #21
0
 internal FontStyle(FontStyleType style)
 {
     this.style = style;
 }
예제 #22
0
 public DrawableFont(String family, FontStyleType style, FontWeight weight, FontStretch stretch)
     : base(AssemblyHelper.CreateInstance(Types.DrawableFont, new Type[] { typeof(String), Types.FontStyleType, Types.FontWeight, Types.FontStretch }, family, style, weight, stretch))
 {
 }
예제 #23
0
 public void FontFamily(string family, FontStyleType style, FontWeight weight, FontStretch stretch)
 {
   _NativeInstance.FontFamily(family, style, weight, stretch);
 }
예제 #24
0
 /// <summary>
 /// Creates a new DrawableFont instance.
 /// </summary>
 /// <param name="family">The font family or the full path to the font file.</param>
 /// <param name="style">The style of the font.</param>
 /// <param name="weight">The weight of the font.</param>
 /// <param name="stretch">The font stretching type.</param>
 public Drawables Font(string family, FontStyleType style, FontWeight weight, FontStretch stretch)
 {
   _Drawables.Add(new DrawableFont(family, style, weight, stretch));
   return this;
 }
예제 #25
0
        /// <summary>
        /// Sets the  font style of the title.
        /// </summary>
        /// <returns>The title font style.</returns>
        /// <param name="fontStyle">Font style.</param>
        public TBuilder SetTitleFontStyle(FontStyleType fontStyle)
        {
            Chart.Options.Title.FontStyle = fontStyle;

            return(BuilderInstance);
        }
예제 #26
0
 public void FontFamily(string family, FontStyleType style, FontWeight weight, FontStretch stretch) => _nativeInstance.FontFamily(family, style, weight, stretch);
예제 #27
0
        /// <summary>
        /// Sets the legend label font style.
        /// </summary>
        /// <returns>The legend label font style.</returns>
        /// <param name="fontStyle">Font style.</param>
        public TBuilder SetLegendLabelFontStyle(FontStyleType fontStyle)
        {
            Chart.Options.Legend.Labels.FontStyle = fontStyle;

            return(BuilderInstance);
        }
예제 #28
0
 internal static extern void DrawSetFontStyle(IntPtr wand, FontStyleType style);
예제 #29
0
        /// <summary>
        /// Font size for the tick labels.
        /// </summary>
        /// <param name="fontStyle"></param>
        /// <returns></returns>
        public TBuilder SetXAxesTicksFontStyle(FontStyleType fontStyle)
        {
            Chart.Options.Scales.XAxes[0].Ticks.FontStyle = fontStyle;

            return(BuilderInstance);
        }
예제 #30
0
 /// <summary>
 /// Adds a new instance of the <see cref="DrawableFont" /> class to the <see cref="Drawables" />.
 /// </summary>
 /// <param name="family">The font family or the full path to the font file.</param>
 /// <param name="style">The style of the font.</param>
 /// <param name="weight">The weight of the font.</param>
 /// <param name="stretch">The font stretching type.</param>
 /// <returns>The <see cref="Drawables" /> instance.</returns>
 public Drawables Font(string family, FontStyleType style, FontWeight weight, FontStretch stretch)
 {
     _Drawables.Add(new DrawableFont(family, style, weight, stretch));
     return(this);
 }
예제 #31
0
 public void Font(string family, FontStyleType style, FontWeight weight, FontStretch stretch)
 {
     _NativeInstance.Font(family, style, weight, stretch);
 }
예제 #32
0
 public void FontFamily(string family, FontStyleType style, FontWeight weight, FontStretch stretch)
 {
   using (INativeInstance familyNative = UTF8Marshaler.CreateInstance(family))
   {
     IntPtr exception = IntPtr.Zero;
     #if ANYCPU
     if (NativeLibrary.Is64Bit)
     #endif
     #if WIN64 || ANYCPU
     NativeMethods.X64.DrawingWand_FontFamily(Instance, familyNative.Instance, (UIntPtr)style, (UIntPtr)weight, (UIntPtr)stretch, out exception);
     #endif
     #if ANYCPU
     else
     #endif
     #if !WIN64 || ANYCPU
     NativeMethods.X86.DrawingWand_FontFamily(Instance, familyNative.Instance, (UIntPtr)style, (UIntPtr)weight, (UIntPtr)stretch, out exception);
     #endif
     CheckException(exception);
   }
 }
예제 #33
0
        /// <summary>
        /// Font style for the tick labels, follows CSS font-style options (i.e. normal, italic, oblique, initial, inherit).
        /// </summary>
        /// <param name="fontStyle"></param>
        /// <returns></returns>
        public TBuilder SetYAxesTicksMajorFontStyle(FontStyleType fontStyle)
        {
            Chart.Options.Scales.YAxes[0].Ticks.Major.FontStyle = fontStyle;

            return(BuilderInstance);
        }