Custom monospace fonts - experiments

ArmellineArmelline Member, PRO Posts: 5,368
edited August 2015 in Working with GS (Mac)

I've been experimenting a bit with generating custom text fonts in GameSalad. This is only for monospace fonts - it's much more complicated for variable width fonts.

Have a look at the video below and let me know if you have any suggestions/requests/comments! Once I'm happy enough with it, I'll be releasing a free template.

Comments

  • HopscotchHopscotch Member, PRO Posts: 2,782
    edited August 2015

    Very nice @Armelline! Super useful!

    To solve the "single actor" issue, you could use the Rotation and X attributes to send the spawned actors the row id and letter position. Store them in the new actor then then adjust them back to their intended values.

    Suggestion: Also allow for multiple columns to accommodate localisation.

  • ArmellineArmelline Member, PRO Posts: 5,368
    edited August 2015

    Excellent idea @Hopscotch. I'd tried that after reading you mention it before in another thread, but it hadn't seemed to work right. I just tried it again and it works spot on. Thanks! (Weird how you can fail at something one day and do it immediately another...)

    Localisation is a good idea, and shouldn't be too hard to add. Will give it a go!

  • HopscotchHopscotch Member, PRO Posts: 2,782
    edited August 2015

    @Armelline said:
    Excellent idea

    Thanks, I'll take full credit for remembering something which @Socks mentioned many moons ago. :D

    Since then I have used it extensively and it works very well. Could make templates a little confusing though.

  • HymloeHymloe Member Posts: 1,653

    Nice one @Armelline ... looks promising!

  • ArmellineArmelline Member, PRO Posts: 5,368
    edited August 2015

    @Hopscotch said:
    Armelline, suggestion #2, auto-fitting speech bubbles. :)

    Auto-wrapping is a very fiddly affair. I had to do it using just text strings and a built in fixed width font for a game a while ago, and it was annoyingly tricky. I'm wary of walking down that road again :D

    Manually wrapping the text and working out the width and height the text covers and resizing a speech bubble to fit that area is a much easier prospect, though.

    Single actor and localisation are in though!

  • SocksSocks London, UK.Member Posts: 12,822

    Really great stuff !!! :)

  • ArmellineArmelline Member, PRO Posts: 5,368

    Adding right and (hopefully) centre alignment. Then I'm all out of ideas on how to expand and improve this.

  • SocksSocks London, UK.Member Posts: 12,822

    @Armelline said:
    . . . . I'm all out of ideas on how to expand and improve this.

    Full kerning tables for all commonly used fonts. :tongue:

  • SocksSocks London, UK.Member Posts: 12,822
    edited August 2015

    Unless it is already the case*, it would be better if the letter images were in white, so the user can colour the letters how they please - I know you are really just working on the engine that does the magic, rather than the actual typeface, and people who use this method should import their own monospaced typeface, but I suspect a lot of people who are less technically proficient than you will just grab the whole package and use it as it is.

    Maybe there is scope here for a free version - as presented - and a posh version, with a selection of fonts (in white!) that you could sell on GSHelper, you could add things like tracking and leading to this paid version, and maybe even word spacing (monospaced fonts often need the word spacing adjusted more so than kerning fonts) ?

    *©1997 typeface-puns.com

  • ArmellineArmelline Member, PRO Posts: 5,368

    @Socks said:
    Unless it is already the case*, it would be better if the letter images were in white, so the user can colour the letters how they please

    That's a good idea! I'll add letter colour to the table, too.

    Tracking would be no problem, and leading as far as the gap between the lines, though I don't intend to get into ascenders and descenders. Kerning would actually be easy to implement logic-wise, it's just a matter of getting the required information. I've not found a way to do so yet...

    I'm definitely considering a free version and a paid version, but I don't think there's actually all that much interest in this kind of thing. I have a project I'm working on for someone where this will save many hours, but I think I'm the exception rather than the rule!

  • Braydon_SFXBraydon_SFX Member, Sous Chef, Bowlboy Sidekick Posts: 9,273

    Super cool, @Armelline ! Not sure how I missed this one, either!

  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,880

    This is a really great idea! Looking forward to seeing how its done.

  • SocksSocks London, UK.Member Posts: 12,822
    edited August 2015

    @Armelline said:
    I don't intend to get into ascenders and descenders.

    You don't have to ! Ascenders and descenders share a common baseline so you don't have to baseline shift characters, so although your x height will cover most letters, the letter actors/images would be bigger, enough to accommodate ascenders and descenders, but all share a common orgin.

    @Armelline said:
    Kerning would actually be easy to implement logic-wise, it's just a matter of getting the required information.

    :o Lol ! :)

    There are a lot of kerning pairs in an alphabet !!

  • ArmellineArmelline Member, PRO Posts: 5,368
    edited August 2015

    @Socks said:
    You don't have to ! Ascenders and descenders share a common baseline so you don't have to baseline shift characters, so although your x height will cover most letters, the letter actors would be bigger, enough to accommodate ascenders and descenders, but all share a common orgin.

    That's all I did so far - just have blank space at the bottom of most letters. Seemed no point in trying to do anything more fancy.

    There are a lot of kerning pairs in an alphabet !!

    That would be the required information :P Once you have a table containing each pairing's kerning, it's not too difficult to find the right data.

  • SocksSocks London, UK.Member Posts: 12,822

    @Armelline said:
    That's all I did so far - just have blank space at the bottom of most letters. Seemed no point in trying to do anything more fancy.

    Agreed, that's basically how fonts are actually done, there is no metadata that adjusts baseline per character (so 'o' sits lower, lowcase 'g's even lower, 'x' on the baseline . . . etc etc) . . . in fact even back int he days of metal setting they took the same route, just leaving a blank space at the bottom of all the letters to accommodate descenders . . .

  • ArmellineArmelline Member, PRO Posts: 5,368

    Having some fun with special characters... Seems GameSalad returns incorrect results when some special characters are used in textFind. Will have to see what the response to my bug report is before I push on. There's an easy workaround, but I don't want to have to use it.

    (I'm currently using textFind to distinguish between lower and upper case characters. Happy for any other suggestions :D)

    Project highlighting the issue attached.

  • ArmellineArmelline Member, PRO Posts: 5,368
    edited August 2015

    Really not having much luck trying to get special characters and foreign characters into the mix here. It seems that although you can use special characters like ü or é for string comparisons etc., you can't use them to reference an image in a "Change Attribute" behaviour.

    Take this image:

    I cannot get it to display without using the "Change Image" behaviour. If I use the Change Image behaviour it will display fine, so GameSalad can definitely read and use the image name. If I rename the image to not have the special character, it will display quite happily using the "Change Attribute" behaviour. But with the original filename it just won't display.

    Same goes for a bunch of special characters too, such as $ and ^.

    @BlackCloakGS @GeorgeGS @Anyone any tips? These two bugs have really thrown a spanner into the works. I really don't want to have to rename all the images and do a big list of nested "If character = ü then".

    Bug mentioned in previous post. This bug.

  • ArmellineArmelline Member, PRO Posts: 5,368
    edited August 2015

    Current state. Just waiting for the two bugs I mentioned to be fixed and then it's just optimisation and making a few more fonts to use! I'll take a look at right aligned and centred fonts for version 2.

    Features:

    • Single prototype actor for all text to be displayed
    • Text updates automatically when changed
    • Supports uppercase, lowercase, special characters
    • Resize the instance actor to set the font size
    • Choose any colour and opacity for your font
    • Control the tracking and leading for your font
    • Use as many fonts on screen as you want - simply drag an image onto the instance actor to set that as its font!
    • Localisation - change the defined language and the text automatically updates
    • No constrain attributes!

  • Braydon_SFXBraydon_SFX Member, Sous Chef, Bowlboy Sidekick Posts: 9,273

    Great stuff as always, @Armelline !

Sign In or Register to comment.