label's text weight

Hi,is there a function to set label’s text weight?

There’re two methods in CCLabelTTF.h

/** initializes the CCLabelTTF with a font name, alignment, dimension and font size */
bool initWithString(const char *label, CCSize dimensions, UITextAlignment alignment, const char *fontName, float fontSize);

/** initializes the CCLabelTTF with a font name and font size */
bool initWithString(const char *label, const char *fontName, float fontSize);

so in your code,

// width by default
CCLabelTTF* pLabel = CCLabelTTF::labelWithString("Hello World", "Arial", 34);

// set your dimension
CCLabelTTF* pLabel = CCLabelTTF::labelWithString("Hello World", CCSizeMake(300, 100), UITextAlignmentCenter, "Arial", 34);

For 0.7.2-rc and older version, use cocos2d::CGSizeMake; for 0.8.0 and higher version, use CCSizeMake.

And you can set CC_SPRITE_DEBUG_DRAW to 1 in cocos2dx/include/ccConfig.h, to see the border of CCLabelTTF

#define CC_SPRITE_DEBUG_DRAW 1

Yes,but I want to set font weight or “bold-faced”,not font size.
like this:
singoon not singoon

Sorry, I make mistake, weight - width.
So far, cocos2d has no interfaces to set the style of bold or italic.

You can try to add a flag, then implement this feature in UIImage::initWithString(…) This fucntion is implemented in
* cocos2dx/platform/ios/UIImage_ios.mm
* cocos2dx/platform/android/UIImage_android.cpp
* etc.

Thx,maybe you mean this file:
* CCXUIImage_iphone.mm
but I can’t find UIImage::initWithString(…)

emm, in 0.7.2, it’s platform/iphone/CCXBitmapDC.mm static void initWithString
The platform layer is refactored in version#7, so it’s a bit different