Skip to content

Commit e8559db

Browse files
committed
Deprecate the TTFPATH & AFMPATH environment variables.
These undocumented environment variables allow one to selectively add paths to the font cache... but only if the font cache doesn't exist yet (they don't force cache regen). The font-cache regen API (_rebuild()) is also private (even though one can trigger it "publically" e.g. by calling `findfont` with a nonexisting font...). Instead, we now expose `addfont()` which is a documented API for registering fonts with the font manager.
1 parent 4130dab commit e8559db

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

doc/api/next_api_changes/deprecations.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,3 +131,9 @@ This method is deprecated. Use
131131
``SymmetricalScale.SymmetricalTransform`` and
132132
``SymmetricalScale.InvertedSymmetricalTransform`` are deprecated. Directly
133133
access the transform classes from the :mod:`.scale` module.
134+
135+
The ``TTFPATH`` and ``AFMPATH`` environment variables
136+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
137+
Support for the (undocumented) ``TTFPATH`` and ``AFMPATH`` environment
138+
variables is deprecated. Additional fonts may be registered using
139+
``matplotlib.font_manager.fontManager.addfont()``.

lib/matplotlib/font_manager.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -971,6 +971,9 @@ def __init__(self, size=None, weight='normal'):
971971
paths.extend(ttfpath.split(':'))
972972
else:
973973
paths.append(ttfpath)
974+
cbook.warn_deprecated(
975+
"3.3", name=pathname, obj_type="environment variable",
976+
alternative="FontManager.addfont()")
974977
_log.debug('font search path %s', str(paths))
975978
# Load TrueType fonts and create font dictionary.
976979

0 commit comments

Comments
 (0)