Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
LQDN Adminsys
generateur-slogans
Commits
759f240d
Verified
Commit
759f240d
authored
Oct 02, 2017
by
Thibaut Broggi
Browse files
Fix bug on random font on firefox
parent
3f100076
Changes
1
Hide whitespace changes
Inline
Side-by-side
canvas.js
View file @
759f240d
...
...
@@ -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
);
});
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment