There was an error while loading. Please reload this page.
1 parent 40a47e5 commit bba17d7Copy full SHA for bba17d7
14 files changed
lib/matplotlib/backends/backend_pdf.py
@@ -1035,11 +1035,10 @@ def _embedTeXFont(self, dvifont):
1035
fontdict['Encoding'] = self._generate_encoding(encoding)
1036
fc = fontdict['FirstChar'] = min(encoding.keys(), default=0)
1037
lc = fontdict['LastChar'] = max(encoding.keys(), default=255)
1038
-
1039
# Convert glyph widths from TeX 12.20 fixed point to 1/1000 text space units
1040
- tfm = dvifont._tfm
1041
- widths = [(1000 * metrics.tex_width) >> 20
1042
- if (metrics := tfm.get_metrics(char)) else 0
+ font_metrics = dvifont._metrics
+ widths = [(1000 * glyph_metrics.tex_width) >> 20
+ if (glyph_metrics := font_metrics.get_metrics(char)) else 0
1043
for char in range(fc, lc + 1)]
1044
fontdict['Widths'] = widthsObject = self.reserveObject('glyph widths')
1045
self.writeObject(widthsObject, widths)
lib/matplotlib/cbook.py
@@ -43,16 +43,20 @@ class _ExceptionInfo:
43
users and result in incorrect tracebacks.
44
"""
45
46
- def __init__(self, cls, *args):
+ def __init__(self, cls, *args, notes=None):
47
self._cls = cls
48
self._args = args
49
+ self._notes = notes if notes is not None else []
50
51
@classmethod
52
def from_exception(cls, exc):
- return cls(type(exc), *exc.args)
53
+ return cls(type(exc), *exc.args, notes=getattr(exc, "__notes__", []))
54
55
def to_exception(self):
- return self._cls(*self._args)
56
+ exc = self._cls(*self._args)
57
+ for note in self._notes:
58
+ exc.add_note(note)
59
+ return exc
60
61
62
def _get_running_interactive_framework():
0 commit comments