fillText

Jump to: navigation, search

fillText

This page has been flagged with the following issues:

High-level issues:


W3C Candidate Recommendation

Summary

Renders the given text at the given (x, y) coordinates, ensuring that the text isn't wider than maxWidth (if specified), using the current font, textAlign, and textBaseline values.

Method of apis/canvas/CanvasRenderingContext2D

Syntax

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

Parameters

text

Data-type: String


The text characters to paint on the canvas.


x

Data-type: Number


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


y

Data-type: Number


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


maxWidth

Data-type: Number Optional

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

Return Value

Returns an object of type DOM Node.

Type: HRESULT

This method can return one of these values.

Return code Description
S_OK The operation completed successfully.
SecurityError The current font is not of the same origin or domain as the document that owns the canvas element.

Needs Examples: This section should include examples.



Related specifications

Specification Status Related Changes
W3C HTML Canvas 2D Specification W3C Candidate Recommendation

Compatibility

Desktop

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic Support 22.0
15.0
9.0
12.1
5.1

Mobile

Feature Android BlackBerry Chrome for mobile Firefox Mobile (Gecko) IE Mobile Opera Mobile Opera Mini Safari Mobile
Basic Support 2.1
7.0
?
?
?
?
5.0-7.0 (partial)
3.2

Attribution

This article contains content originally from external sources.

Portions of this content come from the Microsoft Developer Network: Windows Internet Explorer API reference Article