Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

fillText method

Renders filled text to the canvas by using the current ICanvasRenderingContext2D::fillStyle and font.

HTML Canvas 2D Context, Section 11Internet Explorer 9


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


text [in]

Type: string

The text characters to paint on the canvas.

x [in]

Type: number

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

y [in]

Type: number

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

maxWidth [in, optional]

Type: number

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

Return value

This method does not return a value.



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

Standards information

See also




Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

© 2014 Microsoft. All rights reserved.