frompathlibimportPathimportmatplotlibfrommatplotlib.font_managerimportFontPropertiesfrommatplotlib.testing.decoratorsimportimage_comparisonimportmatplotlib.pyplotasplt@image_comparison(["truetype-conversion.pdf"])# mpltest.ttf does not have "l"/"p" glyphs so we get a warning when trying to# get the font extents.deftest_truetype_conversion(recwarn):fontprop=FontProperties(fname=str(Path(__file__).with_name('mpltest.ttf').resolve()),size=80)matplotlib.rcParams['pdf.fonttype']=3fig,ax=plt.subplots()ax.text(0,0,"ABCDE",fontproperties=fontprop)ax.set_xticks([])ax.set_yticks([])