JavaScript canvas2d object method: strokeText()
[this page | pdf | back links]
The strokeText() method of the JavaScript
DOM object
returned by the getContext("2d")
method applied to the HTML <canvas>
element draws text that is not ‘filled’ (i.e. it only draws the edges of the
characters). The default colour is black, but can be overridden using the strokeStyle
property.
It has the following
syntax with the following parameters.
context.strokeText(text, x, y, maxwidth)
|
Parameter
|
Required / Optional
|
Description
|
|
text
|
Required
|
String specifying text
|
|
x
|
Required
|
x-coordinate of
upper-left corner (relative to canvas)
|
|
y
|
Required
|
y-coordinate of
upper-left corner (relative to canvas)
|
|
maxwidth
|
Optional
|
Maximum width, in
pixels
|
NAVIGATION LINKS
Contents | Prev | Next | JavaScript DOM (and BOM)