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
2dfdfe37
Verified
Commit
2dfdfe37
authored
Sep 26, 2017
by
Thibaut Broggi
Browse files
Fix text on generated image
parent
c6e56619
Changes
1
Hide whitespace changes
Inline
Side-by-side
canvas.js
View file @
2dfdfe37
...
...
@@ -31,11 +31,12 @@ let draw = function() {
ctx
.
fill
();
// Write text
ctx
.
font
=
fontSize
+
'
px
'
+
font
;
ctx
.
font
=
fontSize
+
'
px
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
);
ctx
.
font
=
fontSize
+
'
px
'
+
font
;
ctx
.
fillStyle
=
fgColor
;
ctx
.
fillText
(
fillText
,
width
*
0.08
,
height
*
0.2
+
fontSize
);
...
...
@@ -53,18 +54,18 @@ let draw = function() {
ctx
.
fillStyle
=
'
white
'
;
ctx
.
fillRect
(
0
,
height
*
0.85
,
width
,
height
*
0.15
);
ctx
.
fill
();
ctx
.
font
=
'
16px
Arial
'
;
ctx
.
fillStyle
=
'
blue
'
;
ctx
.
font
=
'
16px
FiraSans
'
;
ctx
.
fillStyle
=
'
#497ed5
'
;
let
offset
=
height
*
0.05
;
ctx
.
fillText
(
'
Faites comme
'
,
offset
,
height
*
0.9
);
offset
+=
ctx
.
measureText
(
'
Faites comme
'
).
width
;
ctx
.
font
=
'
bold 16px
Arial
'
;
ctx
.
font
=
'
bold 16px
FiraSans
'
;
ctx
.
fillText
(
signature
,
offset
,
height
*
0.9
);
offset
+=
ctx
.
measureText
(
signature
).
width
;
ctx
.
font
=
'
16px
Arial
'
;
ctx
.
font
=
'
16px
FiraSans
'
;
ctx
.
fillText
(
'
, soutenez
'
,
offset
,
height
*
0.9
);
offset
+=
ctx
.
measureText
(
'
, soutenez
'
).
width
;
ctx
.
font
=
'
bold 16px
Arial
'
;
ctx
.
font
=
'
bold 16px
FiraSans
'
;
ctx
.
fillText
(
'
La Quadrature du Net !
'
,
offset
,
height
*
0.9
);
}
...
...
Write
Preview
Markdown
is supported
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