• Advertisement
Sign in to follow this  

Font Scaling

This topic is 3945 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi ALL, I have an application that I want to work at different resolutions. Now my problem is that when I switch to a higher resolution e.g. 640x480 to 1024x768 the font looks "really" small. The reason for this of course is that because the screen is "bigger" and the font is the same size it takes up less area. My question is: is there a standardized way of scaling fonts so that the text that is output it will take up the same area of the screen regardless of the resolution?. Any suggestions/thoughts appreciated, MAMEman.

Share this post


Link to post
Share on other sites
Advertisement
It really depends on what graphics library you're using (SDL, D3D, OpenGL, etc).

Most games don't scale the text because it can look fuzzy when scaled up or down - they'll just use the same sized text (which looks smaller), which means the game interface feels more open and spacious, which is a good thing.

Share this post


Link to post
Share on other sites
Sorry probably didn't give enough infos. I'm working in OpenGL with TrueType fonts (texture based). My interest is in scaling the POINTSIZE of the font. For example in 640x480 the pointsize of the font is 150, now if the resolution is changed to 1024x768, what scaling factor do I need to apply in order to make the text look the same i.e. take up the same amount of screen space as it did in 640x480?.

Hope this clears it up.

MAMEman.

Share this post


Link to post
Share on other sites
height = height@480 * screen_y / 480;

So if your font is 150 units high at a vertical resolution of 480, then at 768 you get 150*768/480=240.

You can apply a similiar formula for horizontal scaling but scaling fonts horizontally (as opposed to letting them be thier natural width for whatever height you're using) can give poor results.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement