Skip to content

Commit 7a628e5

Browse files
committed
Deprecate font_manager.is_opentype_cff_font
According to the docs, it was used for PostScript and PDF which "cannot subset those fonts". However, that is no longer true, and there are no users of this function.
1 parent 7dae1e5 commit 7a628e5

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
``font_manager.is_opentype_cff_font`` is deprecated
2+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3+
4+
There is no replacement.

lib/matplotlib/font_manager.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1539,7 +1539,7 @@ def _findfont_cached(self, prop, fontext, directory, fallback_to_default,
15391539
return _cached_realpath(result)
15401540

15411541

1542-
@lru_cache
1542+
@_api.deprecated("3.11")
15431543
def is_opentype_cff_font(filename):
15441544
"""
15451545
Return whether the given font is a Postscript Compact Font Format Font

lib/matplotlib/tests/test_font_manager.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,14 @@ def test_json_serialization(tmp_path):
6767
def test_otf():
6868
fname = '/usr/share/fonts/opentype/freefont/FreeMono.otf'
6969
if Path(fname).exists():
70-
assert is_opentype_cff_font(fname)
70+
with pytest.warns(mpl.MatplotlibDeprecationWarning):
71+
assert is_opentype_cff_font(fname)
7172
for f in fontManager.ttflist:
7273
if 'otf' in f.fname:
7374
with open(f.fname, 'rb') as fd:
7475
res = fd.read(4) == b'OTTO'
75-
assert res == is_opentype_cff_font(f.fname)
76+
with pytest.warns(mpl.MatplotlibDeprecationWarning):
77+
assert res == is_opentype_cff_font(f.fname)
7678

7779

7880
@pytest.mark.skipif(sys.platform == "win32" or not has_fclist,

0 commit comments

Comments
 (0)