ThirdParty/Pygments/pygments/formatters/img.py

changeset 5072
aab59042fefb
parent 4697
c2e9bf425554
child 5713
6762afd9f963
equal deleted inserted replaced
5070:4e4651e88674 5072:aab59042fefb
80 proc = subprocess.Popen(['fc-list', "%s:style=%s" % (name, style), 'file'], 80 proc = subprocess.Popen(['fc-list', "%s:style=%s" % (name, style), 'file'],
81 stdout=subprocess.PIPE, stderr=None) 81 stdout=subprocess.PIPE, stderr=None)
82 stdout, _ = proc.communicate() 82 stdout, _ = proc.communicate()
83 if proc.returncode == 0: 83 if proc.returncode == 0:
84 lines = stdout.splitlines() 84 lines = stdout.splitlines()
85 if lines: 85 for line in lines:
86 path = lines[0].decode().strip().strip(':') 86 if line.startswith(b'Fontconfig warning:'):
87 return path 87 continue
88 path = line.decode().strip().strip(':')
89 if path:
90 return path
91 return None
88 92
89 def _create_nix(self): 93 def _create_nix(self):
90 for name in STYLES['NORMAL']: 94 for name in STYLES['NORMAL']:
91 path = self._get_nix_font_path(self.font_name, name) 95 path = self._get_nix_font_path(self.font_name, name)
92 if path is not None: 96 if path is not None:

eric ide

mercurial