DisplayMessage(). Font style and size.

Dune2000, Dune 2000, d2k

Information and discussion for custom maps and mods.
Post Reply
Adrian
Posts: 135
Joined: Wed Feb 12, 2020 5:44 pm

DisplayMessage(). Font style and size.

Post by Adrian »

First question.

I hope the developers don't mind that I study the source code of the game? in cs-files?

Is it normally to discuss source code here? May I?

---------

And about the function DisplayMessage().

I remember, that I tried to change the function several years ago.

These messages look not easy!
But despite this I found where is font of DisplayMessage().
It was in 2020 (and in the earlier versions of Dune).

Here:
(Dune folder)/OpenRA.Mods.Common/Widgets/ChatDisplayWidget.cs

And NOW! It looks even more difficult.
Quite another code and files!

It looks like the font is one for all messages.

Here? Right?
(Dune folder)/mods/common/metrics.yaml

TextFont: Regular

I am trying to understand, where I can create individual font
(or use existing font) for DisplayMessage().

I don't want to write much. Тhat's enough for now...
(Of course, I can add details in next messages, if it needed)
And I'm hoping for some kind of answer. :-)

abcdefg30
Posts: 664
Joined: Mon Aug 18, 2014 6:00 pm

Re: DisplayMessage(). Font style and size.

Post by abcdefg30 »

Adrian wrote:
Tue Nov 26, 2024 6:37 pm
I hope the developers don't mind that I study the source code of the game? in cs-files?

Is it normally to discuss source code here? May I?
No it's not a problem at all, the project is Open Source after all. :D

You can add fonts by adding them to the "Fonts:" section in "mod.yaml". Dune 2000 has the following fonts:

Code: Select all

Fonts:
	Tiny:
		Font: common|FreeSans.ttf
		Size: 10
		Ascender: 8
	TinyBold:
		Font: common|FreeSansBold.ttf
		Size: 10
		Ascender: 8
	Small:
		Font: common|FreeSans.ttf
		Size: 12
		Ascender: 9
	Regular:
		Font: common|FreeSans.ttf
		Size: 14
		Ascender: 11
	Bold:
		Font: common|FreeSansBold.ttf
		Size: 14
		Ascender: 11
	MediumBold:
		Font: common|FreeSansBold.ttf
		Size: 18
		Ascender: 14
	BigBold:
		Font: common|FreeSansBold.ttf
		Size: 24
		Ascender: 18
	Title:
		Font: d2k|Dune2k.ttf
		Size: 32
		Ascender: 23
Note that any changes to this will only affect your client, not other players!

Post Reply