8 fc-search-codepoint - Print the names of available X11 fonts containing the given code point(s)
17 print('''Usage: ''' + sys.argv[0] + ''' CHARS [REGEX]
18 Print the names of available fonts containing the code point(s) CHARS.
19 If CHARS contains multiple characters, they must all be present.
20 Alternatively you can use U+xxxx to search for a single character with
21 code point xxxx (hexadecimal digits).
22 If REGEX is specified, the font name must match this regular expression.''')
24 characters = sys.argv[1]
25 if characters.startswith('U+'):
26 characters = unichr(int(characters[2:], 16))
28 characters = characters.decode(sys.stdout.encoding)
29 regexp = re.compile(sys.argv[2] if len(sys.argv) > 2 else '')
31 font_names = fontconfig.query()
33 for name in font_names:
34 if not re.search(regexp, name): continue
35 font = fontconfig.FcFont(name)
36 if all(font.has_char(c) for c in characters):
40 sys.exit(0 if found else 1)