Skip to content

Commit 365c54d

Browse files
committed
Parse {lua,xe}tex-generated dvi in dviread.
1 parent 4284a0b commit 365c54d

File tree

12 files changed

+306
-210
lines changed

12 files changed

+306
-210
lines changed

lib/matplotlib/backends/backend_pdf.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1035,11 +1035,10 @@ def _embedTeXFont(self, dvifont):
10351035
fontdict['Encoding'] = self._generate_encoding(encoding)
10361036
fc = fontdict['FirstChar'] = min(encoding.keys(), default=0)
10371037
lc = fontdict['LastChar'] = max(encoding.keys(), default=255)
1038-
10391038
# 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
1039+
font_metrics = dvifont._metrics
1040+
widths = [(1000 * glyph_metrics.tex_width) >> 20
1041+
if (glyph_metrics := font_metrics.get_metrics(char)) else 0
10431042
for char in range(fc, lc + 1)]
10441043
fontdict['Widths'] = widthsObject = self.reserveObject('glyph widths')
10451044
self.writeObject(widthsObject, widths)

lib/matplotlib/cbook.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,16 +43,20 @@ class _ExceptionInfo:
4343
users and result in incorrect tracebacks.
4444
"""
4545

46-
def __init__(self, cls, *args):
46+
def __init__(self, cls, *args, notes=None):
4747
self._cls = cls
4848
self._args = args
49+
self._notes = notes if notes is not None else []
4950

5051
@classmethod
5152
def from_exception(cls, exc):
52-
return cls(type(exc), *exc.args)
53+
return cls(type(exc), *exc.args, notes=getattr(exc, "__notes__", []))
5354

5455
def to_exception(self):
55-
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
5660

5761

5862
def _get_running_interactive_framework():

0 commit comments

Comments
 (0)
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