Vague72 Posted May 3, 2020 Share Posted May 3, 2020 Hi, I am trying to fit a custom font to all screen resolutions. For example: local coolvetica = guiCreateFont("fonts/coolvetica.ttf", 25) This font would look normal to 1920x1080 but it would look bigger in lower resolution, so I want to lower the size depending on the resolution. So far I tried this: local sx_, sy_ = guiGetScreenSize() local coolvetica = guiCreateFont("fonts/coolvetica.ttf", 25*(sy_/1080)) but it still does not look normal in other resolutions. Cheers. Link to comment
Moderators Patrick Posted May 3, 2020 Moderators Share Posted May 3, 2020 You need to scale the font size in dxDrawText. guiCreateFont's size is an Integer, so if the scaled value is 20.9, its rounded to 20. 1 Link to comment
Vague72 Posted May 3, 2020 Author Share Posted May 3, 2020 1 hour ago, Patrick said: You need to scale the font size in dxDrawText. guiCreateFont's size is an Integer, so if the scaled value is 20.9, its rounded to 20. Oh! Thank you, I wouldn't really mind 5-10% wrong scalling. So, this is supposed to be correct right?; local sx_, sy_ = guiGetScreenSize() local coolvetica = guiCreateFont("fonts/coolvetica.ttf", 25*(sy_/1080)) Link to comment
Moderators Patrick Posted May 3, 2020 Moderators Share Posted May 3, 2020 (edited) 3 minutes ago, Vague72 said: So, this is supposed to be correct right? Yes, the math is right. You need to multiply X-size with SCREEN_X / 1920 and Y-size with SCREEN_Y / 1080 Edited May 3, 2020 by Patrick 1 Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now