I'm using FreeType to handle TrueType fonts in my game project. Text is rendering to the screen, but am at a loss for how to properly scale the font based on resolution changes to my app. Not knowing much about DPI, point sizes, et al., I'm at a loss for how to scale the text properly. When setting FreeType to use Arial at 12 points at 72 DPI, when my game is at 800x600, it looks about how it does in Photoshop, at least height-wise. If I run the game in 1024x768, it's obviously going to use the same pixel-size, so it looks too small.
I tried scaling it by doing the following, but this doesn't feel correct, particularly at 1600x1200, the text looks too big:
float fNewDPI = viewport.height / 600; // Text looks about right in 800x600
I'd like to take the following into account:
- The window can be resized to any reasonable resolution. My GUI scales accordingly.
- The game supports wide-screen (so the scale value should probably not take into account window width?)
- The font stays proportional in size between resolutions.