Merge pull request #702 from VisualSJ/master_2535_2

remove useSystemFont from CCGLabel
This commit is contained in:
Wang Nan
2016-05-20 16:40:55 +08:00
3 changed files with 5 additions and 32 deletions
+5 -6
View File
@@ -245,7 +245,7 @@ var Label = cc.Class({
set: function (value) {
this._N$file = value;
this._bmFontOriginalSize = -1;
if (this._sgNode) {
if (this._sgNode && !this._isSystemFontUsed) {
if ( typeof value === 'string' ) {
cc.warn('Sorry, the cc.Font has been modified from Raw Asset to Asset.' +
@@ -276,18 +276,17 @@ var Label = cc.Class({
*/
useSystemFont: {
get: function(){
if (this._sgNode) {
this._isSystemFontUsed = this._sgNode.isSystemFontUsed();
}
return this._isSystemFontUsed;
},
set: function(value){
this._isSystemFontUsed = value;
this._isSystemFontUsed = !!value;
if (value) {
this.font = null;
if (this._sgNode) {
this._sgNode.setSystemFontUsed(value);
this._sgNode.setFontFileOrFamily('Arial');
}
} else {
this.font = this._N$file
}
},
-14
View File
@@ -115,7 +115,6 @@ _ccsg.Label = _ccsg.Node.extend({
_spacingX: 0,
_blendFunc: null,
_isUseSystemFont: true,
_labelType: 0, //0 is ttf, 1 is bmfont.
_fontHandle: "", //a ttf font name or a bmfont file path.
_lineSpacing: 0,
@@ -176,18 +175,7 @@ _ccsg.Label = _ccsg.Node.extend({
this._spriteBatchNode = null;
}
},
isSystemFontUsed: function() {
return this._isUseSystemFont;
},
setSystemFontUsed: function(value) {
if (this._isUseSystemFont === value) return;
if (value) {
this.setFontFileOrFamily("Arial");
}
this._isUseSystemFont = value;
},
setHorizontalAlign: function(align) {
if (this._hAlign === align) return;
this._hAlign = align;
@@ -359,12 +347,10 @@ _ccsg.Label = _ccsg.Node.extend({
this._fontHandle = fontHandle;
this._labelType = _ccsg.Label.Type.SystemFont;
this._notifyLabelSkinDirty();
this._isUseSystemFont = true;
this.emit('load');
return;
}
this._isUseSystemFont = false;
if (extName === ".ttf") {
this._labelType = _ccsg.Label.Type.TTF;
this._fontHandle = this._loadTTFFont(fontHandle);
-12
View File
@@ -58,18 +58,6 @@ jsbLabel.prototype.getOverflow = function() {
return this._overFlow;
};
if (!jsbLabel.prototype.isSystemFontUsed) {
jsbLabel.prototype.isSystemFontUsed = function() {
return this._isSystemFontUsed;
};
jsbLabel.prototype.setSystemFontUsed = function(value) {
this._isSystemFontUsed = value;
this.setSystemFontName("Arial");
this.setSystemFontSize(this.getFontSize());
}
}
jsbLabel.prototype.setFontSize = function (size) {
this._fontSize = size;
if (this._labelType === _ccsg.Label.Type.SystemFont) {