I've been implementing a custom HUD in ZScript and noticed a discrepancy between how monospaced strings are drawn in HUDFONT_DOOM (aka DoomStatusBar.mHUDFont) and SMALLFONT. I'm creating a HUDFont instance for SMALLFONT in the same way mHUDFont is initialized in DoomStatusBar:
Code: Select all
Font fnt = "SMALLFONT";
mHUDFont = HUDFont.Create(fnt, fnt.GetCharWidth("0"), true, 1, 1);
To confirm this, I wrote some debugging code which draws colored rectangles under my strings. The height of these rectangles is calculated by calling GetHeight on the corresponding font, while the width is calculated by multiplying the character width by the number of characters. Here is an example with all digits from HUDFONT_DOOM and SMALLFONT. It is very easy to see that the big "1" is centered in its box, while the small "1" is hugging the left side of it.
(disregard the red rectangles, the green ones are the ones you need)
The question is: is it possible to change this behavior for SMALLFONT? SBARINFO seems to center characters, so I think it should be possible, but due to the lack of comprehensive documenation, I haven't found out how to do it. Maybe one of the developers could answer?
Also, please note that I do want monospacing to align all the digits perfectly above each other (as on the first picture), so not using it is out of the question.