• 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.

Question - Code [SOLVED] Proportional font setting not working for font_add_sprite

Kevin K

Member
I'm having an issue with font_add_sprite that I've been unable to figure out myself. I've read through some old forum posts and have followed all the suggestions there (create a separate texture page, checking and unchecking automatic cropping), but nothing has worked.

I'm adding the font with this line of code: font_add_sprite(spr_fn_katie, ord("!"), true, 0);

The font was created in Aseprite, exported as a .png file, (I also tested a .bmp file), imported into GMS2 as a sprite. I've tested this code by creating a new project but to no avail. It seems that the proportional font setting makes no difference, each character that's drawn in the font has the same width regardless.

If anyone has an idea on how I can troubleshoot this, I would be eternally grateful!
 

Ricardo

Member
I could not find any (public) opened bug on YoYo's bugtracker when searching for "font_add_sprite". Maybe it'll be a good idea to create an example project, file a request and see if the Help Desk can help you.
 

Kevin K

Member
As I was writing this up to post a bug report, I played around the settings a few more times and was finally able to get it working. The settings that worked for me were to uncheck separate texture page (under texture settings in sprite menu), and check automatically crop (in Texture group settings, Tools -> Texture Groups) .

Unfortunately sprite_add_font is one of those functions that isn't well documented (even though the doc page is long). It seems that the way GMS2 handles texture pages really impacts how the fonts are drawn when using this function. Just play around with all combinations of texture settings, and the above mentioned options until you get something that works.
 

Ricardo

Member
As I was writing this up to post a bug report, I played around the settings a few more times and was finally able to get it working. The settings that worked for me were to uncheck separate texture page (under texture settings in sprite menu), and check automatically crop (in Texture group settings, Tools -> Texture Groups) .

Unfortunately sprite_add_font is one of those functions that isn't well documented (even though the doc page is long). It seems that the way GMS2 handles texture pages really impacts how the fonts are drawn when using this function. Just play around with all combinations of texture settings, and the above mentioned options until you get something that works.
Interesting. I think you still should file a bug and share your experience with the help desk, though. It could result in a request to improve the function's documentation.
 
Top