• Hey! Guest! The 39th GMC Jam will take place between November 26th, 12:00 UTC and November 30th, 12:00 UTC. Why not join in! Click here to find out more!

GML Squish text after two lines




I am drawing text into a sprite box of a fixed size, 1200 pixels wide and enough room for 2 lines of text.
I am using the following to wrap the text so it is not drawn off the sides of the sprite
where x,y is the centre of the sprite and thisText is the string to draw.
The font is set to align middle and centre.

What I need, however, is that when the text cannot fit on two lines, that is it will be drawn onto three lines, is for the drawn text to be thinner/squished, to ensure the full string is drawn on two lines. In other words, the font size to be decreased horizontally only.

I've tried a few attempts but no success.
Does anyone who is more knowledgeable with algorithms offer any assistance.
Any help with this would be much appreciated :)


You cannot adjust text within a single draw call. You need to measure your text using string_width() and cut it in two where its length goes over two lines. Then draw first part with one draw settings, the second with other draw settings.