Not having much luck with custom fonts on Windows and I’m hoping someone can help me out. This is a bit of a new foray for me. I have read the Font tutorial and Blog FAQ:
- http://www.coronalabs.com/blog/2011/07/13/custom-fonts-corona/
- http://www.coronalabs.com/blog/2013/01/16/faq-wednesday-custom-fonts/
I got my custom fonts from the Basic section of dafonts.com:
The fonts I’m attempting to use are all free TTF (TrueType) fonts:
Let’s take these three as a good sample:
- Dolphin Sans - http://www.dafont.com/dolphin-sans.font?fpp=50
- Origin - http://www.dafont.com/origin.font?fpp=50
- Roboto Medium - http://www.dafont.com/roboto.font?fpp=50
Now, I’m using Windows 7 so I have installed the fonts and confirmed their installation by accessing them in Microsoft Word, so I know they are available for use. I have tried them in the Windows font viewer and they all seem to be fine and uncorrupted.
The code I’m using to render them is:
display.newText( "Dolphin Sans", 100, 100, "Dolphin Sans", 50 ) display.newText( "Origin Light", 100, 200, "Origin Light", 50 ) display.newText( "Roboto Th", 100, 300, "Roboto Th", 50 )
Though I know it’s not necessary on Windows/Android, I have setup my build.settings file like so:
settings = { iphone = { components={}, plist = { UIApplicationExitsOnSuspend = true, UIAppFonts = { "Dolphin-Sans.ttf", "Origin-Light.ttf", "Roboto-Thin.ttf", }, } }, }
The output I get in the Windows simulator console is:
Warning: could not load font Dolphin Sans. Using default font. Warning: could not load font Origin Light. Using default font. Warning: could not load font Roboto Th. Using default font.
Would anyone be able to tell me why this is happening and how to fix it, please?
I have attached my zipped working directory with the code and font files included.