You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hidden undocumented functionality of CCLabelTTF's labelWithString:fontName:fontSize:dimensions: should be made explicit by creating a new factory method
#883
Open
agro1986 opened this issue
Jul 11, 2014
· 0 comments
CCLabelTTF has a hidden functionality on its factory method, which is to make a label with a fixed width and then let the height be decided automatically by passing CGSizeMake(whatever, 0). That functionality should be made explicit by having this factory method:
In the current Cocos2D 3.1, suppose someone has this string which they wants to display like movie credits, by having the text move up the screen:
descriptionText = @"Special thanks to wolverine, professor x,\
cyclops, wolverine, professor x, wolverine, professor x,\
wolverine, professor x, wolverine, professor x, wolverine,\
professor x, wolverine, professor x, jane";
Great, now new line is inserted automatically (because a dimension is set). However, The text couldn't fit in the dimension so the bottom text are not displayed. So they add this line:
descriptionLabel.adjustsFontSizeToFit = YES;
However, now new lines aren't automatically inserted. Instead, all that one line is made to fit in the dimension resulting in text for ants.
What the user want is to make the width fixed (defined), but let the height be decided by the factory method. Currently there is no clear way to do it. It made me waste an hour, and my use case affects many people. I hope my suggestion is considered. Thanks.
The text was updated successfully, but these errors were encountered:
CCLabelTTF has a hidden functionality on its factory method, which is to make a label with a fixed width and then let the height be decided automatically by passing CGSizeMake(whatever, 0). That functionality should be made explicit by having this factory method:
In the current Cocos2D 3.1, suppose someone has this string which they wants to display like movie credits, by having the text move up the screen:
They might first make it like this:
However it flows freely horizontally and no line break is introduced. So next they try this:
Great, now new line is inserted automatically (because a dimension is set). However, The text couldn't fit in the dimension so the bottom text are not displayed. So they add this line:
However, now new lines aren't automatically inserted. Instead, all that one line is made to fit in the dimension resulting in text for ants.
What the user want is to make the width fixed (defined), but let the height be decided by the factory method. Currently there is no clear way to do it. It made me waste an hour, and my use case affects many people. I hope my suggestion is considered. Thanks.
The text was updated successfully, but these errors were encountered: