Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
strokeText

strokeText method

Renders the specified text at the specified position by using the current ICanvasRenderingContext2D::font, ICanvasRenderingContext2D::lineWidth, and ICanvasRenderingContext2D::strokeStyle property.

HTML Canvas 2D Context, Section 11Internet Explorer 9

 

Syntax


object.strokeText(text, x, y, maxWidth);

Parameters

text [in]

Type: string

The text characters to paint on the canvas.

x [in]

Type: number

The horizontal coordinate to start painting the text relative to the canvas.

y [in]

Type: number

The vertical coordinate of the baseline for the text to start painting, relative to the canvas.

maxWidth [in, optional]

Type: number

The maximum possible text width. If the value is less than ICanvasTextMetrics::width, the text is scaled to fit.

Return value

This method does not return a value.

Exceptions

ExceptionCondition
SecurityError

The current ICanvasRenderingContext2D::font is not of the same origin or domain as the document that owns the canvas element.

 

Standards information

Remarks

ICanvasRenderingContext2D::strokeText can be used in conjunction with ICanvasRenderingContext2D::fillText to created filled and outlined text.

See also

ICanvasRenderingContext2D::fillText
ICanvasRenderingContext2D::lineWidth

 

 

Community Additions

ADD
Show:
© 2015 Microsoft