DenizenScript / Denizen

NPC and general Spigot scripting, using the Denizen Scripting Language!
https://denizenscript.com/
MIT License
207 stars 104 forks source link

`MapText` custom font support #2596

Closed tal5 closed 7 months ago

tal5 commented 7 months ago

Requested on Discord.

Changes

[!NOTE]

Java font rendering

Java renders text from the bottom left corner instead of the top left corner, so added some calculations with the font's sizes to try and compensate, which seem to work decently well. Albit not always being 100% precise with some fonts (e.g. comic sans is a lil off), most fonts (e.g. arial) seem to work well.

[!NOTE]

Image caching

Currently it seems only the text is cached (vs stuff like the color which are always parsed), and caching the image would mean everything would be cached, which I assume is fine? but just making sure before trying to implement that.

[!NOTE]

Null values in save data

MapText#getSaveData seems to just put the values in even if they're null, which is what I did for the new values as well - these could probably be excluded? wouldn't really matter usually, but might be relevant when you have lots of maps.