fillText method

void fillText(
  1. String text,
  2. num x,
  3. num y, [
  4. num maxWidth,
])

The CanvasRenderingContext2D method fillText(), part of the Canvas 2D API, draws a text string at the specified coordinates, filling the string's characters with the current CanvasRenderingContext2D.fillStyle. An optional parameter allows specifying a maximum width for the rendered text, which the will achieve by condensing the text or by using a lower font size.

This method draws directly to the canvas without modifying the current path, so any subsequent CanvasRenderingContext2D.fill or CanvasRenderingContext2D.stroke calls will have no effect on it.

The text is rendered using the font and text layout configuration as defined by the CanvasRenderingContext2D.font, CanvasRenderingContext2D.textAlign, CanvasRenderingContext2D.textBaseline, and CanvasRenderingContext2D.direction properties.

Note: To draw the outlines of the characters in a string, call the context's CanvasRenderingContext2D.strokeText method.

Implementation

external void fillText(
  String text,
  num x,
  num y, [
  num maxWidth,
]);