test_ttconv.py 540 B

1234567891011121314151617
  1. from pathlib import Path
  2. import matplotlib
  3. from matplotlib.testing.decorators import image_comparison
  4. import matplotlib.pyplot as plt
  5. @image_comparison(["truetype-conversion.pdf"])
  6. # mpltest.ttf does not have "l"/"p" glyphs so we get a warning when trying to
  7. # get the font extents.
  8. def test_truetype_conversion(recwarn):
  9. matplotlib.rcParams['pdf.fonttype'] = 3
  10. fig, ax = plt.subplots()
  11. ax.text(0, 0, "ABCDE",
  12. font=Path(__file__).with_name("mpltest.ttf"), fontsize=80)
  13. ax.set_xticks([])
  14. ax.set_yticks([])