From 0e5b8d62a6624cf659984955ad298b6a45874482 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Thu, 7 Nov 2019 20:32:09 -0500 Subject: [PATCH] Backport PR #15626: Note minimum supported version for fontconfig. --- INSTALL.rst | 4 +++- lib/matplotlib/font_manager.py | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/INSTALL.rst b/INSTALL.rst index 3d64becf80f5..c508de43edc2 100644 --- a/INSTALL.rst +++ b/INSTALL.rst @@ -164,7 +164,9 @@ etc., you can install the following: * `Pillow `_ (>= 3.4): for a larger selection of image file formats: JPEG, BMP, and TIFF image files; * `LaTeX `_ and `GhostScript (>=9.0) - `_ : for rendering text with LaTeX. + `_ : for rendering text with LaTeX; +* `fontconfig `_ (>= 2.7): for detection of system + fonts on Linux. .. note:: diff --git a/lib/matplotlib/font_manager.py b/lib/matplotlib/font_manager.py index 0f752166435c..df9fa6e6a6e2 100644 --- a/lib/matplotlib/font_manager.py +++ b/lib/matplotlib/font_manager.py @@ -273,6 +273,10 @@ def _call_fc_list(): 'This may take a moment.')) timer.start() try: + if b'--format' not in subprocess.check_output(['fc-list', '--help']): + _log.warning( # fontconfig 2.7 implemented --format. + 'Matplotlib needs fontconfig>=2.7 to query system fonts.') + return [] out = subprocess.check_output(['fc-list', '--format=%{file}\\n']) except (OSError, subprocess.CalledProcessError): return []