Skip to content

Wrong reader in mathext.py #7106

Closed
Closed

Description

@lijunsun

This bug happens when drawing a figure when using AFM fonts (ps.useafm=True) and setting ScalarFormatter(useMathText=True),

The _sanity_check() function in aft.py requires a BufferedReader, while the "_get_font()" function in mathext.py returns TextIOWrapper

if cached_font is None:
fname = os.path.join(self.basepath, basename + ".afm")
with open(fname, 'r') as fd:
print(fd)
cached_font = AFM(fd)
cached_font.fname = fname
self.fonts[basename] = cached_font
self.fonts[cached_font.get_fontname()] = cached_font
return cached_font

The line "with open(fname, 'r') as fd:" should be "with open(fname, 'rb') as fd:"

Activity

  1. tacaswell commented on Sep 14, 2016

    @tacaswell
    Member

    Can you try with the 2.0.0b4 release?

    This should be fixed by #6898

  2. tacaswell commented on Sep 14, 2016

    @tacaswell
    Member

    @lijunsun Thank you for taking the time to report this issue and suggest a solution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions