blitz-research / monkey2

zlib License
133 stars 43 forks source link

Loading ImageFont in mojo theme #404

Open seankarol opened 6 years ago

seankarol commented 6 years ago

I can't seem to find a way to load ImageFont in mojo.app.Theme JSON definition. After digging through the source it appears that a mojo theme will never load an ImageFont through the JSON.

I can directly assign a Font to a style such as App.Theme.GetStyle("...").Font = MyImageFont though I also can't iterate through all styles and states, making this pretty tedious.

Thank you in advance.

seankarol commented 6 years ago

And another thing that would be awesome when loading theme JSON would be defining the texture flags.

A suggestion could be expand the JSON font to use an object to support more parameters:

{
 ...
 "fonts": {
  "my_image_font": {
    "file": "image_font.png",
    "char_width": 15,
    "char_height": 32,
    "flags": 0
  }
 },
...
}

If it's just a string use the current formatting.