/*! * Set the format properties from the given \a font. */ void Format::setFont(const QFont &font) { setFontName(font.family()); setFontSize(font.pointSize()); setFontBold(font.bold()); setFontItalic(font.italic()); setFontUnderline(font.underline() ? FontUnderlineSingle : FontUnderlineNone); setFontStrikeOut(font.strikeOut()); }
int readPrint(char *fname) { if( fname == NULL ) return -1; FILE *f = fopen(fname, "r"); if( f == NULL ){ return -1; } char c; while ( (c = fgetc(f) ) != EOF ) { switch(c){ case '\n': linebuffer[len] = '\n'; printLine(); break; case '\\': c = fgetc(f); if( c == 'o'){ printLine(); setFontNormal(); }else if(c == 'b'){ printLine(); setFontBold(); }else if( c == 'w'){ printLine(); setFontDoubleWidth(); }else if( c == 'h'){ printLine(); setFontDoubleHeight(); }else if ( c == '0' ){ setAlignLeft(); }else if ( c == 'm' ){ setAlignCenter(); }else if ( c == '$' ){ setAlignRight(); }else{ linebuffer[len++] = '\\'; if( c == EOF ){ //linebuffer[len] = '\n'; printLine(); }else{ linebuffer[len++] = c; } } break; default: linebuffer[len++] = c; break; } if( len >= 1023 ){ //printf("print len >= 1023\n"); printLine(); } } printLine(); feed4Lines(); fclose(f); openCashDrawer(); cutPaper(); return 0; }
void SimpleRichTextEdit::toggleFontBold() { setFontBold(!fontBold()); }