From 3354816e87787a7af0dcf4384eee72ee7e787464 Mon Sep 17 00:00:00 2001 From: zilongshanren Date: Wed, 7 Dec 2016 15:22:36 +0800 Subject: [PATCH] fix richtext custom chinese font rendering issue --- cocos2d/core/components/CCRichText.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cocos2d/core/components/CCRichText.js b/cocos2d/core/components/CCRichText.js index 51d0cc8005..2975a0f84b 100644 --- a/cocos2d/core/components/CCRichText.js +++ b/cocos2d/core/components/CCRichText.js @@ -346,10 +346,15 @@ var RichText = cc.Class({ this._sgNode.addChild(labelSegment); this._labelSegments.push(labelSegment); + //when lineHeight is less than the content size of labelSize + //in Web platform, the extra pixels will be trimed. + //so we need to set the overflow to clamp in JSB + //FIXME: label in jsb should be refactored to keep the behavior the same as web platform. if(CC_JSB) { labelSegment.setOverflow(1); var size = labelSegment.getContentSize(); - labelSegment.setContentSize(size.width, this.lineHeight); + labelSegment.enableWrap(false); + labelSegment.setDimensions(size.width, this.lineHeight); } return labelSegment;