diff --git a/cocos2d/core/components/CCLabel.js b/cocos2d/core/components/CCLabel.js index df0b2e04dc..1718bef2db 100644 --- a/cocos2d/core/components/CCLabel.js +++ b/cocos2d/core/components/CCLabel.js @@ -382,6 +382,9 @@ var Label = cc.Class({ sgNode.setString(this.string); if (CC_EDITOR && this._useOriginalSize) { this.node.setContentSize(sgNode.getContentSize()); + if (this.font instanceof cc.BitmapFont) { + this.lineHeight = sgNode.getBMFontLineHeight(); + } this._useOriginalSize = false; } else { sgNode.setContentSize(this.node.getContentSize()); @@ -393,7 +396,7 @@ var Label = cc.Class({ _updateNodeSize: function () { var initialized = this._sgNode && this._sgNode.parent; if (initialized) { - if (this.overflow === Overflow.NONE) { + if (this.overflow === Overflow.NONE || this.overflow === Overflow.RESIZE_HEIGHT) { this.node.setContentSize(this._sgNode.getContentSize()); } } diff --git a/cocos2d/core/label/CCSGLabel.js b/cocos2d/core/label/CCSGLabel.js index 2a2b44baed..558de5df03 100644 --- a/cocos2d/core/label/CCSGLabel.js +++ b/cocos2d/core/label/CCSGLabel.js @@ -343,6 +343,12 @@ _ccsg.Label = _ccsg.Node.extend({ return this._lineHeight; }, + getBMFontLineHeight : function() { + if(this._fontAtlas) { + return this._fontAtlas._lineHeight; + } + }, + setFontFileOrFamily: function(fontHandle, textureUrl) { fontHandle = fontHandle || "Arial"; var extName = cc.path.extname(fontHandle);