1. Hey! Guest! The 36th GMC Jam will take place between February 27th, 12:00 UTC - March 2nd, 12:00 UTC. Why not join in! Click here to find out more!
    Dismiss Notice

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

Discussion in 'GameMaker Studio 2 Community Tech Support' started by Kevin K, Feb 1, 2020.

  1. Kevin K

    Kevin K Member

    Joined:
    Jul 1, 2019
    Posts:
    3
    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!
     
  2. Ricardo

    Ricardo Member

    Joined:
    Jun 20, 2016
    Posts:
    206
    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.
     
  3. Kevin K

    Kevin K Member

    Joined:
    Jul 1, 2019
    Posts:
    3
    thanks! I guess that's my only option at this point. I'll give it a shot.
     
  4. Kevin K

    Kevin K Member

    Joined:
    Jul 1, 2019
    Posts:
    3
    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.
     
  5. Ricardo

    Ricardo Member

    Joined:
    Jun 20, 2016
    Posts:
    206
    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.
     

Share This Page