private Font LoadFont(string description) { string font = GetPropertyValue("Font", description); if (!String.IsNullOrEmpty(font)) { int start = font.IndexOf("("); int comma = font.IndexOf(",", start); int secondComma = font.IndexOf(",", comma + 1); string fontFamily = font.Substring(start + 2, comma - start - 3); float fontSize = 10.0f; if (secondComma > -1) { string str = font.Substring(comma + 2, secondComma - comma - 2); fontSize = UnitsConverter.SizeFToPixelsFont(font.Substring(comma + 2, secondComma - comma - 2)); FontStyle fontStyle = FontStyle.Regular; if (font.Contains("Bold")) { fontStyle |= FontStyle.Bold; } if (font.Contains("Italic")) { fontStyle |= FontStyle.Italic; } if (font.Contains("Underline")) { fontStyle |= FontStyle.Underline; } if (font.Contains("Strikeout")) { fontStyle |= FontStyle.Strikeout; } return(new Font(fontFamily, fontSize, fontStyle)); } else { string str = font.Substring(comma + 2, font.IndexOf(")") - comma - 2); fontSize = UnitsConverter.SizeFToPixelsFont(font.Substring(comma + 2, font.IndexOf(")") - comma - 2)); } } return(new Font("Arial", 10.0f, FontStyle.Regular)); }