How to use Adobe afm fonts in matplotlib text?
<p>I want to add a text to a figure using an AFM font. I know that I can pass the <code>fontproperties</code> or the <code>fontname</code> keyword argument when creating a text. </p>

<p>Regarding the usage of AFM fonts in matplotlib, I found <a href="http://matplotlib.org/api/afm_api.html" rel="nofollow">this</a> and <a href="http://matplotlib.org/api/font_manager_api.html#matplotlib.font_manager.afmFontProperty" rel="nofollow">this</a>. </p>

<p>I can't pass a Font instance create by <code>matplotlib.font_manager.afmFontProperty</code> as <code>fontproperties</code> kwarg.</p>

<p>The font I intend to use is URW Chancery L and located in <code>/usr/share/fonts/type1/gsfonts/z003034l.afm</code>. How can I make matplotlib use this font?</p>

<p>Also I looked for converters from afm to ttf but could not find any, maybe you have a suggestion?</p>

<p>I'm using matplotlib 1.5.3 on Ubuntu 16.04.</p>

<p>What is an "AFM font"? AFM files are <strong>A</strong>dobe <strong>F</strong>ont <strong>M</strong>etrics files, which only contain metadata around glyph bounds, kerning pairs, etc. as a convenient lookup mechanism when you don't want to mine the real font file for that information (handy for typesetting, where having the metrics available as separate resource makes things a hell of a lot faster), they are not themselves fonts in any way. You would still need a (now mostly defunct) <code>.pfa</code> or <code>.pfb</code> font file ("printer font; ascii" and "printer font; binary", respectively) to do any kind of actual text rendering. Without those, all you can do is mark the appropriate region in which text <em>would</em> be drawn if you also had the font itself available =)</p>

<p>(this is actually what TeX and PDF do - they use the font metrics to construct "empty boxes" inside of which text will ultimately be rendered once all the typesetting has been determined and the boxes no longer move around)</p>

python matplotlib fonts adobe