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

Skip to content

Commit 1330753

Browse files
committed
Deprecate dviread.Encoding.
In 2c0f5ec I found that dviread.Encoding was mostly broken (it didn't correctly split entries in the encoding file and instead returned everything concatenated as a single string) and introduced _parse_enc to make usetex loading work in SVG. I didn't deprecate Encoding yet because it appeared to work for the pdf backend. As it turns out it "works" because the format needed by the pdf backend is exactly the same as the one in enc files, so it doesn't mind the failure to split the string. Still, using a proper parser (_parse_enc) seems better... So deprecate the broken Encoding.
1 parent 623851f commit 1330753

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

doc/api/next_api_changes/deprecations.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,3 +307,7 @@ The *quality*, *optimize*, and *progressive* keyword arguments to
307307

308308
Such options should now be directly passed to Pillow using
309309
``savefig(..., pil_kwargs={"quality": ..., "optimize": ..., "progressive": ...})``.
310+
311+
``dviread.Encoding``
312+
~~~~~~~~~~~~~~~~~~~~
313+
This class was (mostly) broken and is deprecated.

lib/matplotlib/backends/backend_pdf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -763,7 +763,7 @@ def _embedTeXFont(self, fontinfo):
763763

764764
# Encoding (if needed)
765765
if fontinfo.encodingfile is not None:
766-
enc = dviread.Encoding(fontinfo.encodingfile)
766+
enc = dviread._parse_enc(fontinfo.encodingfile)
767767
differencesArray = [Name(ch) for ch in enc]
768768
differencesArray = [0] + differencesArray
769769
fontdict['Encoding'] = \

lib/matplotlib/dviread.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -919,6 +919,7 @@ def _parse(self, file):
919919
encoding=encoding, filename=filename)
920920

921921

922+
@cbook.deprecated("3.3")
922923
class Encoding:
923924
r"""
924925
Parses a \*.enc file referenced from a psfonts.map style file.

0 commit comments

Comments
 (0)