From b3ead0b2ce7755b30b337fae6c983d7d4bcc8042 Mon Sep 17 00:00:00 2001 From: plainheart Date: Sat, 22 May 2021 15:28:32 +0800 Subject: [PATCH] fix(svg): use textBaseline specified in text style instead of fixed default value. --- src/svg/graphic.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/svg/graphic.ts b/src/svg/graphic.ts index ed3921bb2..9e832e32f 100644 --- a/src/svg/graphic.ts +++ b/src/svg/graphic.ts @@ -414,13 +414,13 @@ const svgText: SVGProxy = { setTransform(textSvgEl, el.transform); // Consider different font display differently in vertial align, we always - // set vertialAlign as 'middle', and use 'y' to locate text vertically. + // set verticalAlign as 'middle', and use 'y' to locate text vertically. const x = style.x || 0; const y = adjustTextY(style.y || 0, getLineHeight(font), style.textBaseline); const textAlign = TEXT_ALIGN_TO_ANCHOR[style.textAlign as keyof typeof TEXT_ALIGN_TO_ANCHOR] || style.textAlign; - attr(textSvgEl, 'dominant-baseline', 'central'); + attr(textSvgEl, 'dominant-baseline', style.textBaseline || 'central'); attr(textSvgEl, 'text-anchor', textAlign); attr(textSvgEl, 'x', x + ''); attr(textSvgEl, 'y', y + '');