src/font/text.js
function (renderer, text, x, y, stroke) {
            // "hacky patch" for backward compatibilty
            if (typeof this.ancestor === "undefined") {
                // update text cache
                this.setText(text);

                // update position if changed
                if (this.pos.x !== x || this.pos.y !== y) {
                    this.pos.x = x;
                    this.pos.y = y;
                    this.isDirty = true;
                }

                // force update bounds
                this.update(0);

                // save the previous context
                renderer.save();

                // apply the defined alpha value
                renderer.setGlobalAlpha(renderer.globalAlpha() * this.getOpacity());

            } else {
                // added directly to an object container
                x = this.pos.x;
                y = this.pos.y;
            }

            if (renderer.settings.subPixel === false) {
                // clamp to pixel grid if required
                x = ~~x;
                y = ~~y;
            }

            // draw the text
            renderer.drawFont(this._drawFont(renderer.getFontContext(), this._text, x, y, stroke || false));

            // for backward compatibilty
            if (typeof this.ancestor === "undefined") {
                // restore previous context
                renderer.restore();
            }

            // clear the dirty flag
            this.isDirty = false;
        }
function (renderer, text, x, y, stroke) {
            // "hacky patch" for backward compatibilty
            if (typeof this.ancestor === "undefined") {
                // update text cache
                this.setText(text);

                // update position if changed
                if (this.pos.x !== x || this.pos.y !== y) {
                    this.pos.x = x;
                    this.pos.y = y;
                    this.isDirty = true;
                }

                // force update bounds
                this.update(0);

                // save the previous context
                renderer.save();

                // apply the defined alpha value
                renderer.setGlobalAlpha(renderer.globalAlpha() * this.getOpacity());

            } else {
                // added directly to an object container
                x = this.pos.x;
                y = this.pos.y;
            }

            if (renderer.settings.subPixel === false) {
                // clamp to pixel grid if required
                x = ~~x;
                y = ~~y;
            }

            // draw the text
            renderer.drawFont(this._drawFont(renderer.getFontContext(), this._text, x, y, stroke || false));

            // for backward compatibilty
            if (typeof this.ancestor === "undefined") {
                // restore previous context
                renderer.restore();
            }

            // clear the dirty flag
            this.isDirty = false;
        }
function ( renderer , text , x , y , stroke ) { // "hacky patch" for backward compatibilty if ( typeof this . ancestor === "undefined" ) { // update text cache this . setText ( text ) ; // update position if changed if ( this . pos . x !== x || this . pos . y !== y ) { this . pos . x = x ; this . pos . y = y ; this . isDirty = true ; } // force update bounds this . update ( 0 ) ; // save the previous context renderer . save ( ) ; // apply the defined alpha value renderer . setGlobalAlpha ( renderer . globalAlpha ( ) * this . getOpacity ( ) ) ; } else { // added directly to an object container x = this . pos . x ; y = this . pos . y ; } if ( renderer . settings . subPixel === false ) { // clamp to pixel grid if required x = ~ ~ x ; y = ~ ~ y ; } // draw the text renderer . drawFont ( this . _drawFont ( renderer . getFontContext ( ) , this . _text , x , y , stroke || false ) ) ; // for backward compatibilty if ( typeof this . ancestor === "undefined" ) { // restore previous context renderer . restore ( ) ; } // clear the dirty flag this . isDirty = false ; }
draw a text at the specified coord
@name draw
@memberOf me.Text.prototype
@function
@param {me.CanvasRenderer|me.WebGLRenderer} renderer Reference to the destination renderer instance
@param {String} [text]
@param {Number} [x]
@param {Number} [y]
draw a text at the specified coord