Esempio n. 1
0
        } //HtmlFontProperty

        /// <summary>
        /// Public constructor given a system Font
        /// </summary>
        public HtmlFontProperty(System.Drawing.Font font)
        {
            _name        = font.Name;
            _size        = HtmlFontConversion.FontSizeToHtml(font.SizeInPoints);
            _bold        = font.Bold;
            _italic      = font.Italic;
            _underline   = font.Underline;
            _strikeout   = font.Strikeout;
            _subscript   = false;
            _superscript = false;
        } //HtmlFontProperty
Esempio n. 2
0
        } //FontSizeFromHtml

        /// <summary>
        /// Determines the HtmlFontSize from a style attribute
        /// </summary>
        public static HtmlFontSize StyleSizeToHtml(string sizeDesc)
        {
            // currently assume the value is a fixed point
            // should take into account relative and absolute values
            float size;

            try
            {
                size = Single.Parse(Regex.Replace(sizeDesc, @"[^\d|\.]", ""));
            }
            catch (Exception)
            {
                // set size to zero to return HtmlFontSize.Default
                size = 0;
            }

            // return value as a HtmlFontSize
            return(HtmlFontConversion.FontSizeToHtml(size));
        } //StyleSizeToHtml