如何在Corona for Android中添加自定义字体? [英] How to add custom font in Corona for Android?
问题描述
确保姓名和字体名称与Typelight程序相同。
然后我只是改变将根目录中的文件名称拖放到Outlaw。之后,在display.newText中写入文件名。
你能告诉我我在哪做错吗?
$ b $ 恩,问题是我没有安装Windows字体浏览器的字体。使用WFV进行安装并从字体参数thx krs中删除扩展名后,我最终显示了带有自定义字体的文本=)YAY!
一旦你有你的字体文件方便(例如Harrowprint.ttf),你需要先把它放在项目目录(main.lua所在的地方)。
$ b
对于Android应用程序,除了将字体包含在项目文件夹之外,不需要做任何事情。
您需要在代码中进行如下编辑:
local textObject = display.newText(See my new font?,100,100,Harrowprint,40) - 不需要在这里使用扩展名
如果不能再使用,那么您只需使用扩展名为.ttf的字体文件。
这可能有效。
礼貌: http://www.coronalabs.com/blog/2011/07/13/custom-fonts-corona/
I just tried everthing on the forums but I couldn't add my custom font to system. Here's what I have done:
I made sure that family name and font name are same with Typelight program.
Then I just change the name of the file in the root directory and drag it to Outlaw. After that write the filename in display.newText.
Can you tell me where I am doing wrong?
[EDIT] Well, the problem was that I haven't installed the font with Windows Font Viewer. After installing it with WFV and removing the extension from font parameter thx krs, I finally displayed the text with customized font =) YAY!
Once you have your font file handy (ex. Harrowprint.ttf), you’ll need to first place it in your project directory (the same place your main.lua resides).
For Android apps, nothing needs to be done apart from including the font in your project folder.
There is an edit you have to do in your code as follows :
local textObject = display.newText( "See my new font?", 100, 100, "Harrowprint", 40 ) -- no need to use extension here
If it doesn't works again then , you just use a font file with '.ttf' extension. This may work.
Courtesy : http://www.coronalabs.com/blog/2011/07/13/custom-fonts-corona/
这篇关于如何在Corona for Android中添加自定义字体?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!