diff --git a/src/renderer/renderElement.ts b/src/renderer/renderElement.ts index 919fb99a0..d39b9fbb6 100644 --- a/src/renderer/renderElement.ts +++ b/src/renderer/renderElement.ts @@ -1295,7 +1295,6 @@ export const renderElementToSvg = ( ); const lines = element.text.replace(/\r\n?/g, "\n").split("\n"); const lineHeight = element.height / lines.length; - const verticalOffset = element.height; const horizontalOffset = element.textAlign === "center" ? element.width / 2 @@ -1313,13 +1312,14 @@ export const renderElementToSvg = ( const text = svgRoot.ownerDocument!.createElementNS(SVG_NS, "text"); text.textContent = lines[i]; text.setAttribute("x", `${horizontalOffset}`); - text.setAttribute("y", `${(i + 1) * lineHeight - verticalOffset}`); + text.setAttribute("y", `${i * lineHeight}`); text.setAttribute("font-family", getFontFamilyString(element)); text.setAttribute("font-size", `${element.fontSize}px`); text.setAttribute("fill", element.strokeColor); text.setAttribute("text-anchor", textAnchor); text.setAttribute("style", "white-space: pre;"); text.setAttribute("direction", direction); + text.setAttribute("dominant-baseline", "text-before-edge"); node.appendChild(text); } root.appendChild(node);