@@ -923,13 +923,12 @@ document.body ?
923923 * @private
924924 */
925925cc . LabelTTF . __getFontHeightByDiv = function ( fontName , fontSize ) {
926-
926+ var clientHeight , labelDiv = cc . LabelTTF . __labelHeightDiv ;
927927 if ( fontName instanceof cc . FontDefinition ) {
928928 /** @type cc.FontDefinition */
929929 var fontDef = fontName ;
930- var clientHeight = cc . LabelTTF . __fontHeightCache [ fontDef . _getCanvasFontStr ( ) ] ;
930+ clientHeight = cc . LabelTTF . __fontHeightCache [ fontDef . _getCanvasFontStr ( ) ] ;
931931 if ( clientHeight > 0 ) return clientHeight ;
932- var labelDiv = cc . LabelTTF . __labelHeightDiv ;
933932 labelDiv . innerHTML = "ajghl~!" ;
934933 labelDiv . style . fontFamily = fontDef . fontName ;
935934 labelDiv . style . fontSize = fontDef . fontSize + "px" ;
@@ -939,19 +938,18 @@ cc.LabelTTF.__getFontHeightByDiv = function (fontName, fontSize) {
939938 clientHeight = labelDiv . clientHeight ;
940939 cc . LabelTTF . __fontHeightCache [ fontDef . _getCanvasFontStr ( ) ] = clientHeight ;
941940 labelDiv . innerHTML = "" ;
942- return clientHeight ;
943941 }
944-
945- //Default
946- var clientHeight = cc . LabelTTF . __fontHeightCache [ fontName + "." + fontSize ] ;
947- if ( clientHeight > 0 ) return clientHeight ;
948- var labelDiv = cc . LabelTTF . __labelHeightDiv ;
949- labelDiv . innerHTML = "ajghl~!" ;
950- labelDiv . style . fontFamily = fontName ;
951- labelDiv . style . fontSize = fontSize + "px" ;
952- clientHeight = labelDiv . clientHeight ;
953- cc . LabelTTF . __fontHeightCache [ fontName + "." + fontSize ] = clientHeight ;
954- labelDiv . innerHTML = "" ;
942+ else {
943+ //Default
944+ clientHeight = cc . LabelTTF . __fontHeightCache [ fontName + "." + fontSize ] ;
945+ if ( clientHeight > 0 ) return clientHeight ;
946+ labelDiv . innerHTML = "ajghl~!" ;
947+ labelDiv . style . fontFamily = fontName ;
948+ labelDiv . style . fontSize = fontSize + "px" ;
949+ clientHeight = labelDiv . clientHeight ;
950+ cc . LabelTTF . __fontHeightCache [ fontName + "." + fontSize ] = clientHeight ;
951+ labelDiv . innerHTML = "" ;
952+ }
955953 return clientHeight ;
956954
957955} ;
0 commit comments