

@staticmethod
def get_fontconfig_match(name, size, bold, italic):
    if bold:
        bold = FC_WEIGHT_BOLD
    else:
        bold = FC_WEIGHT_REGULAR
    if italic:
        italic = FC_SLANT_ITALIC
    else:
        italic = FC_SLANT_ROMAN
    fontconfig.FcInit()
    if isinstance(name, unicode):
        name = name.encode('utf8')
    pattern = fontconfig.FcPatternCreate()
    fontconfig.FcPatternAddDouble(pattern, FC_SIZE, c_double(size))
    fontconfig.FcPatternAddInteger(pattern, FC_WEIGHT, bold)
    fontconfig.FcPatternAddInteger(pattern, FC_SLANT, italic)
    fontconfig.FcPatternAddString(pattern, FC_FAMILY, name)
    fontconfig.FcConfigSubstitute(0, pattern, FcMatchPattern)
    fontconfig.FcDefaultSubstitute(pattern)
    result = FcResult()
    match = fontconfig.FcFontMatch(0, pattern, byref(result))
    fontconfig.FcPatternDestroy(bold)
    return match

dataset/ETHPy150Open ardekantur/pyglet/pyglet/font/freetype.py FreeTypeFont.get_fontconfig_match/VarMisuse@182/270 `pattern`->`bold`