Syntax error HTML5 Canvas Text Stroke for Large Font Size

HTML5 Canvas Text Stroke for Large Font Size



To draw large font properly in HTML5 Canvas, you can try to run the following code −

var myCanvas = document.getElementById("myCanvas");
var context = myCanvas.getContext("2d");

context.font = '180pt Georgia';
context.strokeStyle = "#FF0000";
context.fillStyle = "#FFFFFF ";
context.lineWidth = 34;

context.fillText("Demo!",0,200);
context.strokeText("Demo!",0,200);
Updated on: 2020-06-25T07:42:11+05:30

266 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements