Default font inside KoolConfig
mallumoSK opened this issue · 3 comments
Hi please add font de.fabmax.kool.util.MsdfFont
as one of parameters de.fabmax.kool.KoolConfig
+remove fallows:
de.fabmax.kool.util.MsdfFont.Companion.DEFAULT_FONT_DATA
de.fabmax.kool.util.MsdfFont.Companion.DEFAULT_FONT
or transfer into getters:
val de.fabmax.kool.util.MsdfFont.Companion.DEFAULT_FONT get() = de.fabmax.kool.KoolSystem.config.font
val de.fabmax.kool.util.MsdfFont.Companion.DEFAULT_FONT_DATA get() = de.fabmax.kool.util.MsdfFont.Companion.DEFAULT_FONT.data
Primary reason:
On multiple places is configurations of font loaded from default (created in static initializer) but everywhere i use custom fonts ... central europe charset.
Secondary reason:
Without image resource of default font framework do not work.
And the last one:
Is no good practise bundling json inside source code as base64.
I understand why, but better option is, separate json+png as library with no other code, just base64.
I hope I have convinced.
Thank you in advance.
Yes the current solution is very hacky. I did it that way because I couldn't think of a better solution but moving it into a separate resource lib might actually be a good idea. I will think about that.
Thax
Default font data is now an optional config parameter (eventually, I decided against an extra lib). If no custom font is specified on init the default meta data is taken instead. However, I removed the big block of base64 data. On JVM the json is now simply loaded from resources and on JS I still have the JSON in source code but I removed the compression and base64 encoding. It's a little bigger now but I agree that the base64 block did look a bit suspicious.