} //HtmlFontProperty // constructor given a system Font 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
} //FontSizeFromHtml // Used to determine the HtmlFontSize from a style attribute 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
} //FontSizeToHtml // determine the font size given the html font size public static float FontSizeFromHtml(HtmlFontSize fontSize) { return(HtmlFontConversion.FontSizeFromHtml((int)fontSize)); } //FontSizeFromHtml