/**
 * @author mrdoob / http://mrdoob.com/
 * @author zz85 / http://github.com/zz85
 * @author alteredq / http://alteredqualia.com/
 */

THREE.TextGeometry = function (text, parameters) {

    this.type = 'TextGeometry';

    this.parameters = {
        text: text,
        parameters: parameters
    };

    var font = parameters.font;

    if (!(font && font.isFont)) {

        console.error('THREE.TextGeometry: font parameter is not an instance of THREE.Font.');
        return new THREE.Geometry();

    }

    var shapes = font.generateShapes(text, parameters.size);

    // translate parameters to ExtrudeGeometry API

    parameters.depth = parameters.height !== undefined ? parameters.height : 50;

    // defaults

    if (parameters.bevelThickness === undefined) parameters.bevelThickness = 10;
    if (parameters.bevelSize === undefined) parameters.bevelSize = 8;
    if (parameters.bevelEnabled === undefined) parameters.bevelEnabled = false;

    THREE.ExtrudeGeometry.call(this, shapes, parameters);

};

THREE.TextGeometry.prototype = Object.create(THREE.ExtrudeGeometry.prototype);
THREE.TextGeometry.prototype.constructor = THREE.TextGeometry;