src/fixedfontwrap.cpp
// privateDrawTextLine *************
// This method is used to draw a line of text in a given surface,
// with any alignment, or to calculate the size of such a text line...
// private method to be used only by the class itself

privateDrawTextLine
This method is used to draw a line of text in a given surface,
with any alignment, or to calculate the size of such a text line
private method to be used only by the class itself
privateDrawTextLine This method is used to draw a line of text in a given surface with any alignment or to calculate the size of such a text line private method to be used only by the class itself
bool fixedFontClass::privateDrawTextLine(
	ddSurfaceClass& srfTo,
	char* text,
	int textSize,
	int x, int y,
	int boxWidth, int boxHeight,
	bool transparent,
	alignEnum alignment,
	bool drawText,
	int* definitiveX, int* definitiveY,
	int* definitiveW, int* definitiveH)
{
	int realX, realY;
	int textWidth=textSize*charW;
	realX=x; realY=y;
	if (textWidth<=boxWidth) {
		switch (alignment) {
		case FILE_DDWRAP_ALIGN_LEFT:
		default:
			realX=x;
			realY=y;
			break;
		case FILE_DDWRAP_ALIGN_CENTER:
			realX=(boxWidth-textWidth)/2+x;
			realY=y;
			break;
		case FILE_DDWRAP_ALIGN_RIGHT:
			realX=x+(boxWidth-textWidth);
			realY=y;
			break;
		}
	}
	if (definitiveX!=NULL) (*definitiveX)=realX;
	if (definitiveY!=NULL) (*definitiveY)=realY;
	if (definitiveW!=NULL) (*definitiveW)=MIN(textWidth, boxWidth);
	if (definitiveH!=NULL) (*definitiveH)=MIN(charH, boxHeight);
	if (drawText) {
		return lowLevelDrawTextLine(
			srfTo,
			text, textSize,
			realX, realY,
			x, y,
			boxWidth, boxHeight,
			transparent);
	}else{
		return true;
	}
}
bool fixedFontClass :: privateDrawTextLine ( ddSurfaceClass & srfTo , char * text , int textSize , int x , int y , int boxWidth , int boxHeight , bool transparent , alignEnum alignment , bool drawText , int * definitiveX , int * definitiveY , int * definitiveW , int * definitiveH ) { int realX , realY ; int textWidth = textSize * charW ; realX = x ; realY = y ; if ( textWidth <= boxWidth ) { switch ( alignment ) { case FILE_DDWRAP_ALIGN_LEFT : default : realX = x ; realY = y ; break ; case FILE_DDWRAP_ALIGN_CENTER : realX = ( boxWidth - textWidth ) / 2 + x ; realY = y ; break ; case FILE_DDWRAP_ALIGN_RIGHT : realX = x + ( boxWidth - textWidth ) ; realY = y ; break ; } } if ( definitiveX != NULL ) ( * definitiveX ) = realX ; if ( definitiveY != NULL ) ( * definitiveY ) = realY ; if ( definitiveW != NULL ) ( * definitiveW ) = MIN ( textWidth , boxWidth ) ; if ( definitiveH != NULL ) ( * definitiveH ) = MIN ( charH , boxHeight ) ; if ( drawText ) { return lowLevelDrawTextLine ( srfTo , text , textSize , realX , realY , x , y , boxWidth , boxHeight , transparent ) ; } else { return true ; } }
privateDrawTextLine 
This method is used to draw a line of text in a given surface,
with any alignment, or to calculate the size of such a text line...
private method to be used only by the class itself
privateDrawTextLine This method is used to draw a line of text in a given surface with any alignment or to calculate the size of such a text line ... private method to be used only by the class itself
// surface where to draw the text
 // text to draw
 // size of the string to draw
 // position where to draw the text
 // size of the text box (used for clipping)
 // will the text be transparent?
 // text alignment, either FILE_DDWRAP_ALIGN_LEFT, FILE_DDWRAP_ALIGN_CENTER or FILE_DDWRAP_ALIGN_RIGHT
 // tells whether we'll draw the text, or only calculate it
 // pointer to variables where to return the actual x and y coordinates (and box size) where the text was placed... if null, they aren't used
 // coordinates of the text, after aligned
 // width of the text to draw
 // assume left alignment...
 // calculate the text coordinates after aligned, but only if
 // text is not wider than the text box
 // left align
 // center align
 // right align
 // fill the definitive coordinates of the text, to be returned
 // call the low level draw text method (implementation dependent)
 // draw it
 // surface
 // text and text size
 // text coordinates
 // clip box, starting coordinates
 // size of the clip box
 // transparency
 // only calculate the text size
