Tutorial: Changing the in-game font size Last edited 4 months ago2024-07-22 15:32:03 UTC

GoldSource utilizes several ways to draw the text on the screen in-game. Aside VGUI there are two options: By default the fonts are quite small for the modern screen sizes. So let's enlarge them for your mod.

Note: the credits text size has been adjusted appropriately in the anniversary update. Still this article describes how to edit the font sizes in general and how to achieve better results on steam_legacy version if you're willing to support it.

Custom TrackerScheme.res

Go to your Half-Life folder and copy platform/resource/TrackerScheme.res (steam_legacy version) or valve/resource/TrackerScheme.res (anniversary version) file to the <your-mod>/resource directory (replacing <your-mod> with your mod directory). Open the file in any text editor. The format of TrackerScheme.res is quite simple - named sections with subsections between { and } characters.

Changing the font of chat text

Find the "EngineFont" section - it describes the font used for non-transparent texts. Here you can see several numbered entries like this:
"1"
{
    "name"        "Verdana"
    "tall"        "12"
    "weight"    "600"
    "yres"    "480 599"
    "dropshadow"    "1"
}
"2"
{
    "name"        "Verdana"
    "tall"        "13"
    "weight"    "600"
    "yres"    "600 767"
    "dropshadow"    "1"
}
"3"
{
    "name"        "Verdana"
    "tall"        "14"
    "weight"    "600"
    "yres"    "768 1023"
    "dropshadow"    "1"
}
"4"
{
    "name"        "Verdana"
    "tall"        "20"
    "weight"    "600"
    "yres"    "1024 1199"
    "dropshadow"    "1"
}
The "yres" property tells the min and max height resolution the specified font will be used for. E.g. if you have a 1920x1080 screen and run Half-Life in fullscreen mode, the section 4 will be used because 1080 is in the [1024, 1199] boundaries. The "tall" property defines the font size. Increase the number, start the game and type in chat. Change the size accordingly for all resolutions. You can also change the font type by changing the "name" entry. For example, change "Verdana" to "Trebuchet".

It's possible to add new sections with different different "yres" boundaries - just keep the numbers for more entries in order (add "5", "6", "7", etc.)

Changing the font of credits and chapters

Additive text font is controlled by "Legacy_CreditsFont" section (on steam_legacy branch) and by "CreditsFont" (on the anniversary branch).

If you took the TrackerScheme.res from valve/resource of the anniversary version, the "CreditsFont" already defines appropriate font sizes for different resolutions. Just edit "tall" values if you wish. To allow resolution dependent font sizes in the steam_legacy version you'll need to edit the "Legacy_CreditsFont".

Note: you can keep "Legacy_CreditsFont" and "CreditsFont" in sync in order to support both steam_legacy and anniversary versions.

The format is the same as for "EngineFont", but the "Legacy_CreditsFont" defines only one entry by default thus making the text have the same size on all resolutions (on steam_legacy branch). This is not good! Let's put more entries and adjust sizes for different resolutions. Example:
"1"
{
    "name"        "Trebuchet MS"
    "tall"        "20"
    "weight"    "700"
    "antialias"    "1"
    "yres"    "1 767"
}
"2"
{
    "name"        "Trebuchet MS"
    "tall"        "22"
    "weight"    "700"
    "antialias"    "1"
    "yres"    "768 1023"
}
"3"
{
    "name"        "Trebuchet MS"
    "tall"        "30"
    "weight"    "700"
    "antialias"    "1"
    "yres"    "1024 1199"
}
"4"
{
    "name"        "Trebuchet MS"
    "tall"        "36"
    "weight"    "700"
    "antialias"    "1"
    "yres"    "1200 1439"
}
"5"
{
    "name"        "Trebuchet MS"
    "tall"        "48"
    "weight"    "700"
    "antialias"    "1"
    "yres"    "1440 2559"
}
"6"
{
    "name"        "Trebuchet MS"
    "tall"        "60"
    "weight"    "700"
    "antialias"    "1"
    "yres"    "2560 6000"
}
Now start the game and load some map that shows a chapter title or credits (e.g. c1a0) and see the nice font size appropriate for your resolution.

Screenshots

These are taken on 1920x1080 resolution with font sizes exaggerated for demonstration purposes.
User posted image
User posted image

1 Comment

Commented 3 months ago2024-09-09 06:29:29 UTC Comment #106378
TODO:
  1. Custom fonts
  2. Console fonts

You must log in to post a comment. You can login or register a new account.