Juce font size in point doesn't match the system font size. (Win)

Hello guys,

I wondered if any of you experienced this problem on Win : Juce font size (in points, NOT in pixels) doesn’t match the system font size.
I just ran the demo application and tried to load the notepad font with the same size and it appears different.
Height seems to be in points, because it calls withPointHeight(), l241 in FontsDemo.h and if I replace by withHeight() it’s even smaller.
Did I missed something please ?
Thanks ! :slight_smile:

Font size in Windows does not equal font height.

Ok, any tips to do the conversion please ? Thanks !

So, if your screen is 96dpi you can use such calculation:

height in pixels = size / 72dpi * 96dpi

To match your fonts: for size=11 in Notepad, you should set height=14,66 in DemoRunner. Of course when you have got screen scaling turned on, you should take it into account.

But the DemoRunner use withPointHeight() to set the height, which means the height is already in points, then no need to convert it from a pixel unit.

So that’s strange. Maybe I am missing something but have to check it on Windows.

I checked your image and it appears from the image that the font is exactly 11 pixels, so that suggests getHeightToPointsFactor() is returning 1. probably best to attach the debugger to figure out what’s going on.

Thanks,
Actually getHeightToPointsFactor() returns 0.854045033, which isn’t 72/96=075
It also appears getHeightToPointsFactor() is dependant from the typeface used, it doesn’t return the same ratio with the different typefaces I tested, so the conversion might be more complex than a fixed ratio.

The line advance in the image is 13 pixels, which is approximately 11 / 0.854045033.

I understood from a comment by Jules that getHeightInPoints() and getHeight() return not only different units, but also a different metric.