Ejemplo 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
Ejemplo n.º 2
0
        } //HtmlFontProperty

        /// <summary>
        /// Public constructor for name and size only
        /// </summary>
        public HtmlFontProperty(string name, float ems)
        {
            _name        = name;
            _sizeInEms   = ems;
            _size        = HtmlFontConversion.EmsToHtml(ems);
            _bold        = false;
            _italic      = false;
            _underline   = false;
            _strikeout   = false;
            _subscript   = false;
            _superscript = false;
        } //HtmlFontProperty
Ejemplo n.º 3
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.PointsToHtml(size));
        } //StyleSizeToHtml
Ejemplo n.º 4
0
 /// <summary>
 /// Determines the font size given the html font size
 /// </summary>
 public static float PointsFromHtml(HtmlFontSize fontSize)
 {
     return(HtmlFontConversion.PointsFromHtml((int)fontSize));
 } //FontSizeFromHtml