• Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

 [SUGGESTION] Text Formatting Functions

Shadow64

Member
Hi there. I previously posted this as a bug, but was asked to open it as a suggestion in the forums. I've been told that if there is enough desire shown in the thread for this kind of functionality then the team will possibly add it to the list. I figure it's worth a shot! So please sound off, if you agree. :)

It would be really great to have better text formatting functions in GMS2. For instance, I've noticed that you can change the height of separation for lines of text if you use:

Code:
draw_text_ext
but outside of that function you can't change the line height value. It would be very useful if that was a value which could be retrieved and set, just like draw_set_font.

My suggestion would be:

Code:
draw_set_font_sep(height);
After calling this, people could use draw_text(x, y, string); without having to worry that it was just going to use the default line height value.

Since the value is clearly accessible by another function, it would be nice if this was something we could access and change for all text - not just when using draw_text_ext. It also seems like it wouldn't take long to add. Obviously, it would still default to the value of a font's "M" height if left unaltered.

Here are some other text functions which would be INCREDIBLY helpful:

Code:
draw_set_font_kerning(width); - altered kerning (space between letters)
draw_text_indented(x, y, indent, string); - indented text which raps back to the origin
string_replace_at(index, string); - replace a character at a specific location with a string
I recently created a dialogue system and it would have been much easier if I could have controlled the text at this level. I had to spend a lot of time "tricking" GameMaker to do these things and I know some people think that's the point, but a lot of these are fairly basic functions when it comes to controlling the look of text.

Thank you for listening. With any luck someday we'll have these functions or others like them.
 
Last edited:
A

antialias85

Guest
So, a little bit of a pedantic point:
Kerning specifically refers to the space between two individual characters. Tracking is the spacing of line of characters.

So, you could kern "this" like "th is",
but you would track "this" like "t h i s".

It would be nice to hve both options if this were implemented.
 

csanyk

Member
Better text rendering/formatting options is something I would really love to see done.

A few years ago, I worked on a draw_text_rtf script, and it was a total pain to write, slow to execute, and still not very powerful.

I've also written a draw_text_hyperlink script that makes text that you can click, kindof like a LinkButton in .NET... so there's things that are do-able in GML, already, but I feel that doing this sort of low-level work takes the developer away from rapid development of the actual game, and that the more we have baked in to GMS, the better we'll be enabled to focus on implementing game mechanics rather than building up code libraries that do what other frameworks already can do.

Other engines have much better text rendering capabitilies, and while text isn't a major requirement in many video games, it's still an important design element, and having better/easier control over how text appears when drawn to the screen, without having to do a lot of low-level programming to achieve effects that can be done trivially in other engines would be a major improvement to GMS, in my opinion. Something on par with Adobe InDesign's text formatting may not strictly speaking be necessary but it'd sure be a wonderful and welcome feature to get as close to it as possible.
 
Top