Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

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

Sign up
Appearance settings

Commit149992b

Browse files
committed
Parse {lua,xe}tex-generated dvi in dviread.
1 parent99a521b commit149992b

File tree

11 files changed

+287
-214
lines changed

11 files changed

+287
-214
lines changed

‎lib/matplotlib/backends/backend_pdf.py

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -940,18 +940,12 @@ def dviFontName(self, dvifont):
940940

941941
tex_font_map=dviread.PsfontsMap(dviread.find_tex_file('pdftex.map'))
942942
psfont=tex_font_map[dvifont.texname]
943-
ifpsfont.filenameisNone:
944-
raiseValueError(
945-
"No usable font file found for {} (TeX: {}); "
946-
"the font may lack a Type-1 version"
947-
.format(psfont.psname,dvifont.texname))
948-
949943
pdfname=next(self._internal_font_seq)
950944
_log.debug('Assigning font %s = %s (dvi)',pdfname,dvifont.texname)
951945
self._dviFontInfo[dvifont.texname]=types.SimpleNamespace(
952946
dvifont=dvifont,
953947
pdfname=pdfname,
954-
fontfile=psfont.filename,
948+
fontfile=str(dvifont.path),# raises ValueError ifpsfont.filename is None.
955949
basefont=psfont.psname,
956950
encodingfile=psfont.encoding,
957951
effects=psfont.effects)
@@ -996,11 +990,11 @@ def _embedTeXFont(self, fontinfo):
996990

997991
# Widths
998992
widthsObject=self.reserveObject('font widths')
999-
tfm=fontinfo.dvifont._tfm
993+
font_metrics=fontinfo.dvifont._metrics
1000994
# convert from TeX's 12.20 representation to 1/1000 text space units.
1001-
widths= [(1000*metrics.tex_width)>>20
1002-
if (metrics:=tfm.get_metrics(char))else0
1003-
forcharinrange(max(tfm._glyph_metrics,default=-1)+1)]
995+
widths= [(1000*glyph_metrics.tex_width)>>20
996+
if (glyph_metrics:=font_metrics.get_metrics(char))else0
997+
forcharinrange(max(font_metrics._glyph_metrics,default=-1)+1)]
1004998
self.writeObject(widthsObject,widths)
1005999

10061000
# Font dictionary

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp