Incorrect spacing in statusbar DrawString with scale?

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!)

Incorrect spacing in statusbar DrawString with scale?

Postby Jekyll Grim Payne » Wed Oct 27, 2021 3:31 am

I'm doing this:
Code: Select allExpand view
mNotifFont = HUDFont.Create(times);

DrawString(mNotifFont, String.Format("New Codex entry: %s", invcontrol.latestPickupName), (0,0), DI_SCREEN_RIGHT_TOP | DI_TEXT_ALIGN_RIGHT);


I'm getting this—obviously, it's too large but otherwise looks okay. Although for some reason it's monospaced, even though the monospaced argument of HUDFont.Create is false by default.


Now I want to scale the string down:
Code: Select allExpand view
DrawString(mNotifFont, String.Format("New Codex entry: %s", invcontrol.latestPickupName), (0,0), DI_SCREEN_RIGHT_TOP | DI_TEXT_ALIGN_RIGHT, scale: (0.25, 0.25));


And this is what I get:


The gap between words is huge.
The position is screwed up and the right part of the string ends up beyond the screen.

What the heck am I missing here?
User avatar
Jekyll Grim Payne
 
Joined: 21 Jul 2008
Discord: Agent_Ash#4401
Github ID: jekyllgrim
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia (Modern GZDoom)

Re: Incorrect spacing in statusbar DrawString with scale?

Postby Jekyll Grim Payne » Wed Oct 27, 2021 6:23 am

Nevermind, seems it's a reported bug: viewtopic.php?f=2&t=73669
User avatar
Jekyll Grim Payne
 
Joined: 21 Jul 2008
Discord: Agent_Ash#4401
Github ID: jekyllgrim
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia (Modern GZDoom)

Re: Incorrect spacing in statusbar DrawString with scale?

Postby Player701 » Tue Nov 23, 2021 7:38 am

I've implemented a fix (see the linked thread); If possible, please send me a runnable example so that I can verify it looks correctly now before I submit the PR.
User avatar
Player701
 
 
 
Joined: 13 May 2009
Location: Russia
Discord: Player701#8214
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia with Vulkan support


Return to Scripting

Who is online

Users browsing this forum: No registered users and 2 guests