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

Skip to content

Parse {lua,xe}tex-generated dvi in dviread. #29939

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
7 changes: 3 additions & 4 deletions lib/matplotlib/backends/backend_pdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -1035,11 +1035,10 @@ def _embedTeXFont(self, dvifont):
fontdict['Encoding'] = self._generate_encoding(encoding)
fc = fontdict['FirstChar'] = min(encoding.keys(), default=0)
lc = fontdict['LastChar'] = max(encoding.keys(), default=255)

# Convert glyph widths from TeX 12.20 fixed point to 1/1000 text space units
tfm = dvifont._tfm
widths = [(1000 * metrics.tex_width) >> 20
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
for char in range(fc, lc + 1)]
fontdict['Widths'] = widthsObject = self.reserveObject('glyph widths')
self.writeObject(widthsObject, widths)
Expand Down
10 changes: 7 additions & 3 deletions lib/matplotlib/cbook.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,20 @@ class _ExceptionInfo:
users and result in incorrect tracebacks.
"""

def __init__(self, cls, *args):
def __init__(self, cls, *args, notes=None):
self._cls = cls
self._args = args
self._notes = notes if notes is not None else []

@classmethod
def from_exception(cls, exc):
return cls(type(exc), *exc.args)
return cls(type(exc), *exc.args, notes=getattr(exc, "__notes__", []))

def to_exception(self):
return self._cls(*self._args)
exc = self._cls(*self._args)
for note in self._notes:
exc.add_note(note)
return exc


def _get_running_interactive_framework():
Expand Down
Loading
Loading