mirror of
https://github.com/cocos/cocos4.git
synced 2026-11-19 14:52:40 +08:00
fix(label): abnormal font display when label text is too long (#348)
A very long label string (e.g. 8000+ characters) makes the text layout canvas exceed MAX_SIZE, so the font is meant to be scaled down by the shrink ratio. Clamping _fontScale to a minimum of 1 defeated that downscale and the text displayed abnormally; lower the floor to 0.1 so the font can shrink with the canvas. Fixes #344 Co-authored-by: ctz <ctz@ctzdeMacBook-Air.local> Co-authored-by: Claude Code <noreply@anthropic.com>
This commit is contained in:
@@ -115,7 +115,7 @@ export class TextProcessing {
|
||||
const maxValue = Math.max(outputLayoutData.canvasSize.width, outputLayoutData.canvasSize.height);
|
||||
const canvasScaleToMaxSizeRatio = MAX_SIZE / maxValue;
|
||||
this._fontScale *= canvasScaleToMaxSizeRatio;
|
||||
this._fontScale = Math.max(1, this._fontScale);
|
||||
this._fontScale = Math.max(0.1, this._fontScale);
|
||||
}
|
||||
|
||||
this._updatePaddingRect(style, outputLayoutData);
|
||||
|
||||
Reference in New Issue
Block a user