diff options
| author | Georg Brandl <georg@python.org> | 2016-02-02 11:28:29 +0100 |
|---|---|---|
| committer | Georg Brandl <georg@python.org> | 2016-02-02 11:28:29 +0100 |
| commit | f4e2ea8d4fcd4abefa228ecf2ac20998cce45a6c (patch) | |
| tree | e9f9f4b78ee19b208ce854425af36bebf94c51ca | |
| parent | 76e9a0a6e71ff20090f88f1949e4ae33f2079259 (diff) | |
| download | pygments-f4e2ea8d4fcd4abefa228ecf2ac20998cce45a6c.tar.gz | |
Fixed image formatter font searching on Macs (closes #1188)
| -rw-r--r-- | CHANGES | 1 | ||||
| -rw-r--r-- | pygments/formatters/img.py | 10 |
2 files changed, 8 insertions, 3 deletions
@@ -12,6 +12,7 @@ Version 2.1.1 (in development) - Fixed Jython compatibility (#1205) +- Fixed image formatter font searching on Macs (#1188) - Fixed Python curly-brace string interpolation highlighting (PR#544) - Fixed Julia string interpolation (#1170) - Many smaller fixes to various lexers diff --git a/pygments/formatters/img.py b/pygments/formatters/img.py index a7b5d51e..c7b8e819 100644 --- a/pygments/formatters/img.py +++ b/pygments/formatters/img.py @@ -82,9 +82,13 @@ class FontManager(object): stdout, _ = proc.communicate() if proc.returncode == 0: lines = stdout.splitlines() - if lines: - path = lines[0].decode().strip().strip(':') - return path + for line in lines: + if line.startswith('Fontconfig warning:'): + continue + path = line.decode().strip().strip(':') + if path: + return path + return None def _create_nix(self): for name in STYLES['NORMAL']: |
