-
Notifications
You must be signed in to change notification settings - Fork 0
Home
How to set up:
Import the google_font_downloader object into your project. It has a pretty long name so you can feel free to rename it if you want to.
It is persistent, so put it in the first room of your game.
Get an api key from google and paste it into the "google_api_key" variable in the create event of google_font_downloader
https://developers.google.com/fonts/docs/developer_api
All functions should be called by using google_font_downloader.function()
Before you're able to start downloading fonts, you need to call google_font_request_list(). It will download the list of fonts from fonts.google.com
You must wait for the list to get back before trying to download a font, use google_font_ready() to make sure the list is downloaded before trying to download a font
Use google_font_download() to download a font. Here are the parameters:
- Font - The name of the font to download. It's case sensitive and includes spaces
- Size - The size of the font that should be created within Gamemaker (same value you'd use when creating a font resource from the IDE)
- Italic - Whether or not to try and get the italic variant of the font. Not all fonts contain italic versions
- Save - Whether or not to save the font file to the disk and keep it, or to immediately destroy it when it's done being used
- [Weight] - The thickness you'd like the font to be at. Optional. If the thickness that you want isn't available, then the nearest one will be used
google_font_download() will return a FontRequest. You can use the FontRequest to check the progress of the download.
- FontRequest.font_resource will return the Gamemaker font resource (that you'll use with draw_set_font()). It will stay undefined until downloaded
- FontRequest.download_progress and FontRequest.download_size will give you info about the progress (it takes less than a second to download so probably not needed)
If you use google_font_download() on a font that has already been downloaded it will automatically choose the local file