Valheim-Modding / Jotunn

Jötunn, the Valheim Library.
https://valheim-modding.github.io/Jotunn/
MIT License
126 stars 40 forks source link

Add some fonts and colours #391

Closed SpikeHimself closed 1 year ago

SpikeHimself commented 1 year ago

I wasn't sure how you'd like the font check to work going forward. Currently it checks for all existing (two) fonts:

if (AveriaSerifBold == null || AveriaSerif == null)
{

It seems to me that this is enough to determine whether or not font loading has worked, and since it throws an exception I don't think it's necessary to add checks for other fonts.

Hence I have loaded "my" fonts after the exception - at this point the first two fonts loaded fine, so we should be in the clear (right?)

    throw new Exception("Fonts not found");
}    
Norse = fonts.FirstOrDefault(x => x.name == "Norse");

I could move them up to before the check, so it's all in one place, but there's not really a point in loading them all and then afterwards giving up because the first two have failed. Nitpicking at this point :)

As for the colours I added, the yellow is used in various menus and headings, and the beige is found on the start screen on for example the Select World window:

image

MSchmoecker commented 1 year ago

Thanks for the additions.

Both colors look good, Valheim itself isn't very strict with them and uses slightly different shades all over the place. They are definitively close enough :)

The exceptions here are rather used for us to quickly see issues when Valheim updates, so the debugging time is shortened when something changes. Thus exceptions should be also added for the other fonts or at least a warning log should be printed.

SpikeHimself commented 1 year ago

They are definitively close enough :)

I would hope so, given that I have taken them straight out of the game itself using UnityExplorer :D

Thus exceptions should be also added for the other fonts or at least a warning log should be printed.

Right, in that case it makes more sense to put them in a list, and iterate, or something to that extent. For now I'll just add the checks "manually".