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:
Tianze-Chen
2026-09-20 17:27:24 +08:00
committed by GitHub
parent 82f13c86e9
commit b4bea55859
+1 -1
View File
@@ -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);