test_ttconv.py 655 B

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