views:

221

answers:

1

Hi, I need to display some text in cocos2d layer. I added UITextView to it. I added the text in the text View. But, for setting the font by ( UIFont class), I could not do it. I saw the list of supported fonts for iPhone, In that list Copperplate Gothic Bold is not there. I downloaded it from net. It is working good for CCLabel and CCFontMenuItem. How can I make it work for UILabel ?

* Assertion failure in -[UILabel setFont:], /SourceCache/UIKit/UIKit-963.10/UILabel.m:445 2010-05-19 16:07:43.282 testOfGameScreen[1155:207]
*
Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid parameter not satisfying: font != nil' 2010-05-19 16:07:43.285 testOfGameScreen[1155:207] Stack: (

I am getting the above error when using UIFont with Copperplate Gothic Bold
Thank you.

A: 

Hi Srikanth,

Displaying a font which does not already present in iphone is not so easy. Developers have their own workarounds and I can share with you one or two.

Zyngas Font label (http://github.com/zynga/FontLabel) is a popular method. I dont have any personal experience with it, but a google search will tell you that it is a workable solution.

If you are trying to display one or two lines of text, you can try a solution based on this link. The example shown is only capable of displaying single line text, but you can easily modify it to display multiline text. Please remember that this method is drawing the text as images and you may not be able to copy/paste it.

Manu