From 3a5fd4b2cd7b49b1819e892c5fa47efe220c8813 Mon Sep 17 00:00:00 2001 From: Antony Lee Date: Thu, 27 Feb 2020 12:33:33 +0100 Subject: [PATCH] Rename font_bunch to psfont in textpath. It's a PsFont instance. Given than there's quite a few different font classes involved here (DviFont, PsFont, FT2Font, ...), let's use a less ambiguous name. --- lib/matplotlib/textpath.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/matplotlib/textpath.py b/lib/matplotlib/textpath.py index df2dbf94a66c..3c4b940624c1 100644 --- a/lib/matplotlib/textpath.py +++ b/lib/matplotlib/textpath.py @@ -296,15 +296,15 @@ 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 @@ -312,7 +312,7 @@ def _get_ps_font_and_encoding(texname): # 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 @@ -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