is it possible to load certain font file along with my application in android. if so , please help me to know the steps to do so.
Jump to content
Please see this important guide:
thanks for your reply. i tried that but it did not work very well for me. When adding the following code and include the font "comics.ttf" in the project folder, I got small font even it is 50.. is this the right way .. do you mean resource
local font ="comics" CustFont = display.newText( "DroidSerif", 40, 20,font, 50 )
If you put comics.ttf in your folder with your main.lua, then your code should work fine on an Android device. However, you have to install the font in Windows and OS-X/Mac and restart Corona SDK if you want the simulator to use the font. If you're building for iOS, you have to add something to your build.settings before iOS will use it.
One more thing on top of what Rob just said. You can sometimes get into trouble with fonts if the file name and the internal name for the font differ.
Sometimes, on devices, you'll have the font in the right place and have made the proper changes (iOS requires changes to build.settings, whereas with Android you simply drop the font in the root folder of the game) to load the font, but Corona sees it as having a different name than the one given by the filename. This can be very frustrating.
However, there is a solution.
PS - The core of my code is this little snippet:
local sysFonts = native.getFontNames() for k,v in pairs( sysFonts ) do -- Do something with the list: print(k,v) end
My tool simply adds bells and whistles, like making an IFC and listing all the fonts as well as showing them in action.
You can totally do this on your own if you have the time.
Edited by roaminggamer, 02 August 2014 - 12:47 PM.
1. Fixed link. Thanks.
2. No, I mean sometimes the font gets loaded, but the name does not match the file name as you would expect it to. Thus you have trouble getting Corona to use it. Corona knows about the font, but you've (in this example) assumed the name is the same as the filename prefix when it isn't.
A common case of this I've seen is dashed '-' names. The filename has no dashes, but the internal font name does.
Community Forum Software by IP.Board