views:

223

answers:

1

I am trying to use this font in a cocos2d iPhone game. The font only shows 2/3rds of the letter/number. If I open the text editor installed with OS X and use the font, the letters appear fine. Any ideas to what may be wrong?

Here's the code snippet showing how I display a string using the font:

    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];
A: 

It turns out that dimensions needed to be specified for the CCLabel. The default area must have been too small which caused the text to be clipped. When I added the dimensions parameter, the text appeared correctly.

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

zooropa