mirror of
https://github.com/Frooodle/Stirling-PDF.git
synced 2024-12-21 19:08:24 +01:00
WIP: Letters are now inside canvas, and multiline support is functional. There is a small bug where when there are a lot of multiple lines, the font gets smaller.
This commit is contained in:
parent
a71e813e82
commit
b0f8f56650
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user