HTML5 Canvas Text Stroke Tutorial

To set the stroke color of text using HTML5 Canvas, we can set the strokeStyle property of the canvas context to a color string, hex value, or RGB value, and then use the strokeText() method to stroke the text.

Note: To set both the fill and stroke for HTML5 canvas text, you must use both the fillText() and strokeText() methods together. It’s good practice to use the fillText() method before the strokeText() method in order to render the stroke thickness correctly.

new window

Code Editor

Modified on April 8th, 2013 by Eric Rowell
comments powered by Disqus