Skip to content

Version 2.0.0_1 breaks OpenType font character spacing on PDF save #8050

@andermannlab

Description

@andermannlab

Bug report

Bug summary

I know that Matplotlib does not officially support OpenType fonts, but I have successfully been using them for axis labels in version 1.5.3 and earlier. I just updated Matplotlib via Macports and the character spacing and alignment broke, especially with larger font sizes. For example, X axis titles that are centered begin at the same position, but have extra wide spacing. This is found with all OpenType fonts that I have tried.

Code for reproduction

  • This requires the free font Canter (not ideal for graphing, but it is available for testing), but can be reproduced with other fonts.
  • I have only included my setting of the fonts and saving the PDF, as this can be reproduced with any plot I've made.
import matplotlib as mpl
import matplotlib.pyplot as plt
f = {'family':'Canter;, 'weight':'light', 'size':20}
mpl.rc('font', **f)

plt.savefig('test.pdf', transparent=True)

Actual outcome

170208-correlation-version 2.pdf

Expected outcome

170208-correlation-version 1.5.pdf

  • This worked in v 1.5.3 and does not work in 2.0.0

Matplotlib version

  • Python 2.7, Matplotlib versions 1.5.3 and 2.0.0, installed via macports

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions