Reputation: 2459
Afaik, you can only set the font for the WHOLE canvas.
var canvas = document.getElementById("canvas");
var ctx = canvas.getContext("2d");
ctx.font = "30px Arial"
I would like lets say, text1 to be "30px Arial" and text2 to be "10px Arial". Is this possible?
Upvotes: 1
Views: 2145
Reputation: 798
Yes, its is possible:
//first text
ctx.font = "30px Arial";
ctx.fillText("Hello World",10,50);
//second text
ctx.font = "20px Arial";
ctx.fillText("Bell World",50,100);
Upvotes: 8