2010-02-15 61 views
0

我想在cocos2d iPhone遊戲中使用this font。字體只顯示字母/數字的2/3。如果我打開隨OS X安裝的文本編輯器並使用字體,則字母顯示正常。任何想法可能是錯誤的?什麼會導致Cocos2d iPhone字體只顯示2/3的字母/數字?

下面是示出如何我使用字體顯示一個字符串的代碼片斷:

CCLabel* number = [CCLabel labelWithString:@"1" fontName:@"digital-7" fontSize:64]; 
    // position the label on the center of the screen 
    number.position = ccp(20 , size.height/2); 
    number.color = ccc3(0,0,0); 

    // add the label as a child to this Layer 
    [self addChild: number]; 

回答

0

事實證明,需要尺寸爲CCLabel指定。默認區域必須太小,導致文本被裁剪。當我添加尺寸參數時,文字顯示正確。

[CCLabel labelWithString:@"1000" dimensions:CGSizeMake(100, 50) alignment:UITextAlignmentLeft fontName:@"digital-7 (mono)" fontSize:48];