def generate_fontconfig_pattern(d):
props = []<EOL>families = '<STR_LIT>'<EOL>size = '<STR_LIT>'<EOL>for key in '<STR_LIT>'.split():<EOL><INDENT>val = getattr(d, '<STR_LIT>' + key)()<EOL>if val is not None and val != []:<EOL><INDENT>if type(val) == list:<EOL><INDENT>val = [value_escape(r'<STR_LIT>', str(x)) for x in val if x is not None]<EOL>if val != []:<EOL><INDENT>val = '<STR_LIT:U+002C>'.join(val)<EOL><DEDENT><DEDENT>props.append("<STR_LIT>" % (key, val))<EOL><DEDENT><DEDENT>return '<STR_LIT>'.join(props)<EOL>
Given a dictionary of key/value pairs, generates a fontconfig
pattern string.