Is there a way to only change the font size of a canvas context without having to know/write the font family.
var ctx = document.getElementById(\"canvas\").
Here is an easier and cleaner way of changing the font size that will work regardless if you are using font-variant or font-weight or not.
Assuming your new font size is 12px
ctx.font = ctx.font.replace(/\d+px/, "12px");
Or a nice one liner if you want to increase by 2 points:
ctx.font = ctx.font.replace(/\d+px/, (parseInt(ctx.font.match(/\d+px/)) + 2) + "px");