@@ -564,7 +564,7 @@ cc.LabelBMFont = cc.SpriteBatchNode.extend(/** @lends cc.LabelBMFont# */{
564564 if ( this . initWithTexture ( texture , theString . length ) ) {
565565 this . _alignment = alignment || cc . TEXT_ALIGNMENT_LEFT ;
566566 this . _imageOffset = imageOffset || cc . PointZero ( ) ;
567- this . _width = ( width == null ) ? cc . LabelAutomaticWidth : width ;
567+ this . _width = ( width == null ) ? cc . LabelAutomaticWidth : width ;
568568 this . _opacity = 255 ;
569569 this . _color = cc . white ( ) ;
570570 this . _contentSize = cc . SizeZero ( ) ;
@@ -628,18 +628,27 @@ cc.LabelBMFont = cc.SpriteBatchNode.extend(/** @lends cc.LabelBMFont# */{
628628 var fontChar = this . getChildByTag ( i ) ;
629629 if ( ! fontChar ) {
630630 fontChar = new cc . Sprite ( ) ;
631- if ( key == 32 ) {
631+ if ( key == 0 ) {
632+ //nothing to do
633+ }
634+ else if ( key == 32 ) {
632635 fontChar . init ( ) ;
633636 fontChar . setTextureRect ( cc . RectZero ( ) , false , cc . SizeZero ( ) ) ;
634- } else {
637+ }
638+ else {
635639 fontChar . initWithTexture ( this . _textureAtlas . getTexture ( ) , rect , false ) ;
636640 }
637641 this . addChild ( fontChar , 0 , i ) ;
638- } else {
639- if ( key == 32 ) {
642+ }
643+ else {
644+ if ( key == 0 ) {
645+ //nothing to do
646+ }
647+ else if ( key == 32 ) {
640648 fontChar . init ( ) ;
641649 fontChar . setTextureRect ( cc . RectZero ( ) , false , cc . SizeZero ( ) ) ;
642- } else {
650+ }
651+ else {
643652 // reusing fonts
644653 fontChar . initWithTexture ( this . _textureAtlas . getTexture ( ) , rect , false ) ;
645654 // restore to default in case they were modified
@@ -688,6 +697,7 @@ cc.LabelBMFont = cc.SpriteBatchNode.extend(/** @lends cc.LabelBMFont# */{
688697 }
689698 }
690699 }
700+
691701 if ( this . _configuration ) {
692702 this . createFontChars ( ) ;
693703 }
@@ -745,12 +755,11 @@ cc.LabelBMFont = cc.SpriteBatchNode.extend(/** @lends cc.LabelBMFont# */{
745755 while ( ! ( characterSprite = this . getChildByTag ( j + skip ) ) )
746756 skip ++ ;
747757
748- if ( ! characterSprite . isVisible ( ) ) continue ;
758+ // if (!characterSprite.isVisible()) continue;
749759 if ( i >= stringLength )
750760 break ;
751761
752762 var character = this . _string [ i ] ;
753-
754763 if ( ! start_word ) {
755764 startOfWord = this . _getLetterPosXLeft ( characterSprite ) ;
756765 start_word = true ;
@@ -843,14 +852,11 @@ cc.LabelBMFont = cc.SpriteBatchNode.extend(/** @lends cc.LabelBMFont# */{
843852
844853 j -- ;
845854 }
846-
847- continue ;
848855 }
849856 else {
850857 // Character is normal.
851858 last_word . push ( character ) ;
852859 i ++ ;
853- continue ;
854860 }
855861 }
856862
@@ -903,7 +909,7 @@ cc.LabelBMFont = cc.SpriteBatchNode.extend(/** @lends cc.LabelBMFont# */{
903909 index = i + j + lineNumber ;
904910 if ( index < 0 ) continue ;
905911 var characterSprite = this . getChildByTag ( index ) ;
906- if ( characterSprite ) {
912+ if ( characterSprite ) {
907913 characterSprite . setPosition ( cc . pAdd ( characterSprite . getPosition ( ) , cc . p ( shift , 0 ) ) ) ;
908914 }
909915 }
@@ -1049,8 +1055,8 @@ cc.LabelBMFont = cc.SpriteBatchNode.extend(/** @lends cc.LabelBMFont# */{
10491055 */
10501056cc . LabelBMFont . create = function ( str , fntFile , width , alignment , imageOffset ) {
10511057 var ret = new cc . LabelBMFont ( ) ;
1052- if ( arguments . length == 0 ) {
1053- if ( ret && ret . init ( ) ) {
1058+ if ( arguments . length == 0 ) {
1059+ if ( ret && ret . init ( ) ) {
10541060 return ret ;
10551061 }
10561062 return null ;
@@ -1113,7 +1119,7 @@ cc.isspace_unicode = function (ch) {
11131119} ;
11141120
11151121/**
1116- * @param {String } str
1122+ * @param {Array } str
11171123 */
11181124cc . utf8_trim_ws = function ( str ) {
11191125 var len = str . length ;
@@ -1140,7 +1146,7 @@ cc.utf8_trim_ws = function (str) {
11401146/**
11411147 * Trims str st str=[0, index) after the operation.
11421148 * Return value: the trimmed string.
1143- * @param {String } str he string to trim
1149+ * @param {Array } str he string to trim
11441150 * @param {Number } index the index to start trimming from.
11451151 */
11461152cc . utf8_trim_from = function ( str , index ) {
0 commit comments