Juce Font size doesn't match the system

In the Juce Demo when I select a font and size (for example, 12 point Lucida Console), the resulting output is quite different from what I get if I specify the same font and size in another application (for example, LibreOffice Writer or the Fonts control panel applet). This image shows the difference. The top is Visual Studio, the bottom is Juce. Both are Lucida Console 12:

[attachment=0]JuceFontHeightBug.png[/attachment]

The Juce Font system has never sized its fonts based on point height. It has always sized its fonts based on “the height in pixels (can be fractional)” as a float.

Is there a simple formula for conversion?

font size in pixels = font size in points * dpi / 72

Whats the proper value for DPI to match what Windows displays then?

“Most Windows systems are shipped with the display DPI set to 96 PPI.”
http://blogs.msdn.com/b/fontblog/archive/2005/11/08/490490.aspx

Having just been playing around with a high-DPI android phone, I can see that display DPI is something I’ll need to address pretty soon. It has been pretty easy up until now to just think in terms of pixels, but those days are coming to an end!

At long last. Finally font hinting can die!

Microsoft mentioned a 291 dpi 10.1" 2560x1440 display when talking about Windows 8. Want.
http://blogs.msdn.com/b/b8/archive/2012/03/21/scaling-to-different-screens.aspx

One thing that would be useful is a display DPI/PPI query function.

1 Like