diff --git a/src/main/resources/templates/sign.html b/src/main/resources/templates/sign.html index 5b72dc30..7584a72b 100644 --- a/src/main/resources/templates/sign.html +++ b/src/main/resources/templates/sign.html @@ -210,12 +210,14 @@ select#font-select, select#font-select option { const textWidth = ctx.measureText(sigText).width; const textHeight = fontSize; - canvas.width = textWidth; - canvas.height = textHeight*1.35; //for tails - // ctx.font = `${fontSize / 2}px ${font}`; - ctx.font = `${fontSize / 2}px ${font}`; let paragraphs = sigText.split(/\r?\n/); + canvas.width = textWidth; + canvas.height = paragraphs.length * textHeight*1.35; //for tails + // ctx.font = `${fontSize / 2}px ${font}`; + ctx.font = `${fontSize}px ${font}`; + + ctx.textBaseline = 'top'; // let y = fontSize; @@ -227,10 +229,9 @@ select#font-select, select#font-select option { paragraphs.forEach(paragraph => { // ctx.letterSpacing = "50px"; ctx.fillText(paragraph, 0, y); - y += 24; + y += fontSize; }); - // ctx.fillText(sigText, 0, fontSize); const dataURL = canvas.toDataURL();