float FontManager::textHeight( const std::string& text, float textBoxWidth )
	{
		// Check we have a font
		if ( !isValid() )
		{
			LOG_ERROR( "FontManager::textWidth. FontManager is not Valid or not Initialized. Maybe there is no active font set? Call textFont to set the active font" );
			return 0.0f;
		}

		// Check empty text case
		if ( text == "" )
			return 0.0f;

		// TODO: this is not the ideal way to calculate this (it should just be on the font class, but for now)
		MovableText* newText = getNewText();

		// Font properties
		newText->setFontName( m_activeFontProperties.fontName );
		newText->setCharacterHeight( m_activeFontProperties.size );
		newText->setLeading( m_activeFontProperties.leading );
		newText->setColor( GraphicsManager::getSingleton().getFillColor().normalized() );
		newText->setTextAreaWidth( m_activeFontProperties.width );
		newText->setTextAreaHeight( m_activeFontProperties.height );
		newText->setTextAlignment(m_activeFontProperties.halign, m_activeFontProperties.valign);
		newText->setCaption( m_activeFontProperties.text.toChar() );

		// Get the height
		float textHeigh = newText->getTextBlockHeightPixels( text, textBoxWidth );

		// Make the text invisible again just in case (This is related with the TODO, it should be calculated by the Font class)
		newText->show(false);
		
		return textHeigh;
	}
	/**
	* @brief Add a text to be render queue with the current properties set by user calls
	*/
	void FontManager::addText()
	{
		// Check the manager is ok
		if ( !isValid() )
		{
			LOG_ERROR( "text error: FontManager not properly initialized. The init method has not been called or there are no active font" );
			return;
		}

		// Add a new font (to be rendered later)
		MovableText* newText = getNewText();

		// Font properties
		newText->setFontName( m_activeFontProperties.fontName );
		newText->setCharacterHeight( m_activeFontProperties.size );
		newText->setLeading( m_activeFontProperties.leading );
		newText->setColor( GraphicsManager::getSingleton().getFillColor().normalized() );
		newText->setTextAreaWidth( m_activeFontProperties.width );
		newText->setTextAreaHeight( m_activeFontProperties.height );
		newText->setTextAlignment(m_activeFontProperties.halign, m_activeFontProperties.valign);
		newText->setCaption( m_activeFontProperties.text.toUTF() );
		newText->setWordWrap( m_activeFontProperties.wordWrap );

		// Text display properties
		newText->showOnTop();
		newText->setAlwaysFaceCamera( false );
		newText->show();

		// Get global transformation
		Transform &t = GraphicsManager::getSingleton().m_transforms.top();

		// Font Position
		Vector fontPos( m_activeFontProperties.x, m_activeFontProperties.y, m_activeFontProperties.z );
		Vector transformedPos = t.getPosition() + fontPos;
		Vector scale = t.getScale();

		// Control current coordinate system
		if ( GraphicsManager::getSingleton().isProcessingMode() )
		{
			if ( m_activeFontProperties.render2d )
			{
				newText->setPosition( transformedPos.x, height - transformedPos.y );	
				newText->setScale( scale.x, -scale.y );
			}
			else
			{
				newText->setPosition( transformedPos );	
				newText->setScale( scale.x, -scale.y, scale.z );
			}
			
			newText->getParentNode()->setOrientation( t.getRotQuaternion().Inverse() );
		}
		else
		{
			if ( m_activeFontProperties.render2d )
			{
				newText->setPosition( transformedPos.x, transformedPos.y );	
				newText->setScale( scale.x, scale.y );
			}
			else
			{
				newText->setPosition( transformedPos );	
				newText->setScale( scale );
			}

			newText->getParentNode()->setOrientation( t.getRotQuaternion() );
		}

		// Setup text geometry for render
		newText->_setupGeometry();
	}