With this function you can get the actual system name of the selected font asset. This function returns a string and not an index, and the name returned will depend on the font being used. For example, you may have a font asset called "fnt_Main" in the GameMaker Studio 2 Asset Browser, and the font itself may be the Windows system font Arial. In this case the function will return "Arial" as that is the system name of the font. Should you need the name as it appears in the Asset Browser, you should use font_get_name().
font_get_fontname(ind);
| Argument | Description |
|---|---|
| ind | Index of the font to check. |
String
fnt_Name = font_get_fontname(font0);
The above code will get the system name of a font resource and store it as a string in the variable "fnt_Name".