[Request] Spritefont colors (extra characters)

0 favourites
  • 13 posts
From the Asset Store
An even more advanced version of Spritefont that allows you to make all sorts of new things.
  • Hi there Ashley Tom

    I've been looking for ways to add extra colors to my spritefont. I've looked through the js code for the spritefont object and it seems that the first thing it does is to take the characters listed in the object properties and split the spritefont sprite sheet so it assigns each letter to a piece of the sprite sheet.

    The problem with this is that it makes it impossible to have extra characters in the spritefont sprite sheet without having a character assigned to it to be used later.

    Here's a spritefont image for instance:

    (please don't mind the cropping or badly colored letters, it's just an example)

    I'd like to be able to do something like:

    Start of level -> set spritefont text to "test" -> change Y offset to +400 -> append spritefont text "test2"

    So the "test" part would be white and the "test2" part would be green.

    I know this might be a bit too much to ask but would you kindly consider adding this to the spritefont object?

    Thanks!

  • Heh, I've been requesting this since the Construct Classic days. Ended up making my own bitmap font system with sprite objects: https://twitter.com/Tokinsom/status/774121334288683008

    Ain't easy tho.

  • The spritefont object is designed to represent a single font, and this basically comes down to two things: representing multiple fonts in the same object, and then effectively a rich-text engine to be able to display multiple font styles within the same text run.

    Both are pretty complicated features to add, and I'm a bit sceptical of the design. For example I think it would be better to leave a spritefont as representing just one font, but then have a way to merge different spritefont objects in the same run of text. But then you still need some kind of markup and parser to specify where you want which font styles...

  • Tokinsom Very nice! I'd definitely buy it if you put it in the store.

    Ashley I've thought a lot about the last method you've mentioned but is there a way to know the position of the last character typed to append the next spritefont object?

  • Heh, I've been requesting this since the Construct Classic days. Ended up making my own bitmap font system with sprite objects: https://twitter.com/Tokinsom/status/774121334288683008

    Ain't easy tho.

    Looks really nice.

    And you gave me a lot of ideas for my own implementation. So thanks. <img src="{SMILIES_PATH}/icon_e_biggrin.gif" alt=":D" title="Very Happy">

  • You might be able to achieve different font colors by using the "Set Color" effect.

    It will not help you for the case of changing single chars though and that's what you're looking for I guess.

  • Has anyone ever thought about using a shader?

    Not to color objects, but to map out a texture.

  • Heh, I've been requesting this since the Construct Classic days. Ended up making my own bitmap font system with sprite objects: https://twitter.com/Tokinsom/status/774121334288683008

    Ain't easy tho.

  • andreyin bilgekaan Ha, I'd like to get it on there but it's still missing some features like horizontal & vertical alignments and variable character width. These aren't completely necessary but I think it would be hard to sell without. I quit working on this a while back since it was enough for my current project but I'll try finishing it.

  • I think it would be better to leave a spritefont as representing just one font, but then have a way to merge different spritefont objects in the same run of text. But then you still need some kind of markup and parser to specify where you want which font styles...

    Ashley This would be perfect! Having a phrase like "You always do this to me!" could then be easily done by switching the spritefont to a bold italics version of the font for just the word "always", and then switching back to the regular version for the rest of the sentence. I really hope something like this gets implemented.

    I quit working on this a while back since it was enough for my current project but I'll try finishing it.

    Tokinsom Please let me know when you release this. I've been trying to work with plugins and addons to create a text system as versatile this for a while now, and I've been coming up against a brick wall every time.

    Can this system work with any spritefont, or only the specific one you're using?

  • Tokinsom I'd also like to buy it.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • why not just use a canvas shader? so we dont have to apply the fx from C2? having it inside directly.

    those extra characters look interesting the little heart, that type of extra stuff wold be actually awesome to have.

    image results of using Adjust HSL FX

  • why not just use a canvas shader? so we dont have to apply the fx from C2? having it inside directly.

    those extra characters look interesting the little heart, that type of extra stuff wold be actually awesome to have.

    image results of using Adjust HSL FX

    The issue is having multiple colors/font weights in the same text run, which sprite fonts don't currently support. Ashley mentioned a markup language to achieve this, and as an example Unity uses a system mostly similar to HTML and I've found it to be a good solution. It has an option to generate a separate texture atlas for every required font weight, and handles them in a way comparable to having multiple animation frames in C2 - a list of assigned images, basically. It'd be nice to see a similar system in C2 and would open up a lot of interesting possibilities with fonts, even if for the time being we have to generate each texture atlas outside of C2.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)