Changing Font mid-string

G

Gamenoobie

Guest
Greetings.
First of all, I am fairly new at Gamemaker and I am not quite accustomed to it yet.

I have looked over google, many websites, this forum and tutorials and I can't seem to find an answer to what I wish to accomplish with Gamemaker. First of all: My game will be text heavy, but it is not a text-adventure.

The closest thing I could find to what I want is this script here which changes the color of text mid-string.
However I tried many ways of tweaking it to make it change fonts, without any success.

What I'm looking for is to be able to write a script that makes text appear something like this, I'm just not too sure how to make it all work. And being text heavy, having to align everything would be a huge pain.

//
draw_set_font(normalfont)
draw_text_ext( x, y, "Text here is being draw normally, with the default or initial font for this particular line.
However here it would be in italic because it is a dialog
And because the dialog ends, it goes back to normal, sep, w);
//

Here would be a better description of what I want vs what I want to avoid. Gyazo image

Being a noob, I'm just looking to understand and learn so any kind of help would be hugely appreciated.
Thank you
 

obscene

Member
It's a pain. Basically you need to track where are the italics are, break them into separate strings and then calculate using string_width where to place individual draw calls for each set of fonts/colors etc. Not fun!
 
G

Gamenoobie

Guest
Man... I just wish Gamemaker had a simple thing to change a font mid string like HTML with <b> blabla </b>.
I'm still looking into it but unable to make it work, other than aligning seperate strings with trial and error.

If anyone has ever been in this situation and found a solution, please be the greatest person in the world and share.
Cheers!
 
You could make a hacky sprite font where you replaced the lower case letters with capital italicized symbols and then write in all caps for regular font and lowercase for italicized text... Someone familiar with sprite fonts could probably advice you better about this approach. Doing it my way would mean you have to type in uppercase all the time. But there might be something similar to this that would work better, idk.
 
Top