fillText method
Renders filled text to the canvas by using the current ICanvasRenderingContext2D::fillStyle and font.
Syntax
object.fillText(text, x, y, maxWidth);
Parameters
text [in]
Type: stringThe text characters to paint on the canvas.
x [in]
Type: numberThe horizontal coordinate to start painting the text at, relative to the canvas.
y [in]
Type: numberThe vertical coordinate to start painting the text, relative to the canvas.
maxWidth [in, optional]
Type: numberThe 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.
Exceptions
Exception | Condition |
---|---|
SecurityError | The current font is not of the same origin or domain as the document that owns the canvas element. |
Standards information
- HTML Canvas 2D Context, Section 11