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