From 1548c75a3d9ca950bf1fdd880d097e9ba07efeaa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A6=86=E6=9F=B3=E6=9D=BE?= Date: Thu, 2 Sep 2021 17:12:12 +0800 Subject: [PATCH] [fix]The problem of inaccurate maximum width limit when using system fonts. --- cocos/2d/CCLabel.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cocos/2d/CCLabel.cpp b/cocos/2d/CCLabel.cpp index f343284854..b501d4ff0a 100644 --- a/cocos/2d/CCLabel.cpp +++ b/cocos/2d/CCLabel.cpp @@ -2391,7 +2391,7 @@ FontDefinition Label::_getFontDefinition() const systemFontDef._fontSize = _systemFontSize; systemFontDef._alignment = _hAlignment; systemFontDef._vertAlignment = _vAlignment; - systemFontDef._dimensions.width = _labelWidth; + systemFontDef._dimensions.width = _labelWidth == 0.f ? _maxLineWidth : _labelWidth; systemFontDef._dimensions.height = _labelHeight; systemFontDef._fontFillColor.r = _textColor.r; systemFontDef._fontFillColor.g = _textColor.g;