Description

Returns an object that contains the width and height (only >=1.3.2) of the specified text

Usage

Parameters

  • txt {String}

    Text

  • font_size {String} optional

    (optional) Font Size (default 12px);

  • font_family {String} optional

    (optional) Font Family (default Arial);

Example

In method "ready" of the scene :

var _canvas = this.getCanvas();
var size = _canvas.measureText("Hello World");

console.log(size.with, size.height);

Discussion