1๐
โ
I think the calculation of textX
is not correct.
EDIT: codepen: https://codepen.io/stockinail/pen/vYjJbKp
Try with:
textX = width - Math.round((width - ctx.measureText(text).width) / 2),
Source:stackexchange.com