void ofxBlackText::loadTextFrom(const string& path){
	ifstream	fs( ofToDataPath(path).c_str());
	
	if (fs.is_open()){ // agregar font != NULL
		string palabra;
		vector <string> palabras;
		palabras.clear();
		
		// Load the data to a temporal vector call ´file´
		while(!(fs >> palabra).fail())
			palabras.push_back(palabra);
		fs.close();
		
		wordBlock tmpWord;
		for (int i = 0; i < palabras.size(); i++){
			tmpWord.rawWord = palabras[i];
			tmpWord.width   = defaultFont->stringWidth(tmpWord.rawWord);
			tmpWord.height  = defaultFont->stringHeight(tmpWord.rawWord);
			tmpWord.color.r = tmpWord.color.g = tmpWord.color.b = 255;
			words.push_back(tmpWord);
			//add spaces into the words vector if it is not the last word.
			if (i != palabras.size()) words.push_back(blankSpaceWord);
		}
			
		for(int i=0;i < words.size(); i++)
			ofLog(OF_LOG_VERBOSE, "Loaded word: %i, %s\n", i, words[i].rawWord.c_str());
		
		wrapTextForceLines(1);
		wrapTextX(width);
			
		// Setea el largo
		height = getTextHeight();
	}
//PEND not updated to new system yet
bool ofxTextObject::wrapTextForceLines(int linesN)
{
    if (words.size() > 0) {
        
        if (linesN > words.size()) linesN = words.size();
        
        float lineWidth = _getWidthOfWords() * (1.1f / (float)linesN);
        
        int curLines = 0;
        bool bGotLines = false;	//soso
        
        //keep increasing the line width until we get the desired number of lines.
        while (!bGotLines) {
            
            //curLines = wrapTextX(lineWidth);
            curLines = wrapTextX(lineWidth);
            if (curLines == linesN) return true;
            if (curLines > linesN) return false;
            lineWidth-=10;
			columnWidth = lineWidth; //soso
            
        }
        
        renderDirty = true;
		return true;	//soso
    }
	else return false; //soso
}
//with scale of ofxTextObject set to 1.0, this is the pointSize of the text
void ofxTextObject::setPointSize(float iPointSize)
{
    pointSize = iPointSize; 
    //scale factor is used to make the pointsize agnostic to the font resolution
    scaleFactor = iPointSize/font->getSize();
    
    wrapTextX(columnWidth);
}
void ofxTextObject::setSpaceWidth(float iWidth)
{    
    blankSpaceWord.width = iWidth;
	for(unsigned int i=0; i < words.size(); i++){
		if(words[i].rawWord == blankSpaceWord.rawWord){
			words[i].width = iWidth;
		}
	}
	wrapTextX(columnWidth);      
	
}
void ofxTextObject::setString(char *iString)
{	
    rawText = iString;	//PEND does string clean itself up when you use the = operator to reassign it?    

	//replace any Named Entities (i.e. &amp;) within the [0,255] range with their appropriate unicode characters
	ofxSosoTrueTypeFont::replaceNamedEntities(rawText);

	_loadWords();
	
	wrapTextX(columnWidth);
	renderDirty = true;	
}
bool ofxTextBlock::wrapTextForceLines(int linesN){

    if (words.size() > 0) {

        if (linesN > words.size()) linesN = words.size();

        float lineWidth = _getWidthOfWords() * (1.1f / (float)linesN);

        int curLines = 0;
        bool bGotLines;

        //keep increasing the line width until we get the desired number of lines.
        while (!bGotLines) {

            curLines = wrapTextX(lineWidth);
            if (curLines == linesN) return true;
            if (curLines > linesN) return false;
            lineWidth-=10;

        }

    }

}
//iLeading is in pixels
//NOTE we are ignoring lineHeight in font because we're doing all the line formatting ourselves
void ofxTextObject::setLeading(float iLeading)
{
    leading = iLeading;    
    wrapTextX(columnWidth);    
}
//Call with OF_TEXT_ALIGN_LEFT, OF_TEXT_ALIGN_RIGHT, OF_TEXT_ALIGN_JUSTIFIED, OF_TEXT_ALIGN_CENTER
void ofxTextObject::setAlignment(TextObjectAlignment iAlignment)
{
	alignment = iAlignment;
	wrapTextX(columnWidth);
}
void ofxTextObject::setColumnWidth(float iWidth)
{
	columnWidth = iWidth; 		
    wrapTextX(columnWidth);
}