What is the best way to use fonts and scale them?

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!

Moderator: GZDoom Developers

Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.

Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
Post Reply
Kovnikel
Posts: 7
Joined: Sun Aug 17, 2025 7:10 am

What is the best way to use fonts and scale them?

Post by Kovnikel »

Hi I would like to use custom font in the game/mod I am making but not sure of the best way to scale them. I have BIGFONT (as DBIGFONT.fon2 in my pk3), which displays ok on the menu but I would like to scale it larger when using it for a hudmessage. What is the best way to achieve this? thanks.
User avatar
Enjay
 
 
Posts: 27057
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Re: What is the best way to use fonts and scale them?

Post by Enjay »

If you want to make a font bigger without actually making a bigger/hi-res version of the font, the usual way would be to use SetHudSize.

With that, you can tell GZDoom to treat the screen as being whatever size you want. I typically use 640x480 which makes the fonts a good size for me. So, even if your screen is a super-big 8K monitor with very high resolution settings, the message will be scaled up to look like it would if the character had been printed on a smaller screen (640x480 in my case). It also has the advantage that your message should look similar on monitors of different sizes, rather than being big on low-res screens and tiny on high res screens.

The only thing to watch is that the coordinates for HudMessage behave differently when you have used SetHudSize, but it's all explained on the HudMessage page.
Kovnikel
Posts: 7
Joined: Sun Aug 17, 2025 7:10 am

Re: What is the best way to use fonts and scale them?

Post by Kovnikel »

Thanks. Unfortunately I already am using SetHudSize and wanted to change the font size relative to that, I thought may be possible without making duplicates of the font at different sizes.

I'm trying to use one of the Jimmyfonts viewtopic.php?t=33409 which are provided in fon2 and pcx format. I increased the width and height of the pcx in gimp, checking the border is 255 on color map it though imagetool and it gives the error "fontname.lmp has glyphs out of range". Is it because the border is now 2x2 pixel instead of 1x1? any tips/help appreciated how to increase this font size thanks.
User avatar
Enjay
 
 
Posts: 27057
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Re: What is the best way to use fonts and scale them?

Post by Enjay »

It's a long time since I made a made a font but, yes, I think the border needs to only be 1 pixel wide. 2 pixels, from memory, effectively counts as a non-visible character. So, every 2 pixel-wide border is adding a character between the ones you actually have graphics for and is messing up the whole character order. Certainly, the error that you quoted is one I would see when I messed up the borders.
Post Reply

Return to “Scripting”