Skip to content

Deprecate font_manager.is_opentype_cff_font #30329

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions doc/api/next_api_changes/deprecations/30329-ES.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
``font_manager.is_opentype_cff_font`` is deprecated
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

There is no replacement.
2 changes: 1 addition & 1 deletion lib/matplotlib/font_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -1539,7 +1539,7 @@ def _findfont_cached(self, prop, fontext, directory, fallback_to_default,
return _cached_realpath(result)


@lru_cache
@_api.deprecated("3.11")
def is_opentype_cff_font(filename):
"""
Return whether the given font is a Postscript Compact Font Format Font
Expand Down
6 changes: 4 additions & 2 deletions lib/matplotlib/tests/test_font_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,14 @@ def test_json_serialization(tmp_path):
def test_otf():
fname = '/usr/share/fonts/opentype/freefont/FreeMono.otf'
if Path(fname).exists():
assert is_opentype_cff_font(fname)
with pytest.warns(mpl.MatplotlibDeprecationWarning):
assert is_opentype_cff_font(fname)
for f in fontManager.ttflist:
if 'otf' in f.fname:
with open(f.fname, 'rb') as fd:
res = fd.read(4) == b'OTTO'
assert res == is_opentype_cff_font(f.fname)
with pytest.warns(mpl.MatplotlibDeprecationWarning):
assert res == is_opentype_cff_font(f.fname)


@pytest.mark.skipif(sys.platform == "win32" or not has_fclist,
Expand Down
Loading
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy