The font we want to use
485146
def font(key)
      single_font = fetch_config[key.to_s]['font']
      return single_font if single_font

      fonts = fetch_config[key.to_s]['fonts']
      if fonts
        fonts.each do |font|
          if font['supported']
            font['supported'].each do |language|
              if screenshot.path.include?(language)
                return font["font"]
              end
            end
          else
            # No `supported` array, this will always be true
            UI.verbose("Found a font with no list of supported languages, using this now")
            return font["font"]
          end
        end
      end

      UI.verbose("No custom font specified for #{screenshot}, using the default one")
      return nil
    end
479629
def update_font(self):
        """"""
        color_scheme = self.get_color_scheme()
        font = self.get_plugin_font()
        rich_font = self.get_plugin_font(rich_text=True)

        self.set_plain_text_font(font, color_scheme=color_scheme)
        self.set_rich_text_font(rich_font)
859013
def style(font):
  """"""
  from fontbakery.constants import STATIC_STYLE_NAMES
  filename = os.path.basename(font)
  if '-' in filename:
    stylename = os.path.splitext(filename)[0].split('-')[1]
    if stylename in [name.replace(' ', '') for name in STATIC_STYLE_NAMES]:
      return stylename
  return None
1182085
def choose_font(self, font=None):
        """"""
        fmt_widget = self.parent()
        if font is None:
            if self.current_font:
                font, ok = QFontDialog.getFont(
                    self.current_font, fmt_widget,
                    'Select %s font' % self.fmto_name,
                    QFontDialog.DontUseNativeDialog)
            else:
                font, ok = QFontDialog.getFont(fmt_widget)
            if not ok:
                return
        self.current_font = font
        properties = self.load_properties()
        properties.update(self.qfont_to_artist_props(font))
        fmt_widget.set_obj(properties)
        self.refresh()
1287812
function(context, font, stroke) {
        context.font = font.font;
        context.fillStyle = font.fillStyle.toRGBA();
        if (stroke === true) {
            context.strokeStyle = font.strokeStyle.toRGBA();
            context.lineWidth = font.lineWidth;
        }
        context.textAlign = font.textAlign;
        context.textBaseline = font.textBaseline;
    }
510218
public static void setStyle() {

        int style = Font.PLAIN;

        if (ckbbold.isSelected()) {
            style |= Font.BOLD;
        }

        if (ckbitalic.isSelected()) {
            style |= Font.ITALIC;
        }

        fOwner.tTree.setFont(fOwner.txtCommand.getFont().deriveFont(style));
        fOwner.txtCommand.setFont(
            fOwner.txtCommand.getFont().deriveFont(style));
        fOwner.txtResult.setFont(
            fOwner.txtResult.getFont().deriveFont(style));
    }
1202724
def FontForLabels(self, dc):
        '''  '''
        font = wx.SystemSettings_GetFont(wx.SYS_DEFAULT_GUI_FONT)
        scale = dc.GetPPI()[0] / wx.ScreenDC().GetPPI()[0]
        font.SetPointSize(scale*font.GetPointSize())
        return font
1232703
def update_font(self):
        """"""
        font = self.get_plugin_font()
        color_scheme = self.get_color_scheme()
        for editorstack in self.editorstacks:
            editorstack.set_default_font(font, color_scheme)
            completion_size = CONF.get('main', 'completion/size')
            for finfo in editorstack.data:
                comp_widget = finfo.editor.completion_widget
                comp_widget.setup_appearance(completion_size, font)
713300
private Font buildFamilyFont(final FamilyFont familyFont) {
        Font font = null;
        if (familyFont.posture() == null && familyFont.weight() == null) {
            font = Font.font(transformFontName(familyFont.family()), familyFont.size());
        } else if (familyFont.posture() == null) {
            font = Font.font(transformFontName(familyFont.family()), familyFont.weight(), familyFont.size());
        } else if (familyFont.weight() == null) {
            font = Font.font(transformFontName(familyFont.family()), familyFont.posture(), familyFont.size());
        } else {
            font = Font.font(transformFontName(familyFont.family()), familyFont.weight(), familyFont.posture(), familyFont.size());
        }
        return font;
    }
120311
public static PDFont chooseMatchingHelvetica(Font font) {
		if ((font.getStyle() & (Font.ITALIC | Font.BOLD)) == (Font.ITALIC | Font.BOLD))
			return PDType1Font.HELVETICA_BOLD_OBLIQUE;
		if ((font.getStyle() & Font.ITALIC) == Font.ITALIC)
			return PDType1Font.HELVETICA_OBLIQUE;
		if ((font.getStyle() & Font.BOLD) == Font.BOLD)
			return PDType1Font.HELVETICA_BOLD;
		return PDType1Font.HELVETICA;
	}
755195
def get_font(self, face, bold=False, italic=False):
        """"""
        key = '%s-%s-%s' % (face, bold, italic)
        if key not in self._fonts:
            font = dict(face=face, bold=bold, italic=italic)
            self._fonts[key] = TextureFont(font, self._renderer)
        return self._fonts[key]
177734
private void setDefaultFonts(BrowserConfig config) {
		config.setDefaultFont(Font.SERIF, "Times New Roman");
		config.setDefaultFont(Font.SANS_SERIF, "Arial");
		config.setDefaultFont(Font.MONOSPACED, "Courier New");
	}
211478
def create_style_from_font(font):
    

    if font is None:
        return ''

    if type(font) is str:
        _font = font.split(' ')
    else:
        _font = font

    style = ''
    style += 'font-family: %s;\n' % _font[0]
    style += 'font-size: %spt;\n' % _font[1]
    font_items = ''
    for item in _font[2:]:
        if item == 'underline':
            style += 'text-decoration: underline;\n'
        else:
            font_items += item + ' '
    if font_items != '':
        style += 'font: %s;\n' % (font_items)
    return style
1217985
def font_to_wx_font(font):
    

    if font is None:
        return ''

    if type(font) is str:
        _font = font.split(' ')
    else:
        _font = font
    name = _font[0]
    family = _font[0]
    point_size = int(_font[1])

    # style = _font[2]

    underline =  'underline' in _font[2:]
    bold =  'bold' in _font

    wxfont = wx.Font(point_size,
                     wx.FONTFAMILY_DEFAULT,
                     wx.FONTSTYLE_NORMAL,
                     wx.FONTWEIGHT_BOLD if bold else wx.FONTWEIGHT_NORMAL,
                     underline,
                     faceName=family)

    return wxfont
586190
def set_font(self, font):
        """"""
        self.shellwidget._control.setFont(font)
        self.shellwidget.font = font
483062
function() {
        return (
            this._textFont.type +
            " " +
            this._textFont.variant +
            " " +
            this._textFont.weight +
            " " +
            this._textFont.size +
            " / " +
            this._textFont.lineHeight +
            " " +
            this._textFont.family
        );
    }
1263682
private Font randomFont() {
        Random r = new Random();
        int index = r.nextInt(this.fontNames.length);
        String fontName = this.fontNames[index];
        int style = r.nextInt(4);
        int size = (this.fontSizeRange > 0 ? r.nextInt(this.fontSizeRange) : 0) + this.fontBasicSize;
        return new Font(fontName, style, size);
    }