How to add custom font in Corona for Android?

前端 未结 2 1370
抹茶落季
抹茶落季 2020-12-21 15:03

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

2条回答
  •  清歌不尽
    2020-12-21 16:06

    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/

提交回复
热议问题