@@ -200,7 +200,7 @@ cc.LabelTTFCanvas = cc.Sprite.extend(/** @lends cc.LabelTTFCanvas# */{
200200 this . _fontName = fontName ;
201201 this . _hAlignment = hAlignment ;
202202 this . _vAlignment = vAlignment ;
203- this . _fontSize = fontSize * cc . CONTENT_SCALE_FACTOR ( ) ;
203+ this . _fontSize = fontSize ;
204204 this . _fontStyleStr = this . _fontSize + "px '" + this . _fontName + "'" ;
205205 this . _fontClientHeight = cc . LabelTTF . __getFontHeightByDiv ( this . _fontName , this . _fontSize ) ;
206206 this . setString ( strInfo ) ;
@@ -333,6 +333,7 @@ cc.LabelTTFCanvas = cc.Sprite.extend(/** @lends cc.LabelTTFCanvas# */{
333333 this . _fontSize = textDefinition . fontSize ;
334334 this . _fontStyleStr = this . _fontSize + "px '" + this . _fontName + "'" ;
335335
336+
336337 // shadow
337338 if ( textDefinition . shadowEnabled )
338339 this . enableShadow ( textDefinition . shadowOffset , textDefinition . shadowOpacity , textDefinition . shadowBlur , false ) ;
@@ -566,8 +567,9 @@ cc.LabelTTFCanvas = cc.Sprite.extend(/** @lends cc.LabelTTFCanvas# */{
566567 }
567568
568569 var locVAlignment = this . _vAlignment , locHAlignment = this . _hAlignment ,
569- locContentSizeWidth = this . _contentSize . width , locContentSizeHeight = this . _contentSize . height ;
570- var locFontHeight = this . _fontClientHeight ;
570+ locContentSizeWidth = this . _contentSize . width * cc . CONTENT_SCALE_FACTOR ( ) ,
571+ locContentSizeHeight = this . _contentSize . height * cc . CONTENT_SCALE_FACTOR ( ) ;
572+ var locFontHeight = this . _fontClientHeight * cc . CONTENT_SCALE_FACTOR ( ) ;
571573
572574 context . textBaseline = cc . LabelTTF . _textBaseline [ locVAlignment ] ;
573575 context . textAlign = cc . LabelTTF . _textAlign [ locHAlignment ] ;
@@ -670,6 +672,7 @@ cc.LabelTTFWebGL = cc.Sprite.extend(/** @lends cc.LabelTTFWebGL# */{
670672 _string :"" ,
671673 _isMultiLine :false ,
672674 _fontStyleStr :null ,
675+ _scaledFontStyleStr :null ,
673676 _colorStyleStr :null ,
674677
675678 // font shadow
@@ -702,6 +705,7 @@ cc.LabelTTFWebGL = cc.Sprite.extend(/** @lends cc.LabelTTFWebGL# */{
702705 this . _vAlignment = cc . VERTICAL_TEXT_ALIGNMENT_TOP ;
703706 this . _opacityModifyRGB = false ;
704707 this . _fontStyleStr = "" ;
708+ this . _scaledFontStyleStr = "" ;
705709 this . _colorStyleStr = "" ;
706710 this . _fontName = "Arial" ;
707711 this . _opacity = 255 ;
@@ -836,8 +840,9 @@ cc.LabelTTFWebGL = cc.Sprite.extend(/** @lends cc.LabelTTFWebGL# */{
836840 this . _fontName = fontName ;
837841 this . _hAlignment = hAlignment ;
838842 this . _vAlignment = vAlignment ;
839- this . _fontSize = fontSize * cc . CONTENT_SCALE_FACTOR ( ) ;
843+ this . _fontSize = fontSize ;
840844 this . _fontStyleStr = this . _fontSize + "px '" + this . _fontName + "'" ;
845+ this . _scaledFontStyleStr = this . _fontSize * cc . CONTENT_SCALE_FACTOR ( ) + "px '" + this . _fontName + "'" ;
841846 this . _fontClientHeight = cc . LabelTTF . __getFontHeightByDiv ( this . _fontName , this . _fontSize ) ;
842847 this . setString ( strInfo ) ;
843848 this . _updateTexture ( ) ;
@@ -986,6 +991,7 @@ cc.LabelTTFWebGL = cc.Sprite.extend(/** @lends cc.LabelTTFWebGL# */{
986991 this . _fontName = textDefinition . fontName ;
987992 this . _fontSize = textDefinition . fontSize || 12 ;
988993 this . _fontStyleStr = this . _fontSize + "px '" + this . _fontName + "'" ;
994+ this . _scaledFontStyleStr = this . _fontSize * cc . CONTENT_SCALE_FACTOR ( ) + "px '" + this . _fontName + "'" ;
989995 this . _fontClientHeight = cc . LabelTTF . __getFontHeightByDiv ( this . _fontName , this . _fontSize ) ;
990996
991997 // shadow
@@ -1006,6 +1012,7 @@ cc.LabelTTFWebGL = cc.Sprite.extend(/** @lends cc.LabelTTFWebGL# */{
10061012 _prepareTextDefinition :function ( adjustForResolution ) {
10071013 var texDef = new cc . FontDefinition ( ) ;
10081014
1015+ //Do these reference to CONTENT_SCALE_FACTOR need to be removed ?
10091016 if ( adjustForResolution ) {
10101017 texDef . fontSize = this . _fontSize * cc . CONTENT_SCALE_FACTOR ( ) ;
10111018 texDef . fontDimensions = cc . SIZE_POINTS_TO_PIXELS ( this . _dimensions ) ;
@@ -1107,6 +1114,7 @@ cc.LabelTTFWebGL = cc.Sprite.extend(/** @lends cc.LabelTTFWebGL# */{
11071114 if ( this . _fontSize != fontSize ) {
11081115 this . _fontSize = fontSize ;
11091116 this . _fontStyleStr = fontSize + "px '" + this . _fontName + "'" ;
1117+ this . _scaledFontStyleStr = this . _fontSize * cc . CONTENT_SCALE_FACTOR ( ) + "px '" + this . _fontName + "'" ;
11101118 this . _fontClientHeight = cc . LabelTTF . __getFontHeightByDiv ( this . _fontName , fontSize ) ;
11111119 // Force update
11121120 this . _needUpdateTexture = true ;
@@ -1121,6 +1129,7 @@ cc.LabelTTFWebGL = cc.Sprite.extend(/** @lends cc.LabelTTFWebGL# */{
11211129 if ( this . _fontName && this . _fontName != fontName ) {
11221130 this . _fontName = fontName ;
11231131 this . _fontStyleStr = this . _fontSize + "px '" + fontName + "'" ;
1132+ this . _scaledFontStyleStr = this . _fontSize * cc . CONTENT_SCALE_FACTOR ( ) + "px '" + this . _fontName + "'" ;
11241133 this . _fontClientHeight = cc . LabelTTF . __getFontHeightByDiv ( fontName , this . _fontSize ) ;
11251134 // Force update
11261135 this . _needUpdateTexture = true ;
@@ -1136,8 +1145,8 @@ cc.LabelTTFWebGL = cc.Sprite.extend(/** @lends cc.LabelTTFWebGL# */{
11361145
11371146 context . setTransform ( 1 , 0 , 0 , 1 , 0 , locContentSizeHeight ) ;
11381147 //this is fillText for canvas
1139- if ( context . font != this . _fontStyleStr )
1140- context . font = this . _fontStyleStr ;
1148+ if ( context . font != this . _scaledFontStyleStr )
1149+ context . font = this . _scaledFontStyleStr ;
11411150 context . fillStyle = this . _fillColorStr ;
11421151
11431152 //stroke style setup
@@ -1335,8 +1344,8 @@ cc.LabelTTFWebGL = cc.Sprite.extend(/** @lends cc.LabelTTFWebGL# */{
13351344 this . _labelContext . font = this . _fontStyleStr ;
13361345 this . _updateTTF ( ) ;
13371346 var width = this . _contentSize . width , height = this . _contentSize . height ;
1338- this . _labelCanvas . width = width ;
1339- this . _labelCanvas . height = height ;
1347+ this . _labelCanvas . width = width * cc . CONTENT_SCALE_FACTOR ( ) ;
1348+ this . _labelCanvas . height = height * cc . CONTENT_SCALE_FACTOR ( ) ; ;
13401349
13411350 //draw text to labelCanvas
13421351 this . _drawTTFInCanvasForWebGL ( this . _labelContext ) ;
0 commit comments