Verified Commit 759f240d authored by Thibaut Broggi's avatar Thibaut Broggi
Browse files

Fix bug on random font on firefox

parent 3f100076
......@@ -44,16 +44,6 @@ let draw = function() {
ctx.fillRect(0, 0, canvas.width, canvas.height);
ctx.fill();
// Write text
ctx.font = fontSize + 'pt FiraSans';
ctx.fillStyle = 'white';
ctx.textBaseline = 'top';
ctx.fillText('Internet,', width * 0.08, height * 0.2);
ctx.fillText('et libertés.', width * 0.08, height * 0.2 + fontSize * 2.8);
ctx.font = fontSize + 'pt ' + font;
ctx.fillStyle = fgColor;
ctx.fillText(fillText, width * 0.08, height * 0.2 + fontSize * 1.4);
// Add footer
ctx.fillStyle = 'white';
ctx.fillRect(0, height * 0.85, width, height * 0.15);
......@@ -86,6 +76,16 @@ let draw = function() {
img.src = 'data:image/svg+xml;base64,' + btoa(imgXml);
img.addEventListener('load', function() {
ctx.drawImage(img, 0, 0);
// Write text
ctx.font = fontSize + 'pt FiraSans';
ctx.fillStyle = 'white';
ctx.textBaseline = 'top';
ctx.fillText('Internet,', width * 0.08, height * 0.2);
ctx.fillText('et libertés.', width * 0.08, height * 0.2 + fontSize * 2.8);
ctx.font = fontSize + 'pt ' + font;
ctx.fillStyle = fgColor;
ctx.fillText(fillText, width * 0.08, height * 0.2 + fontSize * 1.4);
document.querySelector('#save-image').href = canvas.toDataURL();
}, false);
});
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment