I've had a problem where making the font weight of some text Bold made it smaller than the Normal font weighted text. I've worked out that this is because I've got the TextFormattingMode set to "Display"; the problem doesn't occur if the TextFormattingMode is set to "Ideal".
For example, the following code:
<Label FontFamily="Calibri" FontSize="12" FontWeight="Bold" Content="This is some test text" TextOptions.TextFormattingMode="Ideal"/>
<Label FontFamily="Calibri" FontSize="12" Content="This is some test text" TextOptions.TextFormattingMode="Ideal"/>
<Label></Label>
<Label FontFamily="Calibri" FontSize="12" FontWeight="Bold" Content="This is some test text" TextOptions.TextFormattingMode="Display"/>
<Label FontFamily="Calibri" FontSize="12" Content="This is some test text" TextOptions.TextFormattingMode="Display"/>
Produces the following:
If I up the font size to about 14 for the last two labels the bold text becomes larger than the normal weighted text.
My question is: is there a setting I can use to have 12 point bold text with the TextFormattingMode set to "Display" that is the same size / slightly larger than than the normal weighted text?
The problem is not that the bold text is too short, it is that the normal text is too long.
There's history behind this, WPF originally shipped at .NET 3.0 supporting only the "Ideal" mode for scaling text. This mode supports true resolution independent text scaling, a line of text will have a predictable length in inches on various display devices with different dots-per-inch resolution. This was not received well, it caused massive complaints from WPF programmers that didn't like the blurry text that this produces. This is visible in your screen-shot. Note how the left stem of the bold letter m is too fat in Ideal mode but not in Display mode.
At .NET 4.0, the WPF team supported a new way to render text, called "Display". Which renders text the way GDI does it, applying font hinting rules to tweak the letter shape so it coincides better with the pixel grid of the monitor. This tends to stretch the letters, especially when their stem only has a single pixel. The smaller the point size, the more pronounced this becomes. The text is highly readable because of it, but true resolution independent rendering is lost.
Winforms also went through a similar evolution, from Graphics.DrawString() to TextRenderer.DrawText().
This blog post from the WPF team has the details.
The answer to your question is thus No.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With