Here’s the answer:
private void setFont(string fontFamily, int fontSize)
{
foreach (Property prop in _applicationObject.Properties["FontsAndColors", "TextEditor"])
{
if (prop.Name == "FontFamily")
prop.Value = fontFamily;
else if (prop.Name == "FontSize")
prop.Value = fontSize;
}
}
_applicationObject
is assumed to contain the DTE2
object for the host environment.