To add own font to the game

Dune 2000

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

To add own font to the game

Post by Adrian »

Is it possible to add own font to the game?

I would like to make font more narrow and bigger. In Mission description.
Nearly as in old Dune, like this:

Image

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

Re: To add own font to the game

Post by abcdefg30 »

Fonts are referenced in the "Fonts:" section of "mod.yaml", so you can add a font there. You probably want to replace the existing fonts with your own font files. (Otherwise you then need to change the relevant "Font: <font name>" entries in the .yaml files inside the "chrome" directory. Which is doable but requires some more work.)

Adrian
Posts: 135
Joined: Wed Feb 12, 2020 5:44 pm

Re: To add own font to the game

Post by Adrian »

Thank you very much!
It works. I want to do it more than a year :-)

Now I am still trying to understand about color of font.

Adrian
Posts: 135
Joined: Wed Feb 12, 2020 5:44 pm

Re: To add own font to the game

Post by Adrian »

I would like to return here.
Some time ago (after discussion here) I made "Mission description".
First in bright yellow color.

Image

Later — in dark yellow color. It looks closer to old Dune.
(But bright yellow color is more readable)

Image

And just for information
(for myself too; another reserve copy):

color of font

tag TextColor in ... mods/d2k/chrome/missionbrowser.yaml

For example, bright yellow color
TextColor: EEE480
Last edited by Adrian on Thu Nov 14, 2024 6:54 pm, edited 1 time in total.

Adrian
Posts: 135
Joined: Wed Feb 12, 2020 5:44 pm

Re: To add own font to the game

Post by Adrian »

And more complex question.
I would like to make caption (message output) in old Dune style. On the top of screen.
Like this. Big narrow red characters.

It looks like it needs compile cs files. I suppose I can.

Image

Adrian
Posts: 135
Joined: Wed Feb 12, 2020 5:44 pm

Re: To add own font to the game

Post by Adrian »

Big narrow red characters.
I made it!
More details later, maybe.

The pictures below are cropped. So caption "Sietch structural integrity" is in the center in reality.
My caption is in the top left corner, as in old Dune2000.

More pixelated font:

Image

More smooth and readable font.
Which is better?
Image

Adrian
Posts: 135
Joined: Wed Feb 12, 2020 5:44 pm

Re: To add own font to the game

Post by Adrian »

More details later, maybe.
This is slightly changed function SetMissionText().

UserInterface.SetMissionText() in lua.


I create another label (in the file ingame.yaml) with coordinates at top left corner.
Something like
Label@MOJ_TEXT (according to sample Label@MISSION_TEXT)

Then, in cs-file, I create new function SetMyText().

I use label there:
<LabelWidget>("MOJ_TEXT")

and make red color by default.

var c = color ?? Color.Red;

So, I can use the function in lua files now, for my messages.

Like this (red text, by default):
UserInterface.SetMyText("Fremen base detected to the Southeast")

Or green text, for example:
UserInterface.SetMyText("Fremen base detected to the Southeast", HSLColor.Green)

If somebody needs more details, I can write it.
When I will be next time in forum.

Post Reply