Setting FontWeight to Bold shrinks text size

wpf, xaml

Solution

After a bit of investigation following on from Mark Hall and Sayed Saad's comments I managed to work out what was causing this: TextOptions.TextFormattingMode = Display.

As Mark pointed out, the bold font text does get bigger than the normal font text when you up the font size. However, if I changed the TextFormattingMode to "Ideal" then the bold font is bigger than the normal font irrespective of the font size.

EDIT: Based on my findings here I posted another question, the answer to this can be found here: TextOptions.TextFormattingMode affecting text with bold font weight

Problem

I've been setting up a resource dictionary to style all the controls in my WPF application and I've discovered some odd behaviour when setting the font weight for a label. I have to styles set up for labels, the first with normal font weight : ``` <Style x:Key="Label" TargetType="{x:Type Label}"> <Setter Property="VerticalAlignment" Value="Center"/> <Setter Property="Margin" Value="10,0"/> </Style> ``` and the second set to bold : ``` <Style x:Key="LabelBold" TargetType="{x:Type Label}"> <Setter Property="VerticalAlignment" Value="Center"/> <Setter Property="Margin" Value="10,0"/> <Setter Property="FontWeight" Value="Bold"/> </Style> ``` The trouble is that when I use the bold weighted font, the text shrinks (or the text spacing) : I've searched about but I can't seem to see any reason for this, if anything I'd expect the text to expand because of the letter thickness increasing. Is this meant to happen and if so is there a way around it? EDIT : The window is using the following fonts: ``` <Setter Property="TextOptions.TextFormattingMode" Value="Display"/> <Setter Property="FontFamily" Value="Calibri"/> <Setter Property="FontSize" Value="12"/> ```

Original source

Related problems