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: |