faxmail/MsgFmt.c++
/*
 * Display the string in italic, wrapping to the
 * field header tab stop on any line overflows.
 */
Display the string in italic, wrapping to the
field header tab stop on any line overflows.
Display the string in italic wrapping to the field header tab stop on any line overflows .
void
MsgFmt::showItalic(TextFormat& fmt, const char* cp)
{
    const TextFont* italic = fmt.getFont("Italic");
    if (!italic)
	italic = fmt.addFont("Italic", italicFont);
    while (isspace(*cp))			
	cp++;
    TextCoord x = fmt.getXOff();		
    FILE* tf = fmt.getOutputFile();		
    const char* tp = cp;
    for (; *tp != '\0'; tp++) {
	if (*tp == '\r' && *(tp+1) == '\n') tp++;
	TextCoord hm = italic->charwidth(*tp);
	if (*tp == '\n' || x+hm > fmt.getRHS()) {
	    italic->show(tf, cp, tp-cp), cp = tp;
	    if (!fmt.getLineWrapping())		
		return;
	    fmt.endLine();			
	    fmt.beginLine();			
	    fmt.hrMove(headerStop);		
	    x = fmt.getXOff();
	    if (*tp == '\n') {			
		for (tp++; isspace(*tp); tp++)
		    ;
		cp = --tp;
	    }
	}
	x += hm;
    }
    if (tp > cp)
	italic->show(tf, cp, tp-cp);		
}
void MsgFmt :: showItalic ( TextFormat & fmt , const char * cp ) { const TextFont * italic = fmt . getFont ( " " ) ; if ( ! italic ) italic = fmt . addFont ( " " , italicFont ) ; while ( isspace ( * cp ) ) cp ++ ; TextCoord x = fmt . getXOff ( ) ; FILE * tf = fmt . getOutputFile ( ) ; const char * tp = cp ; for ( ; * tp != ' \0 ' ; tp ++ ) { if ( * tp == ' \r ' && * ( tp + 1 ) == ' \n ' ) tp ++ ; TextCoord hm = italic -> charwidth ( * tp ) ; if ( * tp == ' \n ' || x + hm > fmt . getRHS ( ) ) { italic -> show ( tf , cp , tp - cp ) , cp = tp ; if ( ! fmt . getLineWrapping ( ) ) return ; fmt . endLine ( ) ; fmt . beginLine ( ) ; fmt . hrMove ( headerStop ) ; x = fmt . getXOff ( ) ; if ( * tp == ' \n ' ) { for ( tp ++ ; isspace ( * tp ) ; tp ++ ) ; cp = -- tp ; } } x += hm ; } if ( tp > cp ) italic -> show ( tf , cp , tp - cp ) ; }
Display the string in italic, wrapping to the
 field header tab stop on any line overflows.
Display the string in italic wrapping to the field header tab stop on any line overflows .
// trim leading whitespace // current x position on line // output stream // text would overflow line // flush pending text // truncate line, don't wrap // terminate line // begin another line // reposition to header stop // remove leading white space // flush remainder