Specifies a DOMString specifying the text string to render into the context.
Specifies the x-axis coordinate of the point at which to begin drawing the text, in pixels.
Specifies the y-axis coordinate of the point at which to begin drawing the text, in pixels.
Specifies the maximum number of pixels wide the text may be once rendered.
How to stroke the Text
To stroke the text, follow these steps
canvas - Assigning the canvas element to a variable.
ctx - Assigning the 2d rendering context to another variable by calling the getContext('2d') method.
font - Use font canvas property to specify the current text style to use when drawing text.
strokeText - Use strokeText() canvas method to draw the outlines of the characters of a text string at the specified coordinates, stroking the string's characters with the current strokeStyle. The default strokeStyle color is 'black'.
HTML Online Editor
Your browser does not support the canvas element.
ctx.strokeText("Hello World", 2, 30);