def get_font_description(style):
    """Get font description string out of given style."""
    font_description = ffi.gc(
        pango.pango_font_description_new(), pango.pango_font_description_free)
    family_p, family = unicode_to_char_p(','.join(style['font_family']))
    pango.pango_font_description_set_family(font_description, family_p)
    font_style = PANGO_STYLE[style['font_style']]
    pango.pango_font_description_set_style(font_description, font_style)
    font_stretch = PANGO_STRETCH[style['font_stretch']]
    pango.pango_font_description_set_stretch(font_description, font_stretch)
    font_weight = style['font_weight']
    pango.pango_font_description_set_weight(font_description, font_weight)
    font_size = int(style['font_size'] * TO_UNITS)
    pango.pango_font_description_set_absolute_size(font_description, font_size)
    font_variant = PANGO_VARIANT[style['font_variant_caps']]
    pango.pango_font_description_set_variant(font_description, font_variant)
    if style['font_variation_settings'] != 'normal':
        string = ','.join(
            f'{key}={value}' for key, value in
            style['font_variation_settings']).encode()
        pango.pango_font_description_set_variations(font_description, string)
    return font_description
Get font description string out of given style.
weasyprint/text/fonts.py