When defining a font in GameMaker Studio 2, you can define a range of characters to include. This is because the font itself is not actually included with your game (for legal reasons) but an image of the font is included on a texture page and that is what your game will use (just like any other graphics asset). This means that you will want to keep the number of characters that you use to a minimum and specify only the range of characters that your game will need so as to keep texture memory as optimised as possible. This function can be used to find the starting character (as an ASCII value) that was used when your font asset was added to your game.

NOTE: Due to changes in the way fonts are handled, this function will always return 32, as GameMaker Studio 2 enforces the space character (32) into the font and doesn't allow characters with codes lower than 32 either. New functions to do similar tasks will be added in a future update.



参数 描述
ind 待检测的字体索引。




num = font_get_first(fnt_Main);

The above code will store the ASCII value of the first letter of the font range for the font indexed in "fnt_Main".