diff --git a/cocos2d/core/components/CCLabel.js b/cocos2d/core/components/CCLabel.js index 1b8d25694f..96aea833e2 100644 --- a/cocos2d/core/components/CCLabel.js +++ b/cocos2d/core/components/CCLabel.js @@ -289,6 +289,21 @@ var Label = cc.Class({ tooltip: CC_DEV && 'i18n:COMPONENT.label.font_size', }, + /** + * !#en Font family of label, only take effect when useSystemFont property is true. + * !#zh 文本字体名称, 只在 useSystemFont 属性为 true 的时候生效。 + * @property {String} fontFamily + */ + fontFamily: { + default: "Arial", + tooltip: 'i18n:COMPONENT.label.font_family', + notify: function () { + if (this._sgNode) { + this._sgNode.setFontFileOrFamily(this.fontFamily); + } + } + }, + _lineHeight: 40, /** * !#en Line Height of label. @@ -444,7 +459,7 @@ var Label = cc.Class({ if (value) { this.font = null; if (this._sgNode) { - this._sgNode.setFontFileOrFamily('Arial'); + this._sgNode.setFontFileOrFamily(this.fontFamily); } } @@ -544,6 +559,9 @@ var Label = cc.Class({ sgNode.setHorizontalAlign( this.horizontalAlign ); sgNode.setVerticalAlign( this.verticalAlign ); sgNode.setFontSize( this._fontSize ); + if (this.useSystemFont) { + sgNode.setFontFileOrFamily(this.fontFamily); + } sgNode.setOverflow( this.overflow ); sgNode.enableWrapText( this._enableWrapText ); sgNode.setLineHeight(this._lineHeight);