'Set font style with the following attributes:
\'foreground_color\', \'background_color\', \'italic\',
\'bold\' and \'underline\''

def set_style(self):

    if (self.current_format is None):
        assert (self.base_format is not None)
        self.current_format = QTextCharFormat(self.base_format)
    if (self.foreground_color is None):
        qcolor = self.base_format.foreground()
    else:
        cstr = self.ANSI_COLORS[(self.foreground_color - 30)][self.intensity]
        qcolor = QColor(cstr)
    self.current_format.setForeground(qcolor)
    if (self.background_color is None):
        qcolor = self.base_format.background()
    else:
        cstr = self.ANSI_COLORS[(self.background_color - 40)][self.intensity]
        qcolor = QColor(cstr)
    self.current_format.setBackground(qcolor)
    font = self.current_format.font()
    if (self.italic is None):
        italic = self.base_format.fontItalic()
    else:
        italic = self.italic
    font.setItalic(italic)
    if (self.bold is None):
        bold = self.base_format.font().bold()
    else:
        bold = self.bold
    font.setBold(bold)
    if (self.underline is None):
        underline = self.base_format.font().underline()
    else:
        underline = self.underline
    font.setUnderline(underline)
    self.current_format.setFont(font)
