Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 75e30bb

Browse files
committed
deprecate parse_afm()
1 parent 7e7a8f1 commit 75e30bb

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

doc/api/next_api_changes/2018-02-15-AL-deprecations.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ The following modules are deprecated:
1010

1111
The following classes, methods, functions, and attributes are deprecated:
1212

13+
- ``afm.parse_afm``,
1314
- ``Annotation.arrow``,
1415
- ``cbook.GetRealpathAndStat``, ``cbook.Locked``,
1516
- ``cbook.is_numlike`` (use ``isinstance(..., numbers.Number)`` instead),

lib/matplotlib/afm.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,16 +42,15 @@
4242
import sys
4343

4444
from ._mathtext_data import uni2type1
45+
from matplotlib.cbook import deprecated
4546

46-
# Convert string the a python type
4747

4848
# some afm files have floats where we are expecting ints -- there is
4949
# probably a better way to handle this (support floats, round rather
5050
# than truncate). But I don't know what the best approach is now and
5151
# this change to _to_int should at least prevent mpl from crashing on
5252
# these JDH (2009-11-06)
5353

54-
5554
def _to_int(x):
5655
return int(float(x))
5756

@@ -358,7 +357,12 @@ def _parse_optional(fh):
358357
return d[b'StartKernData'], d[b'StartComposites']
359358

360359

360+
@deprecated("3.0", "Use the class AFM instead.")
361361
def parse_afm(fh):
362+
return _parse_afm(fh)
363+
364+
365+
def _parse_afm(fh):
362366
"""
363367
Parse the Adobe Font Metrics file in file handle *fh*.
364368
@@ -391,7 +395,7 @@ def __init__(self, fh):
391395
self._metrics,
392396
self._metrics_by_name,
393397
self._kern,
394-
self._composite) = parse_afm(fh)
398+
self._composite) = _parse_afm(fh)
395399

396400
def get_bbox_char(self, c, isord=False):
397401
if not isord:

0 commit comments

Comments
 (0)