From cbafbf8a37640a47feb2c2d40615f87ccbf7c1a9 Mon Sep 17 00:00:00 2001 From: knoxHuang <821686174@qq.com> Date: Mon, 12 Feb 2018 11:25:56 +0800 Subject: [PATCH] fix label display error for fireball/issues/6894 --- cocos2d/core/label/CCSGLabelCanvasRenderCmd.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cocos2d/core/label/CCSGLabelCanvasRenderCmd.js b/cocos2d/core/label/CCSGLabelCanvasRenderCmd.js index 9a0ed54f7b..3902eb1402 100644 --- a/cocos2d/core/label/CCSGLabelCanvasRenderCmd.js +++ b/cocos2d/core/label/CCSGLabelCanvasRenderCmd.js @@ -288,8 +288,8 @@ } canvasSizeY = this._splitedStrings.length * this._getLineHeight(); - this._canvasSize.width = parseFloat(canvasSizeX.toFixed(2)) + 2 * this._getMargin(); - this._canvasSize.height = parseFloat(canvasSizeY.toFixed(2)); + this._canvasSize.width = Math.round(canvasSizeX.toFixed(2)) + 2 * this._getMargin(); + this._canvasSize.height = Math.round(canvasSizeY.toFixed(2)); if(node._isItalic) { //0.0174532925 = 3.141592653 / 180 this._canvasSize.width += node._drawFontsize * Math.tan(12 * 0.0174532925);