Get a styled version of a particular font family

@param familyName The name of the font family
@param style The style (@see java.awt.Font#PLAIN)
@return The styled font or null if no such font exists
350420
public static FontData getStyled(String familyName, int style) {
		boolean b = (style & Font.BOLD) != 0;
		boolean i = (style & Font.ITALIC) != 0;
	
		if (b & i) {
			return getBoldItalic(familyName);
		} else if (b) {
			return getBold(familyName);
		} else if (i) {
			return getItalic(familyName);
		} else {
			return getPlain(familyName);
		}
	}
1104770
function(style)
	{
		if (style != null)
		{
			var pairs = style.split(';');
			var stylename = pairs[0];
			
			if (stylename.indexOf('=') < 0)
			{
				return stylename;
			}
		}
				
		return '';
	}
462382
def _font_name(self, ufo):
        """"""
        family_name = (
            ufo.info.familyName.replace(" ", "")
            if ufo.info.familyName is not None
            else "None"
        )
        style_name = (
            ufo.info.styleName.replace(" ", "")
            if ufo.info.styleName is not None
            else "None"
        )
        return "{}-{}".format(family_name, style_name)
753053
protected void setFontName(String fontName) {
        this.fontName = fontName;
        if(document != null) {
            this.fontNumber = document.getDocumentHeader().getFontNumber(this);
        }
    }
1256403
public static FontData getBoldItalic(String familyName) {
		FontData data = (FontData) bolditalic.get(familyName);
		
		return data;
	}
822389
public static TextSymbolizerInfo createSymbolizer(FontStyleInfo style) {
		TextSymbolizerInfo symbolizerInfo = new TextSymbolizerInfo();
		FontInfo font = new FontInfo();
		font.setFamily(style.getFamily());
		font.setStyle(style.getStyle());
		font.setWeight(style.getWeight());
		font.setSize(style.getSize());
		symbolizerInfo.setFont(font);
		symbolizerInfo.setFill(createFill(style.getColor(), style.getOpacity()));
		return symbolizerInfo;
	}
1060849
protected function getFontFamily(string $fontname = null): string
    {
        /**
         * Font sets to be used for PDF documents:
         *
         *   - Arial           - Times             - Tahoma
         *   - Georgia         - Trebuchet         - Courier
         *   - Lucida          - Lucida-Bright     - Palatino
         *   - Garamond        - Verdana           - Console
         *   - Monaco          - Helvetica         - Calibri
         *   - Avant-Garde     - Cambria
         */
        return array_key_exists(strtolower($fontname), $this->fontFamily)
            ? $this->fontFamily[strtolower($fontname)]
            : $this->fontFamily['default'];
    }
325335
def com_google_fonts_check_metadata_nameid_family_name(ttFont, font_metadata):
  
  from fontbakery.utils import get_name_entry_strings

  familynames = get_name_entry_strings(ttFont, NameID.TYPOGRAPHIC_FAMILY_NAME)
  if not familynames:
      familynames = get_name_entry_strings(ttFont, NameID.FONT_FAMILY_NAME)
  if len(familynames) == 0:
    yield FAIL, Message("missing",
                        ("This font lacks a FONT_FAMILY_NAME entry"
                         " (nameID={}) in the name"
                         " table.").format(NameID.FONT_FAMILY_NAME))
  else:
    if font_metadata.name not in familynames:
      yield FAIL, Message("mismatch",
                          ("Unmatched family name in font:"
                           " TTF has \"{}\" while METADATA.pb"
                           " has \"{}\"").format(familynames[0],
                                                 font_metadata.name))
    else:
      yield PASS, ("Family name \"{}\" is identical"
                   " in METADATA.pb and on the"
                   " TTF file.").format(font_metadata.name)
440040
public String getStyleName() {
    if (Style_Type.featOkTst && ((Style_Type)jcasType).casFeat_styleName == null)
      jcasType.jcas.throwFeatMissing("styleName", "de.julielab.jules.types.Style");
    return jcasType.ll_cas.ll_getStringValue(addr, ((Style_Type)jcasType).casFeatCode_styleName);}
70346
public static FontData getBold(String familyName) {
		FontData data = (FontData) bold.get(familyName);
		
		return data;
	}
884024
def com_google_fonts_check_name_familyname(ttFont, style, familyname_with_spaces):
  
  from fontbakery.utils import name_entry_id
  failed = False
  only_weight = get_only_weight(style)
  for name in ttFont['name'].names:
    if name.nameID == NameID.FONT_FAMILY_NAME:

      if name.platformID == PlatformID.MACINTOSH:
        expected_value = familyname_with_spaces

      elif name.platformID == PlatformID.WINDOWS:
        if style in ['Regular',
                     'Italic',
                     'Bold',
                     'Bold Italic']:
          expected_value = familyname_with_spaces
        else:
          expected_value = " ".join([familyname_with_spaces,
                                     only_weight]).strip()
      else:
        failed = True
        yield FAIL, ("Font should not have a "
                     "{} entry!").format(name_entry_id(name))
        continue

      string = name.string.decode(name.getEncoding()).strip()
      if string != expected_value:
        failed = True
        yield FAIL, ("Entry {} on the 'name' table: "
                     "Expected '{}' "
                     "but got '{}'.").format(name_entry_id(name),
                                             expected_value,
                                             string)
  if not failed:
    yield PASS, "FONT_FAMILY_NAME entries are all good."
812041
public FontData deriveFont(float size, int style) {
		FontData original = getStyled(getFamilyName(), style);
		FontData data = new FontData();
		data.size = size;
		data.javaFont = original.javaFont.deriveFont(style, size);
		data.upem = upem;
		data.ansiKerning = ansiKerning;
		data.charWidth = charWidth;
		
		return data;
	}
348243
protected void updateStyle(BoxStyle bstyle, TextPosition text)
    {
        String font = text.getFont().getName();
        String family = null;
        String weight = null;
        String fstyle = null;

        bstyle.setFontSize(text.getFontSizeInPt());
        bstyle.setLineHeight(text.getHeight());

        if (font != null)
        {
        	//font style and weight
            for (int i = 0; i < pdFontType.length; i++)
            {
                if (font.toLowerCase().lastIndexOf(pdFontType[i]) >= 0)
                {
                    weight = cssFontWeight[i];
                    fstyle = cssFontStyle[i];
                    break;
                }
            }
            if (weight != null)
            	bstyle.setFontWeight(weight);
            else
            	bstyle.setFontWeight(cssFontWeight[0]);
            if (fstyle != null)
            	bstyle.setFontStyle(fstyle);
            else
            	bstyle.setFontStyle(cssFontStyle[0]);

            //font family
            //If it's a known common font don't embed in html output to save space
            String knownFontFamily = findKnownFontFamily(font);
            if (!knownFontFamily.equals(""))
                family = knownFontFamily;
            else
            {
                family = fontTable.getUsedName(text.getFont());
                if (family == null)
                    family = font;
            }

            if (family != null)
            	bstyle.setFontFamily(family);
        }

        updateStyleForRenderingMode();
    }
529523
protected FontStyle getFontStyle(byte[] data, int offset, Map<Integer, FontBase> fontBases, boolean ignoreBackground)
   {
      //System.out.println(ByteArrayHelper.hexdump(data, offset, 32, false));

      Integer index = Integer.valueOf(MPPUtility.getByte(data, offset));
      FontBase fontBase = fontBases.get(index);
      int style = MPPUtility.getByte(data, offset + 3);
      Color color = MPPUtility.getColor(data, offset + 4);
      Color backgroundColor;
      BackgroundPattern backgroundPattern;

      if (ignoreBackground)
      {
         backgroundColor = null;
         backgroundPattern = BackgroundPattern.SOLID;
      }
      else
      {
         backgroundColor = MPPUtility.getColor(data, offset + 16);
         backgroundPattern = BackgroundPattern.getInstance(MPPUtility.getShort(data, offset + 28));
      }

      boolean bold = ((style & 0x01) != 0);
      boolean italic = ((style & 0x02) != 0);
      boolean underline = ((style & 0x04) != 0);
      boolean strikethrough = ((style & 0x08) != 0);

      FontStyle fontStyle = new FontStyle(fontBase, italic, bold, underline, strikethrough, color, backgroundColor, backgroundPattern);
      //System.out.println(fontStyle);
      return fontStyle;
   }
697261
public static Typeface getTypeface(Context ctx, String fontName){
        Typeface existing = mLoadedTypefaces.get(fontName);
        if(existing == null){
            existing = Typeface.createFromAsset(ctx.getAssets(), fontName);
            mLoadedTypefaces.put(fontName, existing);
        }
        return existing;
    }
602056
protected FontStyle getFontStyle(byte[] data, int offset, Map<Integer, FontBase> fontBases)
   {
      Integer index = Integer.valueOf(MPPUtility.getByte(data, offset));
      FontBase fontBase = fontBases.get(index);
      int style = MPPUtility.getByte(data, offset + 1);
      ColorType color = ColorType.getInstance(MPPUtility.getByte(data, offset + 2));

      boolean bold = ((style & 0x01) != 0);
      boolean italic = ((style & 0x02) != 0);
      boolean underline = ((style & 0x04) != 0);

      FontStyle fontStyle = new FontStyle(fontBase, italic, bold, underline, false, color.getColor(), null, BackgroundPattern.SOLID);
      //System.out.println(fontStyle);
      return fontStyle;
   }
119089
public NonStandardFontFamily get(String fontFamily) {

        NonStandardFontFamily f = standardUnicodeFontFamilySet
                .getFontFamilyByName(fontFamily);
        if (f != null)
            return f;

        f = standardNonUnicodeFontFamilySet.getFontFamilyByName(fontFamily);
        if (f != null)
            return f;

        f = nonStandardFontFamilySet.getFontFamilyByName(fontFamily);
        if (f != null)
            return f;

        return null;
    }