Q: The mordern way to set text size on HUD?

Discussions about Coding and Scripting
Posts: 72
Joined: Tue Jan 12, 2021 9:18 pm

Q: The mordern way to set text size on HUD?

Post by Dennis »

I was just wondering if any of you who works with HUD setup deal with the text size? I use the classic: Canvas.Font = MyFonts.GetSmallFont( Canvas.ClipX ); followed by: Canvas.StrLen(PRI.Health, XL, YL);

Here the X and Y size is deriving from engines algorithm using the ClipX value. This works fine for me as I play in 1920x1080 resolution, but two of my players are playing using 4k resolution and they complain about the text size beeing very small and almost unreadable for them. I can only test relolutions up to my monitors limit so - any of you deal with this issue and have some words of advise?
Fraggers hangout place: http://fraggers.online/
Posts: 177
Joined: Sat Nov 30, 2019 10:56 pm

Re: Q: The mordern way to set text size on HUD?

Post by Eternity »

HUD scaling in UT in general, not only font scaling, is working wrong way in combination with modern screen resolutions and aspect ratios.
Development of such projects usually is going on in an ASAP mode, in times it was being developed over than 20 years ago such tasks as support for future (+10..+20 years) high resolutions, wide and ultra-wide screens was probably not even considered to be included into to-do lists.

This is script example used by GetSmallFont() function:

Code: Select all

    if (Width < 640)
        return Font'SmallFont';
    else if (Width < 800)
        return Font(DynamicLoadObject("LadderFonts.UTLadder10", class'Font'));
    else if (Width < 1024)
        return Font(DynamicLoadObject("LadderFonts.UTLadder14", class'Font'));
        return Font(DynamicLoadObject("LadderFonts.UTLadder16", class'Font'));
This means, for screen widths starting from 1024 to any higher widths, the same font size will be used. Of course, higher screen resolution is, smaller this font will look like on the screen.

Another example is about using X-axis as a scale base, that makes HUD objects to look abnormally huge on wide screen formats... Users of wide screens, for example, usually complain HUD icons and first-person weapon take too many place on the screen.

Since way too many mods out there have inherited these scaling problems, no universal solution for these problems exists...
As a workaround v469 client offers a GUI scaling and a Font scaling settings, so that users have opportunity to tune it up for their screens if necessary.

Mods might be free of any scaling problems by introducing custom scaling code, considering existing screen resolutions and aspect ratios...