How do you add custom fonts for desktop apps?
The following guide should help you out…
https://docs.coronalabs.com/daily/guide/system/customFont/index.html
In summary, your only option on OS X is to load your font files by their family names. On Windows, you have to load them by file name like how you do it on Android.
If you want to avoid dynamic platform checks in your Lua code, then a simple trick to making this work cross-platform is to rename your font files to their font family names that OS X and iOS loads them by. That way on Android and Windows you can load them by that same name, excluding the *.ttf or *.otf file extension.
So no special code needs to be added to the build.settings file like needed for iOS?
Nope.
Sweet. Thx for the help
No special code is needed on iOS either anymore (not for a couple of months).
I hope the documentation reflects that
Unless I missed it I did not see that it said that for desktop apps so you might want to make it more obvious. Also I did not realize that had changed for iOS so that is great to know.
The font directions linked to above have the correct information.
Basically you just copy the font files to the top level of your project (and install them on Windows) and then there are some gotchas regarding font names that are platform dependent.
You don’t have to install the fonts on Windows either if you load them by file name as described in the guide. So, yeah, it’s pretty simple now.
Just a hint on this… Use native.requestExit() instead of os.exit() or the fonts will remained locked on Windows after termination.
Actually _ always _ use native.requestExit() instead of os.exit() period
We’ve updated the docs to say this.
The following guide should help you out…
https://docs.coronalabs.com/daily/guide/system/customFont/index.html
In summary, your only option on OS X is to load your font files by their family names. On Windows, you have to load them by file name like how you do it on Android.
If you want to avoid dynamic platform checks in your Lua code, then a simple trick to making this work cross-platform is to rename your font files to their font family names that OS X and iOS loads them by. That way on Android and Windows you can load them by that same name, excluding the *.ttf or *.otf file extension.
So no special code needs to be added to the build.settings file like needed for iOS?
Nope.
Sweet. Thx for the help
No special code is needed on iOS either anymore (not for a couple of months).
I hope the documentation reflects that
Unless I missed it I did not see that it said that for desktop apps so you might want to make it more obvious. Also I did not realize that had changed for iOS so that is great to know.
The font directions linked to above have the correct information.
Basically you just copy the font files to the top level of your project (and install them on Windows) and then there are some gotchas regarding font names that are platform dependent.
You don’t have to install the fonts on Windows either if you load them by file name as described in the guide. So, yeah, it’s pretty simple now.
Just a hint on this… Use native.requestExit() instead of os.exit() or the fonts will remained locked on Windows after termination.