예제 #1
0
/// Call the CreateImage() function to save the text entered into the text box to a stream which will be
/// drawn in the CreateImage() function:
///  CreateImage( txt_Image.Text, font ).Save( Response.OutputStream, System.Drawing.Imaging.ImageFormat.Gif );

		static public Bitmap CreateImage(string text, FontInfo fontInfo, Color color)
		{
			Bitmap bmpImage = new Bitmap(1, 1);

			int iWidth = 0;
			int iHeight = 0;

			float emSize = Convert.ToSingle(fontInfo.Size.Unit.Value);
			emSize = (emSize == 0 ? 12 : emSize);
			Font stringFont = new Font(fontInfo.Name, emSize);

			// Create a graphics object to measure the text's width and height.
			Graphics MyGraphics = Graphics.FromImage(bmpImage);

			// This is where the bitmap size is determined.
			iWidth = (int)MyGraphics.MeasureString(text, stringFont).Width;
			iHeight = (int)MyGraphics.MeasureString(text, stringFont).Height;

			// Create the bmpImage again with the correct size for the text and font.
			bmpImage = new Bitmap(bmpImage, new Size(iWidth, iHeight));

			// Add the colors to the new bitmap.
			MyGraphics = Graphics.FromImage(bmpImage);
			MyGraphics.Clear(Color.Navy);
			MyGraphics.TextRenderingHint = TextRenderingHint.AntiAlias;
			MyGraphics.DrawString(text, stringFont, new SolidBrush(color), 0, 0);
			MyGraphics.Flush();
			return (bmpImage);
		}
예제 #2
0
		internal void RemoveTextStyles () {
			ForeColor = Color.Empty;
			fontinfo = null;
		}
예제 #3
0
 public void MergeWith(FontInfo f)
 {
 }
 private IDictionary ConvertFontInfoToCss(FontInfo font)
 {
     IDictionary dictionary = new HybridDictionary();
     string name = font.Name;
     if (name.Length != 0)
     {
         dictionary["font-family"] = HttpUtility.HtmlEncode(name);
     }
     FontUnit size = font.Size;
     if (size != FontUnit.Empty)
     {
         dictionary["font-size"] = size.ToString(CultureInfo.CurrentCulture);
     }
     if (font.Bold)
     {
         dictionary["font-weight"] = "bold";
     }
     if (font.Italic)
     {
         dictionary["font-style"] = "italic";
     }
     string str2 = string.Empty;
     if (font.Underline)
     {
         str2 = str2 + "underline ";
     }
     if (font.Strikeout)
     {
         str2 = str2 + "line-through";
     }
     if (font.Overline)
     {
         str2 = str2 + "overline";
     }
     if (str2.Length > 0)
     {
         dictionary["text-decoration"] = str2.Trim();
     }
     return dictionary;
 }
 public void CopyFrom(FontInfo f)
 {
 }
 public void CopyFrom(FontInfo f)
 {
     if (f != null)
     {
         Style owner = f.Owner;
         if (owner.RegisteredCssClass.Length != 0)
         {
             if (owner.IsSet(0x200))
             {
                 this.ResetNames();
             }
             if (owner.IsSet(0x400) && (f.Size != FontUnit.Empty))
             {
                 this.ResetFontSize();
             }
             if (owner.IsSet(0x800))
             {
                 this.ResetBold();
             }
             if (owner.IsSet(0x1000))
             {
                 this.ResetItalic();
             }
             if (owner.IsSet(0x4000))
             {
                 this.ResetOverline();
             }
             if (owner.IsSet(0x8000))
             {
                 this.ResetStrikeout();
             }
             if (owner.IsSet(0x2000))
             {
                 this.ResetUnderline();
             }
         }
         else
         {
             if (owner.IsSet(0x200))
             {
                 this.Names = f.Names;
             }
             if (owner.IsSet(0x400) && (f.Size != FontUnit.Empty))
             {
                 this.Size = f.Size;
             }
             if (owner.IsSet(0x800))
             {
                 this.Bold = f.Bold;
             }
             if (owner.IsSet(0x1000))
             {
                 this.Italic = f.Italic;
             }
             if (owner.IsSet(0x4000))
             {
                 this.Overline = f.Overline;
             }
             if (owner.IsSet(0x8000))
             {
                 this.Strikeout = f.Strikeout;
             }
             if (owner.IsSet(0x2000))
             {
                 this.Underline = f.Underline;
             }
         }
     }
 }
예제 #7
0
파일: FontInfoCas.cs 프로젝트: nobled/mono
		public void FixtureSetUp ()
		{
			fi = new Style ().Font;
		}
예제 #8
0
파일: Style.cs 프로젝트: raj581/Marvin
        void WriteStyleAttributes(HtmlTextWriter writer)
        {
            string      s;
            Color       color;
            BorderStyle bs;
            Unit        u;

            if (CheckBit((int)Styles.BackColor))
            {
                color = (Color)viewstate["BackColor"];
                if (!color.IsEmpty)
                {
                    writer.AddStyleAttribute(HtmlTextWriterStyle.BackgroundColor, ColorTranslator.ToHtml(color));
                }
            }

            if (CheckBit((int)Styles.BorderColor))
            {
                color = (Color)viewstate["BorderColor"];
                if (!color.IsEmpty)
                {
                    writer.AddStyleAttribute(HtmlTextWriterStyle.BorderColor, ColorTranslator.ToHtml(color));
                }
            }

            bool have_width = false;

            if (CheckBit((int)Styles.BorderWidth))
            {
                u = (Unit)viewstate["BorderWidth"];
                if (!u.IsEmpty)
                {
                    if (u.Value > 0)
                    {
                        have_width = true;
                    }
                    writer.AddStyleAttribute(HtmlTextWriterStyle.BorderWidth, u.ToString());
                }
            }

            if (CheckBit((int)Styles.BorderStyle))
            {
                bs = (BorderStyle)viewstate["BorderStyle"];
                if (bs != BorderStyle.NotSet)
                {
                    writer.AddStyleAttribute(HtmlTextWriterStyle.BorderStyle, bs.ToString());
                }
                else
                {
                    if (CheckBit((int)Styles.BorderWidth))
                    {
                        writer.AddStyleAttribute(HtmlTextWriterStyle.BorderStyle, "solid");
                    }
                }
            }
            else if (have_width)
            {
                writer.AddStyleAttribute(HtmlTextWriterStyle.BorderStyle, "solid");
            }

            if (CheckBit((int)Styles.ForeColor))
            {
                color = (Color)viewstate["ForeColor"];
                if (!color.IsEmpty)
                {
                    writer.AddStyleAttribute(HtmlTextWriterStyle.Color, ColorTranslator.ToHtml(color));
                }
            }

            if (CheckBit((int)Styles.Height))
            {
                u = (Unit)viewstate["Height"];
                if (!u.IsEmpty)
                {
                    writer.AddStyleAttribute(HtmlTextWriterStyle.Height, u.ToString());
                }
            }

            if (CheckBit((int)Styles.Width))
            {
                u = (Unit)viewstate["Width"];
                if (!u.IsEmpty)
                {
                    writer.AddStyleAttribute(HtmlTextWriterStyle.Width, u.ToString());
                }
            }

            if (CheckBit((int)Style.Styles.FontAll))
            {
                // Fonts are a bit weird
                FontInfo font = Font;
                if (font.Name != string.Empty)
                {
                    s = font.Names[0];
                    for (int i = 1; i < font.Names.Length; i++)
                    {
                        s += "," + font.Names[i];
                    }
                    writer.AddStyleAttribute(HtmlTextWriterStyle.FontFamily, s);
                }

                if (font.Bold)
                {
                    writer.AddStyleAttribute(HtmlTextWriterStyle.FontWeight, "bold");
                }

                if (font.Italic)
                {
                    writer.AddStyleAttribute(HtmlTextWriterStyle.FontStyle, "italic");
                }

                if (!font.Size.IsEmpty)
                {
                    writer.AddStyleAttribute(HtmlTextWriterStyle.FontSize, font.Size.ToString());
                }

                // These styles are munged into a attribute decoration
                s = string.Empty;

                if (font.Overline)
                {
                    s += "overline ";
                }

                if (font.Strikeout)
                {
                    s += "line-through ";
                }

                if (font.Underline)
                {
                    s += "underline ";
                }

                s = (s != "") ? s : AlwaysRenderTextDecoration ? "none" : "";
                if (s != "")
                {
                    writer.AddStyleAttribute(HtmlTextWriterStyle.TextDecoration, s);
                }
            }
        }
 public void CopyFrom(FontInfo f)
 {
     if (f != null)
     {
         Style owner = f.Owner;
         if (owner.RegisteredCssClass.Length != 0)
         {
             if (owner.IsSet(0x200))
             {
                 this.ResetNames();
             }
             if (owner.IsSet(0x400) && (f.Size != FontUnit.Empty))
             {
                 this.ResetFontSize();
             }
             if (owner.IsSet(0x800))
             {
                 this.ResetBold();
             }
             if (owner.IsSet(0x1000))
             {
                 this.ResetItalic();
             }
             if (owner.IsSet(0x4000))
             {
                 this.ResetOverline();
             }
             if (owner.IsSet(0x8000))
             {
                 this.ResetStrikeout();
             }
             if (owner.IsSet(0x2000))
             {
                 this.ResetUnderline();
             }
         }
         else
         {
             if (owner.IsSet(0x200))
             {
                 this.Names = f.Names;
             }
             if (owner.IsSet(0x400) && (f.Size != FontUnit.Empty))
             {
                 this.Size = f.Size;
             }
             if (owner.IsSet(0x800))
             {
                 this.Bold = f.Bold;
             }
             if (owner.IsSet(0x1000))
             {
                 this.Italic = f.Italic;
             }
             if (owner.IsSet(0x4000))
             {
                 this.Overline = f.Overline;
             }
             if (owner.IsSet(0x8000))
             {
                 this.Strikeout = f.Strikeout;
             }
             if (owner.IsSet(0x2000))
             {
                 this.Underline = f.Underline;
             }
         }
     }
 }
예제 #10
0
        public void MergeWith(FontInfo f)
        {
            //Methods CopyFrom and MergeWith behave differently between 1.1 and 2.0
#if NET_2_0
            if (!_owner.CheckBit((int)Style.Styles.FontBold) && f._owner.CheckBit((int)Style.Styles.FontBold))
            {
                this.Bold = f.Bold;
            }

            if (!_owner.CheckBit((int)Style.Styles.FontItalic) && f._owner.CheckBit((int)Style.Styles.FontItalic))
            {
                this.Italic = f.Italic;
            }

            if (!_owner.CheckBit((int)Style.Styles.FontNames) && f._owner.CheckBit((int)Style.Styles.FontNames))
            {
                this.Names = f.Names;
            }

            if (!_owner.CheckBit((int)Style.Styles.FontOverline) && f._owner.CheckBit((int)Style.Styles.FontOverline))
            {
                this.Overline = f.Overline;
            }

            if (!_owner.CheckBit((int)Style.Styles.FontSize) && f._owner.CheckBit((int)Style.Styles.FontSize))
            {
                this.Size = f.Size;
            }

            if (!_owner.CheckBit((int)Style.Styles.FontStrikeout) && f._owner.CheckBit((int)Style.Styles.FontStrikeout))
            {
                this.Strikeout = f.Strikeout;
            }

            if (!_owner.CheckBit((int)Style.Styles.FontUnderline) && f._owner.CheckBit((int)Style.Styles.FontUnderline))
            {
                this.Underline = f.Underline;
            }
#else
            if (!_owner.CheckBit((int)Style.Styles.FontBold) && f._owner.CheckBit((int)Style.Styles.FontBold) && f.Bold)
            {
                this.Bold = true;
            }

            if (!_owner.CheckBit((int)Style.Styles.FontItalic) && f._owner.CheckBit((int)Style.Styles.FontItalic) && f.Italic)
            {
                this.Italic = true;
            }

            if (!_owner.CheckBit((int)Style.Styles.FontNames) && f._owner.CheckBit((int)Style.Styles.FontNames))
            {
                this.Names = f.Names;
            }

            if (!_owner.CheckBit((int)Style.Styles.FontOverline) && f._owner.CheckBit((int)Style.Styles.FontOverline) && f.Overline)
            {
                this.Overline = true;
            }

            if (!_owner.CheckBit((int)Style.Styles.FontSize) && f._owner.CheckBit((int)Style.Styles.FontSize))
            {
                this.Size = f.Size;
            }

            if (!_owner.CheckBit((int)Style.Styles.FontStrikeout) && f._owner.CheckBit((int)Style.Styles.FontStrikeout))
            {
                this.Strikeout = true;
            }

            if (!_owner.CheckBit((int)Style.Styles.FontUnderline) && f._owner.CheckBit((int)Style.Styles.FontUnderline) && f.Underline)
            {
                this.Underline = true;
            }
#endif
        }
예제 #11
0
        public void CopyFrom(FontInfo f)
        {
            //Methods CopyFrom and MergeWith behave differently between 1.1 and 2.0
            if (f == null || f.IsEmpty)
            {
                return;
            }

            if (f == this)
            {
                return;
            }

#if NET_2_0
            // MS stores the property in the bag if it's value is false
            if (f._owner.CheckBit((int)Style.Styles.FontBold))
            {
                this.Bold = f.Bold;
            }

            if (f._owner.CheckBit((int)Style.Styles.FontItalic))
            {
                this.Italic = f.Italic;
            }

            // MS seems to have some weird behaviour, even if f's Name has been set to String.Empty we still get an empty array
            this.Names = f.Names;

            if (f._owner.CheckBit((int)Style.Styles.FontOverline))
            {
                this.Overline = f.Overline;
            }

            if (f._owner.CheckBit((int)Style.Styles.FontSize))
            {
                this.Size = f.Size;
            }

            if (f._owner.CheckBit((int)Style.Styles.FontStrikeout))
            {
                this.Strikeout = f.Strikeout;
            }

            if (f._owner.CheckBit((int)Style.Styles.FontUnderline))
            {
                this.Underline = f.Underline;
            }
#else
            // MS does not store the property in the bag if it's value is false
            if ((f._owner.CheckBit((int)Style.Styles.FontBold)) && f.Bold)
            {
                this.Bold = true;
            }

            if ((f._owner.CheckBit((int)Style.Styles.FontItalic)) && f.Italic)
            {
                this.Italic = true;
            }

            // MS seems to have some weird behaviour, even if f's Name has been set to String.Empty we still get an empty array
            this.Names = f.Names;

            if ((f._owner.CheckBit((int)Style.Styles.FontOverline)) && f.Overline)
            {
                this.Overline = true;
            }

            if ((f._owner.CheckBit((int)Style.Styles.FontSize)) && (f.Size != FontUnit.Empty))
            {
                this.Size = f.Size;
            }

            if ((f._owner.CheckBit((int)Style.Styles.FontStrikeout)) && f.Strikeout)
            {
                this.Strikeout = true;
            }

            if ((f._owner.CheckBit((int)Style.Styles.FontUnderline)) && f.Underline)
            {
                this.Underline = true;
            }
#endif
        }
예제 #12
0
        /// <include file='doc\Style.uex' path='docs/doc[@for="Style.AddAttributesToRender1"]/*' />
        /// <devdoc>
        ///    <para>
        ///       Adds all non-blank style attributes to the HTML output stream to be rendered
        ///       to the client.
        ///    </para>
        /// </devdoc>
        public virtual void AddAttributesToRender(HtmlTextWriter writer, WebControl owner)
        {
            StateBag viewState = ViewState;

            // CssClass
            if (IsSet(PROP_CSSCLASS))
            {
                string css = (string)(viewState["CssClass"]);
                if (css.Length > 0)
                {
                    writer.AddAttribute(HtmlTextWriterAttribute.Class, css);
                }
            }

            Color c;
            Unit  u;

            // ForeColor
            if (IsSet(PROP_FORECOLOR))
            {
                c = (Color)(viewState["ForeColor"]);;
                if (!c.IsEmpty)
                {
                    writer.AddStyleAttribute(HtmlTextWriterStyle.Color, ColorTranslator.ToHtml(c));
                }
            }

            // BackColor
            if (IsSet(PROP_BACKCOLOR))
            {
                c = (Color)(viewState["BackColor"]);
                if (!c.IsEmpty)
                {
                    writer.AddStyleAttribute(HtmlTextWriterStyle.BackgroundColor, ColorTranslator.ToHtml(c));
                }
            }

            // BorderColor
            if (IsSet(PROP_BORDERCOLOR))
            {
                c = (Color)(viewState["BorderColor"]);
                if (!c.IsEmpty)
                {
                    writer.AddStyleAttribute(HtmlTextWriterStyle.BorderColor, ColorTranslator.ToHtml(c));
                }
            }

            BorderStyle bs = this.BorderStyle;
            Unit        bu = this.BorderWidth;

            if (!bu.IsEmpty)
            {
                writer.AddStyleAttribute(HtmlTextWriterStyle.BorderWidth, bu.ToString(CultureInfo.InvariantCulture));
                if (bs == BorderStyle.NotSet)
                {
                    if (bu.Value != 0.0)
                    {
                        writer.AddStyleAttribute(HtmlTextWriterStyle.BorderStyle, "solid");
                    }
                }
                else
                {
                    writer.AddStyleAttribute(HtmlTextWriterStyle.BorderStyle, Enum.Format(typeof(BorderStyle), bs, "G"));
                }
            }
            else
            {
                if (bs != BorderStyle.NotSet)
                {
                    writer.AddStyleAttribute(HtmlTextWriterStyle.BorderStyle, Enum.Format(typeof(BorderStyle), bs, "G"));
                }
            }

            // need to call the property get in case we have font properties from view state and have not
            // created the font object
            FontInfo font = Font;

            // Font.Names
            string[] names = font.Names;
            if (names.Length > 0)
            {
                writer.AddStyleAttribute(HtmlTextWriterStyle.FontFamily, Style.FormatStringArray(names, ','));
            }

            // Font.Size
            FontUnit fu = font.Size;

            if (fu.IsEmpty == false)
            {
                writer.AddStyleAttribute(HtmlTextWriterStyle.FontSize, fu.ToString(CultureInfo.InvariantCulture));
            }

            // CONSIDER: How do we determine whether to render "normal" for font-weight or font-style?
            //           How do we determine whether to render "none" for text-decoration?

            // Font.Bold
            bool fw = font.Bold;

            if (fw == true)
            {
                writer.AddStyleAttribute(HtmlTextWriterStyle.FontWeight, "bold");
            }
            // Font.Italic
            bool fi = font.Italic;

            if (fi == true)
            {
                writer.AddStyleAttribute(HtmlTextWriterStyle.FontStyle, "italic");
            }

            bool   underline = font.Underline;
            bool   overline  = font.Overline;
            bool   strikeout = font.Strikeout;
            string td        = String.Empty;

            // CONSIDER, nikhilko: we need to detect not-set state and write out "none"
            if (underline)
            {
                td = "underline";
            }
            if (overline)
            {
                td += " overline";
            }
            if (strikeout)
            {
                td += " line-through";
            }
            if (td.Length > 0)
            {
                writer.AddStyleAttribute(HtmlTextWriterStyle.TextDecoration, td);
            }


            // Height
            if (IsSet(PROP_HEIGHT))
            {
                u = (Unit)(viewState["Height"]);
                if (u.IsEmpty == false)
                {
                    writer.AddStyleAttribute(HtmlTextWriterStyle.Height, u.ToString(CultureInfo.InvariantCulture));
                }
            }

            // Width
            if (IsSet(PROP_WIDTH))
            {
                u = (Unit)(viewState["Width"]);
                if (u.IsEmpty == false)
                {
                    writer.AddStyleAttribute(HtmlTextWriterStyle.Width, u.ToString(CultureInfo.InvariantCulture));
                }
            }
        }
예제 #13
0
파일: Util.cs 프로젝트: Leonscape/ESWCtrls
        public static System.Drawing.Font ConvertFont(FontInfo FontInfo)
        {
            if (FontInfo == null) return new Font("Verdana", 12, FontStyle.Regular, GraphicsUnit.Pixel);

            string name = FontInfo.Name;
            if (string.IsNullOrEmpty(name)) name = "Verdana";

            float size = 12;
            GraphicsUnit unitType = GraphicsUnit.Pixel;

            if (!FontInfo.Size.IsEmpty)
            {
                size = (float)FontInfo.Size.Unit.Value;
                switch (FontInfo.Size.Unit.Type)
                {
                    case UnitType.Em:
                    case UnitType.Ex:
                    case UnitType.Percentage:
                    case UnitType.Pica:
                        size = 12;
                        break;
                    case UnitType.Pixel:
                        unitType = GraphicsUnit.Pixel;
                        break;
                    case UnitType.Point:
                        unitType = GraphicsUnit.Point;
                        break;
                    case UnitType.Mm:
                        unitType = GraphicsUnit.Millimeter;
                        break;
                    case UnitType.Cm:
                        unitType = GraphicsUnit.Millimeter;
                        size *= 10;
                        break;
                    case UnitType.Inch:
                        unitType = GraphicsUnit.Inch;
                        break;
                }
            }

            FontStyle style = FontStyle.Regular;
            if (FontInfo.Bold) style = FontStyle.Bold;
            if (FontInfo.Underline) style = style | FontStyle.Underline;
            if (FontInfo.Strikeout) style = style | FontStyle.Strikeout;
            if (FontInfo.Italic) style = style | FontStyle.Italic;

            return new Font(name, size, style, unitType);
        }
예제 #14
0
파일: FontInfo.cs 프로젝트: nobled/mono
		public void MergeWith (FontInfo f) 
		{
			if (!_owner.CheckBit ((int) Style.Styles.FontBold) && f._owner.CheckBit ((int) Style.Styles.FontBold))
				this.Bold = f.Bold;

			if (!_owner.CheckBit ((int) Style.Styles.FontItalic) && f._owner.CheckBit ((int) Style.Styles.FontItalic))
				this.Italic = f.Italic;

			if (!_owner.CheckBit ((int) Style.Styles.FontNames) && f._owner.CheckBit ((int) Style.Styles.FontNames))
				this.Names = f.Names;

			if (!_owner.CheckBit ((int) Style.Styles.FontOverline) && f._owner.CheckBit ((int) Style.Styles.FontOverline))
				this.Overline = f.Overline;

			if (!_owner.CheckBit ((int) Style.Styles.FontSize) && f._owner.CheckBit ((int) Style.Styles.FontSize))
				this.Size = f.Size;

			if (!_owner.CheckBit ((int) Style.Styles.FontStrikeout) && f._owner.CheckBit ((int) Style.Styles.FontStrikeout))
				this.Strikeout = f.Strikeout;

			if (!_owner.CheckBit ((int) Style.Styles.FontUnderline) && f._owner.CheckBit ((int) Style.Styles.FontUnderline))
				this.Underline = f.Underline;
		}
예제 #15
0
파일: FontInfo.cs 프로젝트: nobled/mono
		public void CopyFrom (FontInfo f) 
		{
			if (f == null || f.IsEmpty)
				return;

			if (f == this)
				return;

			// MS stores the property in the bag if it's value is false
			if (f._owner.CheckBit((int) Style.Styles.FontBold))
				this.Bold = f.Bold;

			if (f._owner.CheckBit ((int) Style.Styles.FontItalic))
				this.Italic = f.Italic;

			// MS seems to have some weird behaviour, even if f's Name has been set to String.Empty we still get an empty array
			this.Names = f.Names;

			if (f._owner.CheckBit ((int) Style.Styles.FontOverline))
				this.Overline = f.Overline;

			if (f._owner.CheckBit ((int) Style.Styles.FontSize))
				this.Size = f.Size;

			if (f._owner.CheckBit ((int) Style.Styles.FontStrikeout))
				this.Strikeout = f.Strikeout;

			if (f._owner.CheckBit ((int) Style.Styles.FontUnderline))
				this.Underline = f.Underline;
		}
예제 #16
0
        public WebClientQuery()
        {
            _column = new WebQueryColumnsCollection(this, typeof(QueryColumns));
            _gaphorizontal = 10;
            _gapvertical = 10;
            _keepcondition = false;
            this.Font.Name = "Simsun";
            this.Font.Size = FontUnit.Medium;
            _font = this.Font;

            _forecolor = SystemColors.ControlText;
            _textcolor = SystemColors.ControlText;
            _bordercolor = Color.Black;
            _innertable = false;
        }
예제 #17
0
        /// <devdoc>
        /// <para>Copies the font properties of another <see cref='System.Web.UI.WebControls.FontInfo'/> into this instance. </para>
        /// </devdoc>
        public void CopyFrom(FontInfo f) {
            if (f != null) {
                Style fOwner = f.Owner;
                if (fOwner.RegisteredCssClass.Length != 0) {
                    if (fOwner.IsSet(Style.PROP_FONT_NAMES))
                        ResetNames();
                    if (fOwner.IsSet(Style.PROP_FONT_SIZE) && (f.Size != FontUnit.Empty))
                        ResetFontSize();
                    if (fOwner.IsSet(Style.PROP_FONT_BOLD))
                        ResetBold();
                    if (fOwner.IsSet(Style.PROP_FONT_ITALIC))
                        ResetItalic();
                    if (fOwner.IsSet(Style.PROP_FONT_OVERLINE))
                        ResetOverline();
                    if (fOwner.IsSet(Style.PROP_FONT_STRIKEOUT))
                        ResetStrikeout();
                    if (fOwner.IsSet(Style.PROP_FONT_UNDERLINE))
                        ResetUnderline();
                }
                else {
                    if (fOwner.IsSet(Style.PROP_FONT_NAMES)) {
                        Names = f.Names;
                    }
                    if (fOwner.IsSet(Style.PROP_FONT_SIZE) && (f.Size != FontUnit.Empty))
                        Size = f.Size;

                    // Only carry through true boolean values. Otherwise merging and copying
                    // can do 3 different things for each property, but they are only persisted
                    // as 2 state values.
                    if (fOwner.IsSet(Style.PROP_FONT_BOLD))
                        Bold = f.Bold;
                    if (fOwner.IsSet(Style.PROP_FONT_ITALIC))
                        Italic = f.Italic;
                    if (fOwner.IsSet(Style.PROP_FONT_OVERLINE))
                        Overline = f.Overline;
                    if (fOwner.IsSet(Style.PROP_FONT_STRIKEOUT))
                        Strikeout = f.Strikeout;
                    if (fOwner.IsSet(Style.PROP_FONT_UNDERLINE))
                        Underline = f.Underline;
                }
            }
        }
예제 #18
0
 /// <devdoc>
 /// <para>Combines the font properties of another <see cref='System.Web.UI.WebControls.FontInfo'/> with this
 ///    instance. </para>
 /// </devdoc>
 public void MergeWith(FontInfo f) {
     if (f != null) {
         Style fOwner = f.Owner;
         if (fOwner.RegisteredCssClass.Length == 0) {
             if (fOwner.IsSet(Style.PROP_FONT_NAMES) && !owner.IsSet(Style.PROP_FONT_NAMES))
                 Names = f.Names;
             if (fOwner.IsSet(Style.PROP_FONT_SIZE) && (!owner.IsSet(Style.PROP_FONT_SIZE) || (Size == FontUnit.Empty)))
                 Size = f.Size;
             if (fOwner.IsSet(Style.PROP_FONT_BOLD) && !owner.IsSet(Style.PROP_FONT_BOLD))
                 Bold = f.Bold;
             if (fOwner.IsSet(Style.PROP_FONT_ITALIC) && !owner.IsSet(Style.PROP_FONT_ITALIC))
                 Italic = f.Italic;
             if (fOwner.IsSet(Style.PROP_FONT_OVERLINE) && !owner.IsSet(Style.PROP_FONT_OVERLINE))
                 Overline = f.Overline;
             if (fOwner.IsSet(Style.PROP_FONT_STRIKEOUT) && !owner.IsSet(Style.PROP_FONT_STRIKEOUT))
                 Strikeout = f.Strikeout;
             if (fOwner.IsSet(Style.PROP_FONT_UNDERLINE) && !owner.IsSet(Style.PROP_FONT_UNDERLINE))
                 Underline = f.Underline;
         }
     }
 }
예제 #19
0
파일: Style.cs 프로젝트: raj581/Marvin
 internal void RemoveTextStyles()
 {
     ForeColor = Color.Empty;
     fontinfo  = null;
 }
예제 #20
0
		public void CopyFrom(FontInfo f) 
		{
			//Methods CopyFrom and MergeWith behave differently between 1.1 and 2.0
			if (f == null || f.IsEmpty)
				return;

			if (f == this)
				return;

#if NET_2_0
			// MS stores the property in the bag if it's value is false
			if (f._owner.CheckBit((int) Style.Styles.FontBold)) {
				this.Bold = f.Bold;
			}

			if (f._owner.CheckBit ((int) Style.Styles.FontItalic)) {
				this.Italic = f.Italic;
			}

			// MS seems to have some weird behaviour, even if f's Name has been set to String.Empty we still get an empty array
			this.Names = f.Names;

			if (f._owner.CheckBit ((int) Style.Styles.FontOverline)) {
				this.Overline = f.Overline;
			}

			if (f._owner.CheckBit ((int) Style.Styles.FontSize)) {
				this.Size = f.Size;
			}

			if (f._owner.CheckBit ((int) Style.Styles.FontStrikeout)) {
				this.Strikeout = f.Strikeout;
			}

			if (f._owner.CheckBit ((int) Style.Styles.FontUnderline)) {
				this.Underline = f.Underline;
			}
#else
			// MS does not store the property in the bag if it's value is false
			if ((f._owner.CheckBit ((int) Style.Styles.FontBold)) && f.Bold) 
			{
				this.Bold = true;
			}

			if ((f._owner.CheckBit ((int) Style.Styles.FontItalic)) && f.Italic) 
			{
				this.Italic = true;
			}

			// MS seems to have some weird behaviour, even if f's Name has been set to String.Empty we still get an empty array
			this.Names = f.Names;

			if ((f._owner.CheckBit ((int) Style.Styles.FontOverline)) && f.Overline) 
			{
				this.Overline = true;
			}

			if ((f._owner.CheckBit ((int) Style.Styles.FontSize)) && (f.Size != FontUnit.Empty)) 
			{
				this.Size = f.Size;
			}

			if ((f._owner.CheckBit ((int) Style.Styles.FontStrikeout)) && f.Strikeout) 
			{
				this.Strikeout = true;
			}

			if ((f._owner.CheckBit ((int) Style.Styles.FontUnderline)) && f.Underline) 
			{
				this.Underline = true;
			}
#endif
		}
 public void MergeWith(FontInfo f)
 {
     if (f != null)
     {
         Style owner = f.Owner;
         if (owner.RegisteredCssClass.Length == 0)
         {
             if (owner.IsSet(0x200) && !this.owner.IsSet(0x200))
             {
                 this.Names = f.Names;
             }
             if (owner.IsSet(0x400) && (!this.owner.IsSet(0x400) || (this.Size == FontUnit.Empty)))
             {
                 this.Size = f.Size;
             }
             if (owner.IsSet(0x800) && !this.owner.IsSet(0x800))
             {
                 this.Bold = f.Bold;
             }
             if (owner.IsSet(0x1000) && !this.owner.IsSet(0x1000))
             {
                 this.Italic = f.Italic;
             }
             if (owner.IsSet(0x4000) && !this.owner.IsSet(0x4000))
             {
                 this.Overline = f.Overline;
             }
             if (owner.IsSet(0x8000) && !this.owner.IsSet(0x8000))
             {
                 this.Strikeout = f.Strikeout;
             }
             if (owner.IsSet(0x2000) && !this.owner.IsSet(0x2000))
             {
                 this.Underline = f.Underline;
             }
         }
     }
 }
예제 #22
0
		public void MergeWith(FontInfo f) 
		{
			//Methods CopyFrom and MergeWith behave differently between 1.1 and 2.0
#if NET_2_0
			if (!_owner.CheckBit ((int) Style.Styles.FontBold) && f._owner.CheckBit ((int) Style.Styles.FontBold)) {
				this.Bold = f.Bold;
			}

			if (!_owner.CheckBit ((int) Style.Styles.FontItalic) && f._owner.CheckBit ((int) Style.Styles.FontItalic)) {
				this.Italic = f.Italic;
			}

			if (!_owner.CheckBit ((int) Style.Styles.FontNames) && f._owner.CheckBit ((int) Style.Styles.FontNames)) {
				this.Names = f.Names;
			}

			if (!_owner.CheckBit ((int) Style.Styles.FontOverline) && f._owner.CheckBit ((int) Style.Styles.FontOverline)) {
				this.Overline = f.Overline;
			}

			if (!_owner.CheckBit ((int) Style.Styles.FontSize) && f._owner.CheckBit ((int) Style.Styles.FontSize)) {
				this.Size = f.Size;
			}

			if (!_owner.CheckBit ((int) Style.Styles.FontStrikeout) && f._owner.CheckBit ((int) Style.Styles.FontStrikeout)) {
				this.Strikeout = f.Strikeout;
			}

			if (!_owner.CheckBit ((int) Style.Styles.FontUnderline) && f._owner.CheckBit ((int) Style.Styles.FontUnderline)) {
				this.Underline = f.Underline;
			}
#else
			if (!_owner.CheckBit ((int) Style.Styles.FontBold) && f._owner.CheckBit ((int) Style.Styles.FontBold) && f.Bold) 
			{
				this.Bold = true;
			}

			if (!_owner.CheckBit ((int) Style.Styles.FontItalic) && f._owner.CheckBit ((int) Style.Styles.FontItalic) && f.Italic) 
			{
				this.Italic = true;
			}

			if (!_owner.CheckBit ((int) Style.Styles.FontNames) && f._owner.CheckBit ((int) Style.Styles.FontNames)) 
			{
				this.Names = f.Names;
			}

			if (!_owner.CheckBit ((int) Style.Styles.FontOverline) && f._owner.CheckBit ((int) Style.Styles.FontOverline) && f.Overline) 
			{
				this.Overline = true;
			}

			if (!_owner.CheckBit ((int) Style.Styles.FontSize) && f._owner.CheckBit ((int) Style.Styles.FontSize)) 
			{
				this.Size = f.Size;
			}

			if (!_owner.CheckBit ((int) Style.Styles.FontStrikeout) && f._owner.CheckBit ((int) Style.Styles.FontStrikeout)) 
			{
				this.Strikeout = true;
			}

			if (!_owner.CheckBit ((int) Style.Styles.FontUnderline) && f._owner.CheckBit ((int) Style.Styles.FontUnderline) && f.Underline) 
			{
				this.Underline = true;
			}
#endif
		}
        protected override sealed void FillStyleAttributes(CssStyleCollection attributes, IUrlResolutionService urlResolver)
        {
            Debug.Assert(_owner != null);

            StateBag viewState = ViewState;

            Color c;

            // ForeColor
            if (_owner.IsSet(PROP_FORECOLOR))
            {
                c = _owner.ForeColor;
                if (!c.IsEmpty)
                {
                    attributes.Add(HtmlTextWriterStyle.Color, ColorTranslator.ToHtml(c));
                }
            }
            // Not defaulting to black anymore for not entirely satisfying but reasonable reasons (VSWhidbey 356729)

            // need to call the property get in case we have font properties from view state and have not
            // created the font object
            FontInfo font = _owner.Font;

            // Font.Names
            string[] names = font.Names;
            if (names.Length > 0)
            {
                attributes.Add(HtmlTextWriterStyle.FontFamily, String.Join(",", names));
            }

            // Font.Size
            FontUnit fu = font.Size;

            if (fu.IsEmpty == false)
            {
                attributes.Add(HtmlTextWriterStyle.FontSize, fu.ToString(CultureInfo.InvariantCulture));
            }

            // Font.Bold
            if (_owner.IsSet(PROP_FONT_BOLD))
            {
                if (font.Bold)
                {
                    attributes.Add(HtmlTextWriterStyle.FontWeight, "bold");
                }
                else
                {
                    attributes.Add(HtmlTextWriterStyle.FontWeight, "normal");
                }
            }

            // Font.Italic
            if (_owner.IsSet(PROP_FONT_ITALIC))
            {
                if (font.Italic == true)
                {
                    attributes.Add(HtmlTextWriterStyle.FontStyle, "italic");
                }
                else
                {
                    attributes.Add(HtmlTextWriterStyle.FontStyle, "normal");
                }
            }

            string textDecoration = String.Empty;

            if (font.Underline)
            {
                textDecoration = "underline";
            }
            if (font.Overline)
            {
                textDecoration += " overline";
            }
            if (font.Strikeout)
            {
                textDecoration += " line-through";
            }
            if (textDecoration.Length > 0)
            {
                attributes.Add(HtmlTextWriterStyle.TextDecoration, textDecoration);
            }
            else
            {
                if (!DoNotRenderDefaults)
                {
                    attributes.Add(HtmlTextWriterStyle.TextDecoration, "none");
                }
            }
            // Removing the border with an inline style if the class name was set
            if (_owner.IsSet(PROP_CSSCLASS))
            {
                attributes.Add(HtmlTextWriterStyle.BorderStyle, "none");
            }
        }
예제 #24
0
        protected sealed override void FillStyleAttributes(CssStyleCollection attributes, IUrlResolutionService urlResolver)
        {
            StateBag viewState = base.ViewState;

            if (this._owner.IsSet(4))
            {
                Color foreColor = this._owner.ForeColor;
                if (!foreColor.IsEmpty)
                {
                    attributes.Add(HtmlTextWriterStyle.Color, ColorTranslator.ToHtml(foreColor));
                }
            }
            FontInfo font = this._owner.Font;

            string[] names = font.Names;
            if (names.Length > 0)
            {
                attributes.Add(HtmlTextWriterStyle.FontFamily, string.Join(",", names));
            }
            FontUnit size = font.Size;

            if (!size.IsEmpty)
            {
                attributes.Add(HtmlTextWriterStyle.FontSize, size.ToString(CultureInfo.InvariantCulture));
            }
            if (this._owner.IsSet(0x800))
            {
                if (font.Bold)
                {
                    attributes.Add(HtmlTextWriterStyle.FontWeight, "bold");
                }
                else
                {
                    attributes.Add(HtmlTextWriterStyle.FontWeight, "normal");
                }
            }
            if (this._owner.IsSet(0x1000))
            {
                if (font.Italic)
                {
                    attributes.Add(HtmlTextWriterStyle.FontStyle, "italic");
                }
                else
                {
                    attributes.Add(HtmlTextWriterStyle.FontStyle, "normal");
                }
            }
            string str = string.Empty;

            if (font.Underline)
            {
                str = "underline";
            }
            if (font.Overline)
            {
                str = str + " overline";
            }
            if (font.Strikeout)
            {
                str = str + " line-through";
            }
            if (str.Length > 0)
            {
                attributes.Add(HtmlTextWriterStyle.TextDecoration, str);
            }
            else if (!this.DoNotRenderDefaults)
            {
                attributes.Add(HtmlTextWriterStyle.TextDecoration, "none");
            }
            if (this._owner.IsSet(2))
            {
                attributes.Add(HtmlTextWriterStyle.BorderStyle, "none");
            }
        }
 public void MergeWith(FontInfo f)
 {
 }
예제 #26
0
		public void CopyFrom(FontInfo source)
		{
			if(source!=null)
			{
				if(source.Owner.IsSet(Style.FONT_NAMES))
					Names = source.Names;
				if(source.Owner.IsSet(Style.FONT_BOLD)&& source.Bold)
					Bold = source.Bold;
				if(source.Owner.IsSet(Style.FONT_ITALIC)&& source.Italic)
					Italic = source.Italic;
				if(source.Owner.IsSet(Style.FONT_STRIKE)&& source.Strikeout)
					Strikeout = source.Strikeout;
				if(source.Owner.IsSet(Style.FONT_OLINE)&& source.Overline)
					Overline = source.Overline;
				if(source.Owner.IsSet(Style.FONT_ULINE)&& source.Underline)
					Underline = source.Underline;
				if(source.Owner.IsSet(Style.FONT_SIZE) && source.Size != FontUnit.Empty)
					Size = source.Size;
			}
		}
예제 #27
0
 public void CopyFrom(FontInfo f)
 {
 }
예제 #28
0
		public void MergeWith(FontInfo with)
		{
			if(with!=null)
			{
				if(with.Owner.IsSet(Style.FONT_NAMES) && !infoOwner.IsSet(Style.FONT_NAMES))
					Names = with.Names;
				if(with.Owner.IsSet(Style.FONT_BOLD) && !infoOwner.IsSet(Style.FONT_BOLD))
					Bold = with.Bold;
				if(with.Owner.IsSet(Style.FONT_ITALIC) && !infoOwner.IsSet(Style.FONT_ITALIC))
					Italic = with.Italic;
				if(with.Owner.IsSet(Style.FONT_STRIKE) && !infoOwner.IsSet(Style.FONT_STRIKE))
					Strikeout = with.Strikeout;
				if(with.Owner.IsSet(Style.FONT_OLINE) && !infoOwner.IsSet(Style.FONT_OLINE))
					Overline = with.Overline;
				if(with.Owner.IsSet(Style.FONT_ULINE) && !infoOwner.IsSet(Style.FONT_ULINE))
					Underline = with.Underline;
				if(with.Owner.IsSet(Style.FONT_SIZE) && with.Size != FontUnit.Empty && !infoOwner.IsSet(Style.FONT_SIZE))
					Size = with.Size;
			}
		}
예제 #29
0
        protected virtual void FillStyleAttributes(CssStyleCollection attributes, IUrlResolutionService urlResolver)
        {
            StateBag viewState = ViewState;

            Color c;

            // ForeColor
            if (IsSet(PROP_FORECOLOR))
            {
                c = (Color)viewState["ForeColor"];
                if (!c.IsEmpty)
                {
                    attributes.Add(HtmlTextWriterStyle.Color, ColorTranslator.ToHtml(c));
                }
            }

            // BackColor
            if (IsSet(PROP_BACKCOLOR))
            {
                c = (Color)viewState["BackColor"];
                if (!c.IsEmpty)
                {
                    attributes.Add(HtmlTextWriterStyle.BackgroundColor, ColorTranslator.ToHtml(c));
                }
            }

            // BorderColor
            if (IsSet(PROP_BORDERCOLOR))
            {
                c = (Color)viewState["BorderColor"];
                if (!c.IsEmpty)
                {
                    attributes.Add(HtmlTextWriterStyle.BorderColor, ColorTranslator.ToHtml(c));
                }
            }

            BorderStyle bs = this.BorderStyle;
            Unit        bu = this.BorderWidth;

            if (!bu.IsEmpty)
            {
                attributes.Add(HtmlTextWriterStyle.BorderWidth, bu.ToString(CultureInfo.InvariantCulture));
                if (bs == BorderStyle.NotSet)
                {
                    if (bu.Value != 0.0)
                    {
                        attributes.Add(HtmlTextWriterStyle.BorderStyle, "solid");
                    }
                }
                else
                {
                    attributes.Add(HtmlTextWriterStyle.BorderStyle, borderStyles[(int)bs]);
                }
            }
            else
            {
                if (bs != BorderStyle.NotSet)
                {
                    attributes.Add(HtmlTextWriterStyle.BorderStyle, borderStyles[(int)bs]);
                }
            }

            // need to call the property get in case we have font properties from view state and have not
            // created the font object
            FontInfo font = Font;

            // Font.Names
            string[] names = font.Names;
            if (names.Length > 0)
            {
                attributes.Add(HtmlTextWriterStyle.FontFamily, Style.FormatStringArray(names, ','));
            }

            // Font.Size
            FontUnit fu = font.Size;

            if (fu.IsEmpty == false)
            {
                attributes.Add(HtmlTextWriterStyle.FontSize, fu.ToString(CultureInfo.InvariantCulture));
            }

            // Font.Bold
            if (IsSet(PROP_FONT_BOLD))
            {
                if (font.Bold)
                {
                    attributes.Add(HtmlTextWriterStyle.FontWeight, "bold");
                }
                else
                {
                    attributes.Add(HtmlTextWriterStyle.FontWeight, "normal");
                }
            }

            // Font.Italic
            if (IsSet(PROP_FONT_ITALIC))
            {
                if (font.Italic == true)
                {
                    attributes.Add(HtmlTextWriterStyle.FontStyle, "italic");
                }
                else
                {
                    attributes.Add(HtmlTextWriterStyle.FontStyle, "normal");
                }
            }

            //
            string textDecoration = String.Empty;

            if (font.Underline)
            {
                textDecoration = "underline";
            }
            if (font.Overline)
            {
                textDecoration += " overline";
            }
            if (font.Strikeout)
            {
                textDecoration += " line-through";
            }
            if (textDecoration.Length > 0)
            {
                attributes.Add(HtmlTextWriterStyle.TextDecoration, textDecoration);
            }
            else
            {
                if (IsSet(PROP_FONT_UNDERLINE) || IsSet(PROP_FONT_OVERLINE) || IsSet(PROP_FONT_STRIKEOUT))
                {
                    attributes.Add(HtmlTextWriterStyle.TextDecoration, "none");
                }
            }

            Unit u;

            // Height
            if (IsSet(PROP_HEIGHT))
            {
                u = (Unit)viewState["Height"];
                if (!u.IsEmpty)
                {
                    attributes.Add(HtmlTextWriterStyle.Height, u.ToString(CultureInfo.InvariantCulture));
                }
            }

            // Width
            if (IsSet(PROP_WIDTH))
            {
                u = (Unit)viewState["Width"];
                if (!u.IsEmpty)
                {
                    attributes.Add(HtmlTextWriterStyle.Width, u.ToString(CultureInfo.InvariantCulture));
                }
            }
        }
예제 #30
0
        /// <devdoc>
        /// <para>Copies the font properties of another <see cref='System.Web.UI.WebControls.FontInfo'/> into this instance. </para>
        /// </devdoc>
        public void CopyFrom(FontInfo f)
        {
            if (f != null)
            {
                Style fOwner = f.Owner;
                if (fOwner.RegisteredCssClass.Length != 0)
                {
                    if (fOwner.IsSet(Style.PROP_FONT_NAMES))
                    {
                        ResetNames();
                    }
                    if (fOwner.IsSet(Style.PROP_FONT_SIZE) && (f.Size != FontUnit.Empty))
                    {
                        ResetFontSize();
                    }
                    if (fOwner.IsSet(Style.PROP_FONT_BOLD))
                    {
                        ResetBold();
                    }
                    if (fOwner.IsSet(Style.PROP_FONT_ITALIC))
                    {
                        ResetItalic();
                    }
                    if (fOwner.IsSet(Style.PROP_FONT_OVERLINE))
                    {
                        ResetOverline();
                    }
                    if (fOwner.IsSet(Style.PROP_FONT_STRIKEOUT))
                    {
                        ResetStrikeout();
                    }
                    if (fOwner.IsSet(Style.PROP_FONT_UNDERLINE))
                    {
                        ResetUnderline();
                    }
                }
                else
                {
                    if (fOwner.IsSet(Style.PROP_FONT_NAMES))
                    {
                        Names = f.Names;
                    }
                    if (fOwner.IsSet(Style.PROP_FONT_SIZE) && (f.Size != FontUnit.Empty))
                    {
                        Size = f.Size;
                    }

                    // Only carry through true boolean values. Otherwise merging and copying
                    // can do 3 different things for each property, but they are only persisted
                    // as 2 state values.
                    if (fOwner.IsSet(Style.PROP_FONT_BOLD))
                    {
                        Bold = f.Bold;
                    }
                    if (fOwner.IsSet(Style.PROP_FONT_ITALIC))
                    {
                        Italic = f.Italic;
                    }
                    if (fOwner.IsSet(Style.PROP_FONT_OVERLINE))
                    {
                        Overline = f.Overline;
                    }
                    if (fOwner.IsSet(Style.PROP_FONT_STRIKEOUT))
                    {
                        Strikeout = f.Strikeout;
                    }
                    if (fOwner.IsSet(Style.PROP_FONT_UNDERLINE))
                    {
                        Underline = f.Underline;
                    }
                }
            }
        }
예제 #31
0
		private static string TallPDFFontName(FontInfo f)
		{
			switch (f.Name.ToLower())
			{
				case "times new roman":
				case "times":
				case "timesroman":
					if (f.Bold)
						if (f.Italic)
							return "timesbolditalic";
						else
							return "timesbold";
					else
						if (f.Italic)
							return "timesitalic";
						else
							return "timesroman";

				case "arial":
				case "helv":
				case "helvetica":
				case "verdana":
				case "tahoma":
					if (f.Bold)
						if (f.Italic)
							return "helveticaboldoblique";
						else
							return "helveticabold";
					else
						if (f.Italic)
							return "helveticaoblique";
						else
							return "helvetica";

				case "courier":
				case "courier new":
					if (f.Bold)
						if (f.Italic)
							return "courierboldoblique";
						else
							return "courierbold";
					else
						if (f.Italic)
							return "courieroblique";
						else
							return "courier";

				default:
					throw new Exception("Font not supported");

			}
		}
예제 #32
0
        protected virtual void FillStyleAttributes(CssStyleCollection attributes, IUrlResolutionService urlResolver)
        {
            Color    color;
            Unit     unit3;
            StateBag viewState = this.ViewState;

            if (this.IsSet(4))
            {
                color = (Color)viewState["ForeColor"];
                if (!color.IsEmpty)
                {
                    attributes.Add(HtmlTextWriterStyle.Color, ColorTranslator.ToHtml(color));
                }
            }
            if (this.IsSet(8))
            {
                color = (Color)viewState["BackColor"];
                if (!color.IsEmpty)
                {
                    attributes.Add(HtmlTextWriterStyle.BackgroundColor, ColorTranslator.ToHtml(color));
                }
            }
            if (this.IsSet(0x10))
            {
                color = (Color)viewState["BorderColor"];
                if (!color.IsEmpty)
                {
                    attributes.Add(HtmlTextWriterStyle.BorderColor, ColorTranslator.ToHtml(color));
                }
            }
            System.Web.UI.WebControls.BorderStyle borderStyle = this.BorderStyle;
            Unit borderWidth = this.BorderWidth;

            if (!borderWidth.IsEmpty)
            {
                attributes.Add(HtmlTextWriterStyle.BorderWidth, borderWidth.ToString(CultureInfo.InvariantCulture));
                if (borderStyle == System.Web.UI.WebControls.BorderStyle.NotSet)
                {
                    if (borderWidth.Value != 0.0)
                    {
                        attributes.Add(HtmlTextWriterStyle.BorderStyle, "solid");
                    }
                }
                else
                {
                    attributes.Add(HtmlTextWriterStyle.BorderStyle, borderStyles[(int)borderStyle]);
                }
            }
            else if (borderStyle != System.Web.UI.WebControls.BorderStyle.NotSet)
            {
                attributes.Add(HtmlTextWriterStyle.BorderStyle, borderStyles[(int)borderStyle]);
            }
            FontInfo font = this.Font;

            string[] names = font.Names;
            if (names.Length > 0)
            {
                attributes.Add(HtmlTextWriterStyle.FontFamily, FormatStringArray(names, ','));
            }
            FontUnit size = font.Size;

            if (!size.IsEmpty)
            {
                attributes.Add(HtmlTextWriterStyle.FontSize, size.ToString(CultureInfo.InvariantCulture));
            }
            if (this.IsSet(0x800))
            {
                if (font.Bold)
                {
                    attributes.Add(HtmlTextWriterStyle.FontWeight, "bold");
                }
                else
                {
                    attributes.Add(HtmlTextWriterStyle.FontWeight, "normal");
                }
            }
            if (this.IsSet(0x1000))
            {
                if (font.Italic)
                {
                    attributes.Add(HtmlTextWriterStyle.FontStyle, "italic");
                }
                else
                {
                    attributes.Add(HtmlTextWriterStyle.FontStyle, "normal");
                }
            }
            string str = string.Empty;

            if (font.Underline)
            {
                str = "underline";
            }
            if (font.Overline)
            {
                str = str + " overline";
            }
            if (font.Strikeout)
            {
                str = str + " line-through";
            }
            if (str.Length > 0)
            {
                attributes.Add(HtmlTextWriterStyle.TextDecoration, str);
            }
            else if ((this.IsSet(0x2000) || this.IsSet(0x4000)) || this.IsSet(0x8000))
            {
                attributes.Add(HtmlTextWriterStyle.TextDecoration, "none");
            }
            if (this.IsSet(0x80))
            {
                unit3 = (Unit)viewState["Height"];
                if (!unit3.IsEmpty)
                {
                    attributes.Add(HtmlTextWriterStyle.Height, unit3.ToString(CultureInfo.InvariantCulture));
                }
            }
            if (this.IsSet(0x100))
            {
                unit3 = (Unit)viewState["Width"];
                if (!unit3.IsEmpty)
                {
                    attributes.Add(HtmlTextWriterStyle.Width, unit3.ToString(CultureInfo.InvariantCulture));
                }
            }
        }