@@ -940,18 +940,12 @@ def dviFontName(self, dvifont):
940
940
941
941
tex_font_map = dviread .PsfontsMap (dviread .find_tex_file ('pdftex.map' ))
942
942
psfont = tex_font_map [dvifont .texname ]
943
- if psfont .filename is None :
944
- raise ValueError (
945
- "No usable font file found for {} (TeX: {}); "
946
- "the font may lack a Type-1 version"
947
- .format (psfont .psname , dvifont .texname ))
948
-
949
943
pdfname = next (self ._internal_font_seq )
950
944
_log .debug ('Assigning font %s = %s (dvi)' , pdfname , dvifont .texname )
951
945
self ._dviFontInfo [dvifont .texname ] = types .SimpleNamespace (
952
946
dvifont = dvifont ,
953
947
pdfname = pdfname ,
954
- fontfile = psfont .filename ,
948
+ fontfile = str ( dvifont . path ), # raises ValueError if psfont.filename is None.
955
949
basefont = psfont .psname ,
956
950
encodingfile = psfont .encoding ,
957
951
effects = psfont .effects )
@@ -996,11 +990,11 @@ def _embedTeXFont(self, fontinfo):
996
990
997
991
# Widths
998
992
widthsObject = self .reserveObject ('font widths' )
999
- tfm = fontinfo .dvifont ._tfm
993
+ font_metrics = fontinfo .dvifont ._metrics
1000
994
# 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 )) else 0
1003
- for char in range (max (tfm ._glyph_metrics , default = - 1 ) + 1 )]
995
+ widths = [(1000 * glyph_metrics .tex_width ) >> 20
996
+ if (glyph_metrics := font_metrics .get_metrics (char )) else 0
997
+ for char in range (max (font_metrics ._glyph_metrics , default = - 1 ) + 1 )]
1004
998
self .writeObject (widthsObject , widths )
1005
999
1006
1000
# Font dictionary
0 commit comments