The strokeText function
The strokeText function adds outlined text to your canvas. It does not fill the text - for that you want the fillText function
The strokeText function is very similar to the fillText function - however it draws the outline of the text and doesn't fill it - as you can see from the example. In many use cases you can use the fillText function and ignore this entirely.
Arguments to the function
- The text to display
- The x-axis coordinate
- The y-axis coordinate
An example
<script>
window.onload = function ()
{
var canvas = document.getElementById("cvs");
var context = canvas.getContext('2d');
context.font = '36pt Arial';
context.strokeText('Some example text', 50, 50);
}
</script>
See also