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

Skip to content

Rename font_bunch to psfont in textpath. #16584

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

Merged
merged 1 commit into from
Mar 10, 2020
Merged
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
16 changes: 8 additions & 8 deletions lib/matplotlib/textpath.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,23 +296,23 @@ def get_glyphs_tex(self, prop, s, glyph_map=None,
@functools.lru_cache(50)
def _get_ps_font_and_encoding(texname):
tex_font_map = dviread.PsfontsMap(dviread.find_tex_file('pdftex.map'))
font_bunch = tex_font_map[texname]
if font_bunch.filename is None:
psfont = tex_font_map[texname]
if psfont.filename is None:
raise ValueError(
f"No usable font file found for {font_bunch.psname} "
f"({texname}). The font may lack a Type-1 version.")
f"No usable font file found for {psfont.psname} ({texname}). "
f"The font may lack a Type-1 version.")

font = get_font(font_bunch.filename)
font = get_font(psfont.filename)

if font_bunch.encoding:
if psfont.encoding:
# If psfonts.map specifies an encoding, use it: it gives us a
# mapping of glyph indices to Adobe glyph names; use it to convert
# dvi indices to glyph names and use the FreeType-synthesized
# unicode charmap to convert glyph names to glyph indices (with
# FT_Get_Name_Index/get_name_index), and load the glyph using
# FT_Load_Glyph/load_glyph. (That charmap has a coverage at least
# as good as, and possibly better than, the native charmaps.)
enc = dviread._parse_enc(font_bunch.encoding)
enc = dviread._parse_enc(psfont.encoding)
else:
# If psfonts.map specifies no encoding, the indices directly
# map to the font's "native" charmap; so don't use the
Expand All @@ -331,7 +331,7 @@ def _get_ps_font_and_encoding(texname):
break
else:
_log.warning("No supported encoding in font (%s).",
font_bunch.filename)
psfont.filename)
enc = None

return font, enc
Expand Down