Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

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
Loading
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
17 changes: 6 additions & 11 deletions 17 lib/matplotlib/backends/backend_pdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -940,18 +940,13 @@ def dviFontName(self, dvifont):

tex_font_map = dviread.PsfontsMap(dviread.find_tex_file('pdftex.map'))
psfont = tex_font_map[dvifont.texname]
if psfont.filename is None:
raise ValueError(
"No usable font file found for {} (TeX: {}); "
"the font may lack a Type-1 version"
.format(psfont.psname, dvifont.texname))

pdfname = next(self._internal_font_seq)
_log.debug('Assigning font %s = %s (dvi)', pdfname, dvifont.texname)
self._dviFontInfo[dvifont.texname] = types.SimpleNamespace(
dvifont=dvifont,
pdfname=pdfname,
fontfile=psfont.filename,
# raises ValueError if psfont.filename is None.
fontfile=str(dvifont.resolve_path()),
basefont=psfont.psname,
encodingfile=psfont.encoding,
effects=psfont.effects)
Expand Down Expand Up @@ -996,11 +991,11 @@ def _embedTeXFont(self, fontinfo):

# Widths
widthsObject = self.reserveObject('font widths')
tfm = fontinfo.dvifont._tfm
font_metrics = fontinfo.dvifont._metrics
# convert from TeX's 12.20 representation to 1/1000 text space units.
widths = [(1000 * metrics.tex_width) >> 20
if (metrics := tfm.get_metrics(char)) else 0
for char in range(max(tfm._glyph_metrics, default=-1) + 1)]
widths = [(1000 * glyph_metrics.tex_width) >> 20
if (glyph_metrics := font_metrics.get_metrics(char)) else 0
for char in range(max(font_metrics._glyph_metrics, default=-1) + 1)]
self.writeObject(widthsObject, widths)

# Font dictionary
Expand Down
10 changes: 7 additions & 3 deletions 10 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
Morty Proxy This is a proxified and sanitized view of the page, visit original site.