Legacy GM font_add() Not working

Snayder05

Member
I'm trying to draw a text with a font that I downloaded from internet, But is not working. The font file is in the same folder as the project.
I tried the same with GM Studio 2 and still being the same problem. It's still showing Arial.
I'm programing in this way:

Event Create:
Code:
font_lb = font_add("Font/Lobster.otf", 26, false, false, 32, 255);
Event Draw:
Code:
draw_set_color(c_red);
draw_set_font(font_lb);
draw_text(x, y, "Hello World");
Thanks for the time spend to reply me!
 

Attachments

Snayder05

Member
I already check the documentation. font_add()
I don't know where is "Included Files". I'll show you with attached images how the folders looks like.

I tried this with Game Maker Studio 2:
GML:
nfont = font_add("Palatino Linotype", 26, false, true, 32, 255);
Even this is not working. It keeps showing Arial.

And this line code is working in Game Maker 8.

So I don't know what's happening.
 

Attachments

TsukaYuriko

☄️
Forum Staff
Moderator
You can access the Included Files from the Asset Browser's hamburger menu:

1631816749605.png

... which points to the "datafiles" folder in the screenshot you posted.
 

Snayder05

Member
I have both, Lobster.otf and Lobster.ttf! According to documentation bothfiles files works for GM!
I already tried with both types!
Thanks to @TsukaYuriko now es working for GM studio 2! But still not for GM 8. (Both files)!
I keep trying to included the file to the game in GM8! :(

Anyway thanks for the time spend to reply me!
 

TheouAegis

Member
Again, OTF does not work for GM8, even according to the documentation. I don't know what documentation you read that says OTF files work. They've never worked.
Did you try messing with the export options? I don't recall ever having to fiddle with those, but my GM8 computer died a while back.

Also, locate the font FILE you are trying to use and open it in the Windows Font Viewer (via just double-clicking on the font). Does the font display correctly for all sizes? I have at least one font on my computer called "Script" and it shows correctly in the preview in Studio, but will not work with draw_text(). I opened the file in the Font Viewer and noticed only the default preview works, while all the alternate sizes are showing Arial. I tested the font in WordPad and it worked just fine, but it doesn't work in GM not the Font Viewer. So maybe your font file itself is bad. I also noticed the Font Viewer said it was "Script", not "Script (True Type)" nor "Script (Open Type)", so maybe that's a thing.
 
Top