diff --git a/common/changes/@visactor/vrender-core/fix-richtext-lineWidth_2024-11-20-07-02.json b/common/changes/@visactor/vrender-core/fix-richtext-lineWidth_2024-11-20-07-02.json new file mode 100644 index 000000000..39bade47c --- /dev/null +++ b/common/changes/@visactor/vrender-core/fix-richtext-lineWidth_2024-11-20-07-02.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@visactor/vrender-core", + "comment": "fix: fix issue where not work when lineWidth is set to 0", + "type": "none" + } + ], + "packageName": "@visactor/vrender-core" +} diff --git a/packages/vrender-core/src/graphic/richtext/paragraph.ts b/packages/vrender-core/src/graphic/richtext/paragraph.ts index edc3d8c11..50352ff04 100644 --- a/packages/vrender-core/src/graphic/richtext/paragraph.ts +++ b/packages/vrender-core/src/graphic/richtext/paragraph.ts @@ -209,7 +209,8 @@ export default class Paragraph { baseline = 0; } - if (this.character.stroke) { + const { lineWidth = 1 } = this.character; + if (this.character.stroke && lineWidth) { applyStrokeStyle(ctx, this.character); ctx.strokeText(text, left, baseline); }