I want to set a font weight, not just Bold weight, for some text classification in visual studio (VS) extension. I tried to achieve it using TextFormattingRunProperties.SetTypeFace
in the code below:
...
var formatting = classificationFormatMap.GetExplicitTextProperties(classificationType);
// newTypeFace is a one of System fonts with non Normal weight, which was received before
formatting = formatting.SetTypeface(newTypeFace);
classificationFormatMap.SetExplicitTextProperties(classificationType, formatting);
I tried to set Arial [Bold|Extra Bold], Bahnschrift [Bold|Semi Bold] and Consolas Bold as newTypeFace
(all this fonts are exist), but unfortunately, their weight didn't affect the VS text editor window. However,
the font families and styles, (I'm not sure I tried to set non regular stretch) affected text editor.
Of course, TextFormattingRunProperties.SetBold(true)
works well, but I need to have a way to set the other font weights, not just Bold, so this approach doesn't solve the issue.
Has anyone idea why SetTypeFace
with weight doesn't work and how to set font weight? Did I miss something?