8000 [BUG]CCLableTTF works wrong with 64bit · Issue #794 · cocos2d/cocos2d-objc · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
[BUG]CCLableTTF works wrong with 64bit #794
New issue 8EF5
Open
@kthtes

Description

@kthtes

There's a strange bug.

1.Create a cocos2d v3.x project with "cocos2d iOS"
2.In "IntroScene.m", find "-(id)init" function, and add the following lines under "[self addChild:helloWorldButton];"

//************** under [self addChild:helloWordButton]; (line53)
NSMutableAttributedString* as=[[NSMutableAttributedString alloc] initWithString:@"ABCDE"];
NSRange fullRange=NSMakeRange(0, as.length);

UIFont* font1=[UIFont fontWithName:@"Times New Roman" size:30.0];
[as addAttribute:NSFontAttributeName value:font1 range:fullRange];
[as addAttribute:NSForegroundColorAttributeName value:[UIColor whiteColor] range:fullRange];

UIFont* font2=[font1 fontWithSize:15.0];
[as addAttribute:NSFontAttributeName value:font2 range:NSMakeRange(2,2)];
[as addAttribute:NSForegroundColorAttributeName value:[UIColor yellowColor] range:NSMakeRange(2, 2)];

CCLabelTTF* la=[CCLabelTTF labelWithAttributedString:as];
la.position=ccp(100,100);
[self addChild:la];
//**************

3.The result should be a label with "ABCDE". Among the 5 letters, "A" "B" and "E" should be in white color and full size(30.0), "C" and "D" should be in yellow color and half size(15.0). See the picture below:
ios 2014528 3 38 40

4.However, the actual result is:

ios 2014528 3 37 12

To avoid that bug, you'll have to either change the size of "UIFont* font2" from "15.0" to "15.001" or use 32-bit CPU simulator or device.

Here are my develop environment:
OS X: 10.9.3
XCode: 5.1.1
cocos2d-iphone: v3.0.0
iOS simulator: iPhone Retina 64-bit with iOS 7.1
iOS device: iPad Air with iOS 7.1

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0