Open digital-ember opened 2 months ago
Another observation: the measured width for my non-bold test string aligns with the bold ones
I verified that by changing the measured width calculation to use the current (font size + 1).
Noticably, this is not true for space characters. Only visible characters' seem to have this effect, which means each space in the test string causes the measued widths to be one off by 1.
Note that the actual test string is still shown shorter cause it uses the same font size, only the calculation for the width uses a (font-size +1)
Using (font-size+1) also to render the property in the plain style shows that it is actually the same width without whitespaces:
In fact, using a font < 16.0 does not show the original issue I reported here at all!
My guess is that for non-Regular font MPS uses "fake bold", i.e. artificially stretch and bolden original font instead of using special Bold version.
Probably because it tries to find non-existent JenBrains Mono Medium Bold
font.
Does this idea of "fake bold" make sense given my observations, i.e. that the effect differs with different font-sizes as shown above?
Can you try the MPS 24.1 EAP? I downloaded your project and cannot reproduce the issue in the latest MPS.
I downloaded MPS 24.1 EAP (generic distribution) and put it on a clean Windows 11 sandbox. When I open my font weight issue, it is still reproducable.
Are you sure you tested under Windows and changed the font size to 16 or above in the settings?
I originally reported this in the unofficial MPS Slack: https://jetbrains-mps.slack.com/archives/C3YUV3YK0/p1713368543862319
When I use the font "JetBrains Mono" with a weight that is not "Regular", the font gets wider in case of using the style "bold" or "boldItalic".
I created a simple, self-contained example with MPS 2023.3 that I attached here called FontWeightIssue. In the sandbox model, there are two editor lines for the same "name" property. You can set the font for both at the top of the editor and the style for each line individually. It will also show you the measured width next to the name:
FontWeightIssue.zip