The default font formatting provided by the fillText and strokeText methods isn’t very aesthetically appealing. Fortunately the canvas API provides properties for formatting text.

Using the font property you can specify:

For example:

ctx.font = "italic small-caps bold 40px Helvetica, Arial, sans-serif";
ctx.fillText("My text", 20, 50);

Result:

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/5f0f92d9-2a29-4c79-a752-7472667f1cc7/Untitled.png

Using the textAlign property you can also change text alignment to either:

For example:

ctx.textAlign = "center";