Your code doesn't show exactly how you are writing the XML, but this will get you a string with a compete Font description including Style, and you can also convert to a Font from such a description:
using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
private TypeConverter fontConverter = TypeDescriptor.GetConverter(typeof(Font));
private string fontToFontDescription(Font font)
{
return fontConverter.ConvertToString(font);
}
private Font fontDescriptionToFont(string fdescription)
{
return fontConverter.ConvertFromString(fdescription) as Font;
}
Interestingly, if you do this test:
string fstr = fontToFontDescription(textBox1.Font);
Font fnt = fontDescriptionToFont(fstr);
bool eq = fnt.Equals(textBox1.Font);
The result is 'false: the return value of the conversion has 'GdiCharSet: 1; the font in the TextBox has GdiCharSet: 0. On a practical level, you can go ahead and use the result of the conversion with results you'd expect.
Will using the Font converted to string in this way solve your problem ?