Sign in to follow this  
mameman

Font Scaling

Recommended Posts

mameman    100
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
Evil Steve    2017
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
mameman    100
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
Anon Mike    1098
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this