Set font style with the following attributes:
        'foreground_color', 'background_color', 'italic',
        'bold' and 'underline'
963846
def set_style(self):
        
        if self.current_format is None:
            assert self.base_format is not None
            self.current_format = QTextCharFormat(self.base_format)
        # Foreground color
        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)
        # Background color
        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()
        # Italic
        if self.italic is None:
            italic = self.base_format.fontItalic()
        else:
            italic = self.italic
        font.setItalic(italic)
        # Bold
        if self.bold is None:
            bold = self.base_format.font().bold()
        else:
            bold = self.bold
        font.setBold(bold)
        # Underline
        if self.underline is None:
            underline = self.base_format.font().underline()
        else:
            underline = self.underline
        font.setUnderline(underline)
        self.current_format.setFont(font)
969048
def set_as_underlined(self, color=Qt.blue):
        
        self.format.setUnderlineStyle(
            QTextCharFormat.SingleUnderline)
        self.format.setUnderlineColor(color)
224402
private void updateFont(Font font) {
        StyledDocument doc = (StyledDocument)getComponent().getDocument();
        Style style = doc.getStyle(StyleContext.DEFAULT_STYLE);

        if (style == null) {
            return;
        }

        if (font == null) {
            style.removeAttribute(StyleConstants.FontFamily);
            style.removeAttribute(StyleConstants.FontSize);
            style.removeAttribute(StyleConstants.Bold);
            style.removeAttribute(StyleConstants.Italic);
        } else {
            StyleConstants.setFontFamily(style, font.getName());
            StyleConstants.setFontSize(style, font.getSize());
            StyleConstants.setBold(style, font.isBold());
            StyleConstants.setItalic(style, font.isItalic());
        }
    }
711736
def _compose_style(self):
        """"""
        valid_styles = (
            'color', 'width', 'filter', 'strokeWidth', 'strokeColor',
        )
        self.styling = '\n'.join(
            '{prop}: {style}'.format(prop=s, style=getattr(self, s))
            for s in valid_styles
            if getattr(self, s) is not None
        )
242055
function createStringAttributes(textStyles) {
  const font = findFont(textStyles);

  const attribs = {
    MSAttributedStringFontAttribute: font.fontDescriptor(),
    NSFont: font,
    NSParagraphStyle: makeParagraphStyle(textStyles),
    NSUnderline: TEXT_DECORATION_UNDERLINE[textStyles.textDecoration] || 0,
    NSStrikethrough: TEXT_DECORATION_LINETHROUGH[textStyles.textDecoration] || 0
  };

  const color = makeColorFromCSS(textStyles.color || 'black');

  if (getSketchVersion() >= 50) {
    attribs.MSAttributedStringColorAttribute = color;
  } else {
    attribs.NSColor = NSColor.colorWithDeviceRed_green_blue_alpha(
      color.red,
      color.green,
      color.blue,
      color.alpha
    );
  }

  if (textStyles.letterSpacing !== undefined) {
    attribs.NSKern = textStyles.letterSpacing;
  }

  if (textStyles.textTransform !== undefined) {
    attribs.MSAttributedStringTextTransformAttribute = TEXT_TRANSFORM[textStyles.textTransform] * 1;
  }

  return attribs;
}
1068740
def Font(name=None, source="sys", italic=False, bold=False, size=20):
    
    assert source in ["sys", "file"]
    if not name:
        return pygame.font.SysFont(pygame.font.get_default_font(), 
        size, bold=bold, italic=italic)
    if source == "sys":
        return pygame.font.SysFont(name, 
        size, bold=bold, italic=italic)
    else:
        f = pygame.font.Font(name, size)
        f.set_italic(italic)
        f.set_bold(bold)
        return f
510599
def set_style(self, style):
        """"""
        if style == "none":
            self.style = None
        elif prompt_toolkit is None:
            raise CoconutException("syntax highlighting is not supported on this Python version")
        elif style == "list":
            print("Coconut Styles: none, " + ", ".join(pygments.styles.get_all_styles()))
            sys.exit(0)
        elif style in pygments.styles.get_all_styles():
            self.style = style
        else:
            raise CoconutException("unrecognized pygments style", style, extra="use '--style list' to show all valid styles")
467413
def com_google_fonts_check_metatada_canonical_style_names(ttFont, font_metadata):
  """"""
  from fontbakery.constants import MacStyle

  def find_italic_in_name_table():
    for entry in ttFont["name"].names:
      if entry.nameID < 256 and "italic" in entry.string.decode(entry.getEncoding()).lower():
        return True
    return False

  def is_italic():
    return (ttFont["head"].macStyle & MacStyle.ITALIC or
            ttFont["post"].italicAngle or
            find_italic_in_name_table())

  if font_metadata.style not in ["italic", "normal"]:
    yield SKIP, ("This check only applies to font styles declared"
                 " as \"italic\" or \"regular\" on METADATA.pb.")
  else:
    if is_italic() and font_metadata.style != "italic":
      yield FAIL, ("The font style is {}"
                   " but it should be italic").format(font_metadata.style)
    elif not is_italic() and font_metadata.style != "normal":
      yield FAIL, ("The font style is {}"
                   " but it should be normal").format(font_metadata.style)
    else:
      yield PASS, "Font styles are named canonically."
109527
def font(self, name, properties):
        
        size, slant, weight = (properties)
        return (name, (self.ty(size), slant, weight))
1155431
def set_plain_text_font(self, font, color_scheme=None):
        """"""
        self.plain_text.set_font(font, color_scheme=color_scheme)
26267
@Override
  public Font getFont( AttributeSet attr )
  {
    boolean bUnderline = StyleConstants.isUnderline( attr );
    boolean bStrikethrough = StyleConstants.isStrikeThrough( attr );

    if( !bUnderline && !bStrikethrough )
    {
      // StyleContext ignores the Underline and Strikethrough attribute
      return getFont( attr, getFontFamily( attr ) );
    }

    // Must build the font via TextAttribute map to support Underlined and Strikethrough text

    Map<TextAttribute, Object> map = new HashMap<TextAttribute, Object>();
    map.put( TextAttribute.FAMILY, getFontFamily( attr ) );
    map.put( TextAttribute.SIZE, (float)getFontSize() );
    map.put( TextAttribute.WEIGHT, StyleConstants.isBold( attr ) ? TextAttribute.WEIGHT_BOLD : TextAttribute.WEIGHT_REGULAR );
    map.put( TextAttribute.POSTURE, StyleConstants.isItalic( attr ) ? TextAttribute.POSTURE_OBLIQUE : TextAttribute.POSTURE_REGULAR );
    if( bUnderline )
    {
      map.put( TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_ON );
      if( attr.getAttribute( DASHED ) != null )
      {
        map.put( TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_LOW_GRAY );
      }
    }
    if( bStrikethrough )
    {
      map.put( TextAttribute.STRIKETHROUGH, TextAttribute.STRIKETHROUGH_ON );
    }

    Font font = _fontCache.get( attr );
    if( font == null )
    {
      font = new Font( map );
      _fontCache.put( attr, font );
    }

    return font;
  }
550481
def _update_font_style(self, font_style):
        

        toggle_state = font_style & wx.FONTSTYLE_ITALIC == wx.FONTSTYLE_ITALIC

        self.ToggleTool(wx.FONTFLAG_ITALIC, toggle_state)
1212033
public static Font setFontStyle(Font font, short color, short fontSize, String fontName) {
		if(color > 0) {
			font.setColor(color);
		}
		if(fontSize > 0) {
			font.setFontHeightInPoints(fontSize);
		}
		if(StrUtil.isNotBlank(fontName)) {
			font.setFontName(fontName);
		}
		return font;
	}
135517
def change_font_italics(italicized = false)
      validate_worksheet

      font = get_cell_font.dup
      font.set_italic(italicized)
      update_font_references(font)
    end
389722
def __generate_font_tuple(self):
        
        if not self._family:
            return None
        font = [self._family, self._size]
        if self._bold:
            font.append("bold")
        if self._italic:
            font.append("italic")
        if self._underline:
            font.append("underline")
        if self._overstrike:
            font.append("overstrike")
        return tuple(font)
273823
def update_font(self):
        """"""
        color_scheme = self.get_color_scheme()
        font = self.get_plugin_font()
        for editor in self.editors:
            editor.set_font(font, color_scheme)
795806
public void setFontStyle() {

        if (!CmsStringUtil.isEmptyOrWhitespaceOnly(m_styleName)) {
            removeStyleName(m_styleName);
        }
        String id = new CmsUUID().getStringValue();
        m_styleName = CSS_CLASSNAME + "_" + id;
        addStyleName(m_styleName);
        String js = "var elements = document.getElementsByClassName('"
            + m_styleName
            + "');"
            + "var iframeContainer = elements[0];"
            + "var iframe = iframeContainer.getElementsByTagName('iframe')[0];"
            + "var iframeBody = iframe.contentDocument.getElementsByTagName('body')[0];"
            + "iframeBody.style.fontFamily='\"Open Sans\", sans-serif';";

        JavaScript.getCurrent().execute(js);

    }