Reputation: 1151
I have the following code to draw text
ctx.fillStyle="red";
ctx.fillRect(player.x, player.y, 10, 10);
ctx.fillStyle="white";
ctx.font="bold 20px sans-serif"
ctx.fillText(player.name,player.x,player.y)
Unfortunately, it looks horrible. Really blocky.
I attempted to shrink it down to 10px, which is the size of the red box, but then it looks even worse. What am I doing wrong?
Upvotes: 0
Views: 314
Reputation: 8134
Is the canvas getting scaled by CSS by any chance? If so, that would stretch the text because it is being written to an on-screen bitmap vs directly embedded.
Upvotes: 4