2013-07-19 04:13:41 +08:00
|
|
|
/****************************************************************************
|
|
|
|
Copyright (c) 2013 Zynga Inc.
|
|
|
|
|
|
|
|
http://www.cocos2d-x.org
|
|
|
|
|
|
|
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
of this software and associated documentation files (the "Software"), to deal
|
|
|
|
in the Software without restriction, including without limitation the rights
|
|
|
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
copies of the Software, and to permit persons to whom the Software is
|
|
|
|
furnished to do so, subject to the following conditions:
|
|
|
|
|
|
|
|
The above copyright notice and this permission notice shall be included in
|
|
|
|
all copies or substantial portions of the Software.
|
|
|
|
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
|
|
THE SOFTWARE.
|
|
|
|
****************************************************************************/
|
2013-07-11 02:59:05 +08:00
|
|
|
|
2013-07-19 04:13:41 +08:00
|
|
|
#ifndef _CCLabelTextFormatProtocol_h_
|
|
|
|
#define _CCLabelTextFormatProtocol_h_
|
2013-07-11 02:59:05 +08:00
|
|
|
|
|
|
|
NS_CC_BEGIN
|
|
|
|
|
|
|
|
class CC_DLL LabelTextFormatProtocol
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
// sprite related stuff
|
2013-08-06 06:11:07 +08:00
|
|
|
virtual cocos2d::Sprite * getSpriteChild(int ID) = 0;
|
|
|
|
virtual cocos2d::Array * getChildrenLetters() = 0;
|
|
|
|
virtual cocos2d::Sprite * getSpriteForChar(unsigned short int theChar, int spriteIndexHint) = 0;
|
|
|
|
virtual float getLetterPosXLeft( cocos2d::Sprite* sp ) = 0;
|
|
|
|
virtual float getLetterPosXRight( cocos2d::Sprite* sp ) = 0;
|
2013-07-11 02:59:05 +08:00
|
|
|
|
|
|
|
// font related stuff
|
2013-08-06 06:11:07 +08:00
|
|
|
virtual int getCommonLineHeight() = 0;
|
|
|
|
virtual int getKerningForCharsPair(unsigned short first, unsigned short second) = 0;
|
|
|
|
virtual int getXOffsetForChar(unsigned short c) = 0;
|
|
|
|
virtual int getYOffsetForChar(unsigned short c) = 0;
|
|
|
|
virtual int getAdvanceForChar(unsigned short c, int hintPositionInString) = 0;
|
|
|
|
virtual cocos2d::Rect getRectForChar(unsigned short c) = 0;
|
2013-07-11 02:59:05 +08:00
|
|
|
|
|
|
|
// string related stuff
|
2013-08-06 06:11:07 +08:00
|
|
|
virtual int getStringNumLines() = 0;
|
|
|
|
virtual int getStringLenght() = 0;
|
|
|
|
virtual unsigned short getCharAtStringPosition(int position) = 0;
|
|
|
|
virtual unsigned short * getUTF8String() = 0;
|
|
|
|
virtual void assignNewUTF8String(unsigned short *newString) = 0;
|
|
|
|
virtual TextHAlignment getTextAlignment() = 0;
|
2013-07-11 02:59:05 +08:00
|
|
|
|
|
|
|
// label related stuff
|
2013-08-06 06:11:07 +08:00
|
|
|
virtual float getMaxLineWidth() = 0;
|
|
|
|
virtual bool breakLineWithoutSpace() = 0;
|
|
|
|
virtual cocos2d::Size getLabelContentSize() = 0;
|
|
|
|
virtual void setLabelContentSize(const Size &newSize) = 0;
|
2013-07-11 02:59:05 +08:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
NS_CC_END
|
|
|
|
|
|
|
|
#endif
|