Casually i would detect the width and height of a string by doing this..
canvas.getContext("2d").font="12px Arial";
canvas.getContext("2d").fillStyle = "red";
canvas.getContext("2d").fillText("StackOverflow",x,y);
var width = canvas.getContext('2d').measureText(ct_string).width;
however, i need to calculate the width before i draw it into the canvas so i can do this..
canvas.getContext("2d").fillText("StackOverflow",x - width,y);
Would love some help on this, maybe i am not understanding the measureText fully, i believe it can only be used after the string has been drawn to the canvas though i am not certain.
( i am programming without a server and can not test the code i am running ). Creating a second html5 canvas is out of the question.
I need a better understanding