<divid="unreleased-message"> You are reading an old version of the documentation (v3.3.1). For the latest version see <ahref="https://matplotlib.org/stable/api/font_manager_api.html">https://matplotlib.org/stable/api/font_manager_api.html</a></div>
<spanid="matplotlib-font-manager"></span><h1><codeclass="docutils literal notranslate"><spanclass="pre">matplotlib.font_manager</span></code><aclass="headerlink" href="#module-matplotlib.font_manager" title="Permalink to this headline">¶</a></h1>
<p>A module for finding, managing, and using fonts across platforms.</p>
<p>This module provides a single <aclass="reference internal" href="#matplotlib.font_manager.FontManager" title="matplotlib.font_manager.FontManager"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">FontManager</span></code></a> instance that can
be shared across backends and platforms. The <aclass="reference internal" href="#matplotlib.font_manager.findfont" title="matplotlib.font_manager.findfont"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">findfont</span></code></a>
function returns the best TrueType (TTF) font file in the local or
system font path that matches the specified <aclass="reference internal" href="#matplotlib.font_manager.FontProperties" title="matplotlib.font_manager.FontProperties"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">FontProperties</span></code></a>
instance. The <aclass="reference internal" href="#matplotlib.font_manager.FontManager" title="matplotlib.font_manager.FontManager"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">FontManager</span></code></a> also handles Adobe Font Metrics
(AFM) font files for use by the PostScript backend.</p>
<p>The design is based on the <aclass="reference external" href="http://www.w3.org/TR/1998/REC-CSS2-19980512/">W3C Cascading Style Sheet, Level 1 (CSS1)
font specification</a>.
Future versions may implement the Level 2 or 2.1 specifications.</p>
<dlclass="py class">
<dtid="matplotlib.font_manager.FontEntry">
<emclass="property">class </em><codeclass="descclassname">matplotlib.font_manager.</code><codeclass="descname">FontEntry</code><spanclass="sig-paren">(</span><em><spanclass="n">fname</span><spanclass="o">=</span><spanclass="default_value">''</span></em>, <em><spanclass="n">name</span><spanclass="o">=</span><spanclass="default_value">''</span></em>, <em><spanclass="n">style</span><spanclass="o">=</span><spanclass="default_value">'normal'</span></em>, <em><spanclass="n">variant</span><spanclass="o">=</span><spanclass="default_value">'normal'</span></em>, <em><spanclass="n">weight</span><spanclass="o">=</span><spanclass="default_value">'normal'</span></em>, <em><spanclass="n">stretch</span><spanclass="o">=</span><spanclass="default_value">'normal'</span></em>, <em><spanclass="n">size</span><spanclass="o">=</span><spanclass="default_value">'medium'</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/font_manager.html#FontEntry"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.font_manager.FontEntry" title="Permalink to this definition">¶</a></dt>
<p>A class for storing Font properties. It is used when populating
the font lookup dictionary.</p>
</dd></dl>
<dlclass="py class">
<dtid="matplotlib.font_manager.FontManager">
<emclass="property">class </em><codeclass="descclassname">matplotlib.font_manager.</code><codeclass="descname">FontManager</code><spanclass="sig-paren">(</span><em><spanclass="n">size</span><spanclass="o">=</span><spanclass="default_value">None</span></em>, <em><spanclass="n">weight</span><spanclass="o">=</span><spanclass="default_value">'normal'</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/font_manager.html#FontManager"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.font_manager.FontManager" title="Permalink to this definition">¶</a></dt>
<p>On import, the <aclass="reference internal" href="#matplotlib.font_manager.FontManager" title="matplotlib.font_manager.FontManager"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">FontManager</span></code></a> singleton instance creates a list of ttf and
afm fonts and caches their <aclass="reference internal" href="#matplotlib.font_manager.FontProperties" title="matplotlib.font_manager.FontProperties"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">FontProperties</span></code></a>. The <aclass="reference internal" href="#matplotlib.font_manager.FontManager.findfont" title="matplotlib.font_manager.FontManager.findfont"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">FontManager.findfont</span></code></a>
method does a nearest neighbor search to find the font that most closely
matches the specification. If no good enough match is found, the default
<codeclass="descname">addfont</code><spanclass="sig-paren">(</span><em><spanclass="n">self</span></em>, <em><spanclass="n">path</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/font_manager.html#FontManager.addfont"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.font_manager.FontManager.addfont" title="Permalink to this definition">¶</a></dt>
<dd><p>Cache the properties of the font at <em>path</em> to make it available to the
<aclass="reference internal" href="#matplotlib.font_manager.FontManager" title="matplotlib.font_manager.FontManager"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">FontManager</span></code></a>. The type of font is inferred from the path suffix.</p>
<emclass="property">property </em><codeclass="descname">defaultFont</code><aclass="headerlink" href="#matplotlib.font_manager.FontManager.defaultFont" title="Permalink to this definition">¶</a></dt>
<dt><strong>prop</strong><spanclass="classifier">str or <aclass="reference internal" href="#matplotlib.font_manager.FontProperties" title="matplotlib.font_manager.FontProperties"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">FontProperties</span></code></a></span></dt><dd><p>The font properties to search for. This can be either a
<aclass="reference internal" href="#matplotlib.font_manager.FontProperties" title="matplotlib.font_manager.FontProperties"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">FontProperties</span></code></a> object or a string defining a
<emclass="property">static </em><codeclass="descname">get_default_size</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/font_manager.html#FontManager.get_default_size"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.font_manager.FontManager.get_default_size" title="Permalink to this definition">¶</a></dt>
<codeclass="descname">get_default_weight</code><spanclass="sig-paren">(</span><em><spanclass="n">self</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/font_manager.html#FontManager.get_default_weight"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.font_manager.FontManager.get_default_weight" title="Permalink to this definition">¶</a></dt>
<codeclass="descname">score_family</code><spanclass="sig-paren">(</span><em><spanclass="n">self</span></em>, <em><spanclass="n">families</span></em>, <em><spanclass="n">family2</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/font_manager.html#FontManager.score_family"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.font_manager.FontManager.score_family" title="Permalink to this definition">¶</a></dt>
<dd><p>Return a match score between the list of font families in
<em>families</em> and the font family name <em>family2</em>.</p>
<p>An exact match at the head of the list returns 0.0.</p>
<p>A match further down the list will return between 0 and 1.</p>
<codeclass="descname">score_size</code><spanclass="sig-paren">(</span><em><spanclass="n">self</span></em>, <em><spanclass="n">size1</span></em>, <em><spanclass="n">size2</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/font_manager.html#FontManager.score_size"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.font_manager.FontManager.score_size" title="Permalink to this definition">¶</a></dt>
<dd><p>Return a match score between <em>size1</em> and <em>size2</em>.</p>
<p>If <em>size2</em> (the size specified in the font file) is 'scalable', this
function always returns 0.0, since any font size can be generated.</p>
<p>Otherwise, the result is the absolute distance between <em>size1</em> and
<em>size2</em>, normalized so that the usual range of font sizes (6pt -
<codeclass="descname">score_stretch</code><spanclass="sig-paren">(</span><em><spanclass="n">self</span></em>, <em><spanclass="n">stretch1</span></em>, <em><spanclass="n">stretch2</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/font_manager.html#FontManager.score_stretch"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.font_manager.FontManager.score_stretch" title="Permalink to this definition">¶</a></dt>
<dd><p>Return a match score between <em>stretch1</em> and <em>stretch2</em>.</p>
<p>The result is the absolute value of the difference between the
CSS numeric values of <em>stretch1</em> and <em>stretch2</em>, normalized
<codeclass="descname">score_style</code><spanclass="sig-paren">(</span><em><spanclass="n">self</span></em>, <em><spanclass="n">style1</span></em>, <em><spanclass="n">style2</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/font_manager.html#FontManager.score_style"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.font_manager.FontManager.score_style" title="Permalink to this definition">¶</a></dt>
<dd><p>Return a match score between <em>style1</em> and <em>style2</em>.</p>
<p>An exact match returns 0.0.</p>
<p>A match between 'italic' and 'oblique' returns 0.1.</p>
<codeclass="descname">score_variant</code><spanclass="sig-paren">(</span><em><spanclass="n">self</span></em>, <em><spanclass="n">variant1</span></em>, <em><spanclass="n">variant2</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/font_manager.html#FontManager.score_variant"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.font_manager.FontManager.score_variant" title="Permalink to this definition">¶</a></dt>
<dd><p>Return a match score between <em>variant1</em> and <em>variant2</em>.</p>
<codeclass="descname">score_weight</code><spanclass="sig-paren">(</span><em><spanclass="n">self</span></em>, <em><spanclass="n">weight1</span></em>, <em><spanclass="n">weight2</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/font_manager.html#FontManager.score_weight"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.font_manager.FontManager.score_weight" title="Permalink to this definition">¶</a></dt>
<dd><p>Return a match score between <em>weight1</em> and <em>weight2</em>.</p>
<p>The result is 0.0 if both weight1 and weight 2 are given as strings
and have the same value.</p>
<p>Otherwise, the result is the absolute value of the difference between
the CSS numeric values of <em>weight1</em> and <em>weight2</em>, normalized between
<codeclass="descname">set_default_weight</code><spanclass="sig-paren">(</span><em><spanclass="n">self</span></em>, <em><spanclass="n">weight</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/font_manager.html#FontManager.set_default_weight"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.font_manager.FontManager.set_default_weight" title="Permalink to this definition">¶</a></dt>
<dd><p>Set the default font weight. The initial value is 'normal'.</p>
</dd></dl>
</dd></dl>
<dlclass="py class">
<dtid="matplotlib.font_manager.FontProperties">
<emclass="property">class </em><codeclass="descclassname">matplotlib.font_manager.</code><codeclass="descname">FontProperties</code><spanclass="sig-paren">(</span><em><spanclass="n">family</span><spanclass="o">=</span><spanclass="default_value">None</span></em>, <em><spanclass="n">style</span><spanclass="o">=</span><spanclass="default_value">None</span></em>, <em><spanclass="n">variant</span><spanclass="o">=</span><spanclass="default_value">None</span></em>, <em><spanclass="n">weight</span><spanclass="o">=</span><spanclass="default_value">None</span></em>, <em><spanclass="n">stretch</span><spanclass="o">=</span><spanclass="default_value">None</span></em>, <em><spanclass="n">size</span><spanclass="o">=</span><spanclass="default_value">None</span></em>, <em><spanclass="n">fname</span><spanclass="o">=</span><spanclass="default_value">None</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/font_manager.html#FontProperties"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.font_manager.FontProperties" title="Permalink to this definition">¶</a></dt>
<p>Alternatively, a font may be specified using the absolute path to a font
file, by using the <em>fname</em> kwarg. However, in this case, it is typically
simpler to just pass the path (as a <aclass="reference external" href="https://docs.python.org/3/library/pathlib.html#pathlib.Path" title="(in Python v3.8)"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">pathlib.Path</span></code></a>, not a <aclass="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.8)"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">str</span></code></a>) to the
<em>font</em> kwarg of the <aclass="reference internal" href="text_api.html#matplotlib.text.Text" title="matplotlib.text.Text"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">Text</span></code></a> object.</p>
<p>The preferred usage of font sizes is to use the relative values,
e.g., 'large', instead of absolute font sizes, e.g., 12. This
approach allows all text sizes to be made larger or smaller based
on the font manager's default font size.</p>
<p>This class will also accept a <aclass="reference external" href="https://www.freedesktop.org/wiki/Software/fontconfig/">fontconfig</a><aclass="reference external" href="https://www.freedesktop.org/software/fontconfig/fontconfig-user.html">pattern</a>, if it is the only
argument provided. This support does not depend on fontconfig; we are
merely borrowing its pattern syntax for use here.</p>
<p>Note that Matplotlib's internal font manager and fontconfig use a
different algorithm to lookup fonts, so the results of the same pattern
may be different in Matplotlib than in other applications that use
<codeclass="descname">copy</code><spanclass="sig-paren">(</span><em><spanclass="n">self</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/font_manager.html#FontProperties.copy"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.font_manager.FontProperties.copy" title="Permalink to this definition">¶</a></dt>
<codeclass="descname">get_family</code><spanclass="sig-paren">(</span><em><spanclass="n">self</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/font_manager.html#FontProperties.get_family"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.font_manager.FontProperties.get_family" title="Permalink to this definition">¶</a></dt>
<dd><p>Return a list of font names that comprise the font family.</p>
<codeclass="descname">get_file</code><spanclass="sig-paren">(</span><em><spanclass="n">self</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/font_manager.html#FontProperties.get_file"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.font_manager.FontProperties.get_file" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the filename of the associated font.</p>
<codeclass="descname">get_fontconfig_pattern</code><spanclass="sig-paren">(</span><em><spanclass="n">self</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/font_manager.html#FontProperties.get_fontconfig_pattern"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.font_manager.FontProperties.get_fontconfig_pattern" title="Permalink to this definition">¶</a></dt>
<dd><p>Get a <aclass="reference external" href="https://www.freedesktop.org/wiki/Software/fontconfig/">fontconfig</a><aclass="reference external" href="https://www.freedesktop.org/software/fontconfig/fontconfig-user.html">pattern</a> suitable for looking up the font as
specified with fontconfig's <codeclass="docutils literal notranslate"><spanclass="pre">fc-match</span></code> utility.</p>
<p>This support does not depend on fontconfig; we are merely borrowing its
<codeclass="descname">get_name</code><spanclass="sig-paren">(</span><em><spanclass="n">self</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/font_manager.html#FontProperties.get_name"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.font_manager.FontProperties.get_name" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the name of the font that best matches the font properties.</p>
<codeclass="descname">get_size</code><spanclass="sig-paren">(</span><em><spanclass="n">self</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/font_manager.html#FontProperties.get_size"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.font_manager.FontProperties.get_size" title="Permalink to this definition">¶</a></dt>
<codeclass="descname">get_size_in_points</code><spanclass="sig-paren">(</span><em><spanclass="n">self</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/font_manager.html#FontProperties.get_size_in_points"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.font_manager.FontProperties.get_size_in_points" title="Permalink to this definition">¶</a></dt>
<codeclass="descname">get_slant</code><spanclass="sig-paren">(</span><em><spanclass="n">self</span></em><spanclass="sig-paren">)</span><aclass="headerlink" href="#matplotlib.font_manager.FontProperties.get_slant" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the font style. Values are: 'normal', 'italic' or 'oblique'.</p>
<codeclass="descname">get_stretch</code><spanclass="sig-paren">(</span><em><spanclass="n">self</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/font_manager.html#FontProperties.get_stretch"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.font_manager.FontProperties.get_stretch" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the font stretch or width. Options are: 'ultra-condensed',
<codeclass="descname">get_style</code><spanclass="sig-paren">(</span><em><spanclass="n">self</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/font_manager.html#FontProperties.get_style"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.font_manager.FontProperties.get_style" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the font style. Values are: 'normal', 'italic' or 'oblique'.</p>
<codeclass="descname">get_variant</code><spanclass="sig-paren">(</span><em><spanclass="n">self</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/font_manager.html#FontProperties.get_variant"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.font_manager.FontProperties.get_variant" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the font variant. Values are: 'normal' or 'small-caps'.</p>
<codeclass="descname">get_weight</code><spanclass="sig-paren">(</span><em><spanclass="n">self</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/font_manager.html#FontProperties.get_weight"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.font_manager.FontProperties.get_weight" title="Permalink to this definition">¶</a></dt>
<dd><p>Set the font weight. Options are: A numeric value in the
range 0-1000 or one of 'light', 'normal', 'regular', 'book',
<codeclass="descname">set_family</code><spanclass="sig-paren">(</span><em><spanclass="n">self</span></em>, <em><spanclass="n">family</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/font_manager.html#FontProperties.set_family"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.font_manager.FontProperties.set_family" title="Permalink to this definition">¶</a></dt>
<dd><p>Change the font family. May be either an alias (generic name
is CSS parlance), such as: 'serif', 'sans-serif', 'cursive',
'fantasy', or 'monospace', a real font name or a list of real
font names. Real font names are not supported when
<codeclass="descname">set_file</code><spanclass="sig-paren">(</span><em><spanclass="n">self</span></em>, <em><spanclass="n">file</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/font_manager.html#FontProperties.set_file"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.font_manager.FontProperties.set_file" title="Permalink to this definition">¶</a></dt>
<dd><p>Set the filename of the fontfile to use. In this case, all
<codeclass="descname">set_fontconfig_pattern</code><spanclass="sig-paren">(</span><em><spanclass="n">self</span></em>, <em><spanclass="n">pattern</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/font_manager.html#FontProperties.set_fontconfig_pattern"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.font_manager.FontProperties.set_fontconfig_pattern" title="Permalink to this definition">¶</a></dt>
<dd><p>Set the properties by parsing a <aclass="reference external" href="https://www.freedesktop.org/wiki/Software/fontconfig/">fontconfig</a><em>pattern</em>.</p>
<p>This support does not depend on fontconfig; we are merely borrowing its
<codeclass="descname">set_name</code><spanclass="sig-paren">(</span><em><spanclass="n">self</span></em>, <em><spanclass="n">family</span></em><spanclass="sig-paren">)</span><aclass="headerlink" href="#matplotlib.font_manager.FontProperties.set_name" title="Permalink to this definition">¶</a></dt>
<dd><p>Change the font family. May be either an alias (generic name
is CSS parlance), such as: 'serif', 'sans-serif', 'cursive',
'fantasy', or 'monospace', a real font name or a list of real
font names. Real font names are not supported when
<codeclass="descname">set_size</code><spanclass="sig-paren">(</span><em><spanclass="n">self</span></em>, <em><spanclass="n">size</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/font_manager.html#FontProperties.set_size"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.font_manager.FontProperties.set_size" title="Permalink to this definition">¶</a></dt>
<dd><p>Set the font size. Either an relative value of 'xx-small',
<codeclass="descname">set_slant</code><spanclass="sig-paren">(</span><em><spanclass="n">self</span></em>, <em><spanclass="n">style</span></em><spanclass="sig-paren">)</span><aclass="headerlink" href="#matplotlib.font_manager.FontProperties.set_slant" title="Permalink to this definition">¶</a></dt>
<dd><p>Set the font style. Values are: 'normal', 'italic' or 'oblique'.</p>
<codeclass="descname">set_stretch</code><spanclass="sig-paren">(</span><em><spanclass="n">self</span></em>, <em><spanclass="n">stretch</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/font_manager.html#FontProperties.set_stretch"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.font_manager.FontProperties.set_stretch" title="Permalink to this definition">¶</a></dt>
<dd><p>Set the font stretch or width. Options are: 'ultra-condensed',
<codeclass="descname">set_style</code><spanclass="sig-paren">(</span><em><spanclass="n">self</span></em>, <em><spanclass="n">style</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/font_manager.html#FontProperties.set_style"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.font_manager.FontProperties.set_style" title="Permalink to this definition">¶</a></dt>
<dd><p>Set the font style. Values are: 'normal', 'italic' or 'oblique'.</p>
<codeclass="descname">set_variant</code><spanclass="sig-paren">(</span><em><spanclass="n">self</span></em>, <em><spanclass="n">variant</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/font_manager.html#FontProperties.set_variant"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.font_manager.FontProperties.set_variant" title="Permalink to this definition">¶</a></dt>
<dd><p>Set the font variant. Values are: 'normal' or 'small-caps'.</p>
<codeclass="descname">set_weight</code><spanclass="sig-paren">(</span><em><spanclass="n">self</span></em>, <em><spanclass="n">weight</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/font_manager.html#FontProperties.set_weight"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.font_manager.FontProperties.set_weight" title="Permalink to this definition">¶</a></dt>
<dd><p>Set the font weight. May be either a numeric value in the
range 0-1000 or one of 'ultralight', 'light', 'normal',
<emclass="property">class </em><codeclass="descclassname">matplotlib.font_manager.</code><codeclass="descname">JSONEncoder</code><spanclass="sig-paren">(</span><em><spanclass="o">**</span><spanclass="n">kwargs</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/font_manager.html#JSONEncoder"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.font_manager.JSONEncoder" title="Permalink to this definition">¶</a></dt>
<p><spanclass="versionmodified deprecated">Deprecated since version 3.2: </span></p>
</div>
<p>Constructor for JSONEncoder, with sensible defaults.</p>
<p>If skipkeys is false, then it is a TypeError to attempt
encoding of keys that are not str, int, float or None. If
skipkeys is True, such items are simply skipped.</p>
<p>If ensure_ascii is true, the output is guaranteed to be str
objects with all incoming non-ASCII characters escaped. If
ensure_ascii is false, the output can contain non-ASCII characters.</p>
<p>If check_circular is true, then lists, dicts, and custom encoded
objects will be checked for circular references during encoding to
prevent an infinite recursion (which would cause an OverflowError).
Otherwise, no such check takes place.</p>
<p>If allow_nan is true, then NaN, Infinity, and -Infinity will be
encoded as such. This behavior is not JSON specification compliant,
but is consistent with most JavaScript based encoders and decoders.
Otherwise, it will be a ValueError to encode such floats.</p>
<p>If sort_keys is true, then the output of dictionaries will be
sorted by key; this is useful for regression tests to ensure
that JSON serializations can be compared on a day-to-day basis.</p>
<p>If indent is a non-negative integer, then JSON array
elements and object members will be pretty-printed with that
indent level. An indent level of 0 will only insert newlines.
None is the most compact representation.</p>
<p>If specified, separators should be an (item_separator, key_separator)
tuple. The default is (', ', ': ') if <em>indent</em> is <codeclass="docutils literal notranslate"><spanclass="pre">None</span></code> and
(',', ': ') otherwise. To get the most compact JSON representation,
you should specify (',', ':') to eliminate whitespace.</p>
<p>If specified, default is a function that gets called for objects
that can't otherwise be serialized. It should return a JSON encodable
version of the object or raise a <codeclass="docutils literal notranslate"><spanclass="pre">TypeError</span></code>.</p>
</dd></dl>
<dlclass="py function">
<dtid="matplotlib.font_manager.afmFontProperty">
<codeclass="descclassname">matplotlib.font_manager.</code><codeclass="descname">afmFontProperty</code><spanclass="sig-paren">(</span><em><spanclass="n">fontpath</span></em>, <em><spanclass="n">font</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/font_manager.html#afmFontProperty"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.font_manager.afmFontProperty" title="Permalink to this definition">¶</a></dt>
<dd><p>Extract information from an AFM font file.</p>
<dt><strong>font</strong><spanclass="classifier"><aclass="reference internal" href="afm_api.html#matplotlib.afm.AFM" title="matplotlib.afm.AFM"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">AFM</span></code></a></span></dt><dd><p>The AFM font file from which information will be extracted.</p>
</dd>
</dl>
</td>
</tr>
<trclass="field-even field"><thclass="field-name">Returns:</th><tdclass="field-body"><dlclass="first last docutils">
<codeclass="descclassname">matplotlib.font_manager.</code><codeclass="descname">createFontList</code><spanclass="sig-paren">(</span><em><spanclass="n">fontfiles</span></em>, <em><spanclass="n">fontext</span><spanclass="o">=</span><spanclass="default_value">'ttf'</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/font_manager.html#createFontList"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.font_manager.createFontList" title="Permalink to this definition">¶</a></dt>
<dd><p>[<em>Deprecated</em>] Create a font lookup list. The default is to create
a list of TrueType fonts. An AFM font list can optionally be
created.</p>
<pclass="rubric">Notes</p>
<divclass="deprecated">
<p><spanclass="versionmodified deprecated">Deprecated since version 3.2.</span></p>
</div>
</dd></dl>
<dlclass="py function">
<dtid="matplotlib.font_manager.findSystemFonts">
<codeclass="descclassname">matplotlib.font_manager.</code><codeclass="descname">findSystemFonts</code><spanclass="sig-paren">(</span><em><spanclass="n">fontpaths</span><spanclass="o">=</span><spanclass="default_value">None</span></em>, <em><spanclass="n">fontext</span><spanclass="o">=</span><spanclass="default_value">'ttf'</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/font_manager.html#findSystemFonts"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.font_manager.findSystemFonts" title="Permalink to this definition">¶</a></dt>
<dd><p>Search for fonts in the specified font paths. If no paths are
given, will use a standard set of system paths, as well as the
list of fonts tracked by fontconfig if fontconfig is installed and
available. A list of TrueType fonts are returned by default with
AFM fonts as an option.</p>
</dd></dl>
<dlclass="py function">
<dtid="matplotlib.font_manager.findfont">
<codeclass="descclassname">matplotlib.font_manager.</code><codeclass="descname">findfont</code><spanclass="sig-paren">(</span><em><spanclass="n">prop</span></em>, <em><spanclass="n">fontext</span><spanclass="o">=</span><spanclass="default_value">'ttf'</span></em>, <em><spanclass="n">directory</span><spanclass="o">=</span><spanclass="default_value">None</span></em>, <em><spanclass="n">fallback_to_default</span><spanclass="o">=</span><spanclass="default_value">True</span></em>, <em><spanclass="n">rebuild_if_missing</span><spanclass="o">=</span><spanclass="default_value">True</span></em><spanclass="sig-paren">)</span><aclass="headerlink" href="#matplotlib.font_manager.findfont" title="Permalink to this definition">¶</a></dt>
<dd><p>Find a font that most closely matches the given font properties.</p>
<dt><strong>prop</strong><spanclass="classifier">str or <aclass="reference internal" href="#matplotlib.font_manager.FontProperties" title="matplotlib.font_manager.FontProperties"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">FontProperties</span></code></a></span></dt><dd><p>The font properties to search for. This can be either a
<aclass="reference internal" href="#matplotlib.font_manager.FontProperties" title="matplotlib.font_manager.FontProperties"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">FontProperties</span></code></a> object or a string defining a
for a description of the font finding algorithm.</p>
</dd></dl>
<dlclass="py function">
<dtid="matplotlib.font_manager.get_font">
<codeclass="descclassname">matplotlib.font_manager.</code><codeclass="descname">get_font</code><spanclass="sig-paren">(</span><em><spanclass="n">filename</span></em>, <em><spanclass="n">hinting_factor</span><spanclass="o">=</span><spanclass="default_value">None</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/font_manager.html#get_font"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.font_manager.get_font" title="Permalink to this definition">¶</a></dt>
<codeclass="descclassname">matplotlib.font_manager.</code><codeclass="descname">get_fontconfig_fonts</code><spanclass="sig-paren">(</span><em><spanclass="n">fontext</span><spanclass="o">=</span><spanclass="default_value">'ttf'</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/font_manager.html#get_fontconfig_fonts"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.font_manager.get_fontconfig_fonts" title="Permalink to this definition">¶</a></dt>
<dd><p>List font filenames known to <codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">fc-list</span></code> having the given extension.</p>
<codeclass="descclassname">matplotlib.font_manager.</code><codeclass="descname">get_fontext_synonyms</code><spanclass="sig-paren">(</span><em><spanclass="n">fontext</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/font_manager.html#get_fontext_synonyms"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.font_manager.get_fontext_synonyms" title="Permalink to this definition">¶</a></dt>
<dd><p>Return a list of file extensions extensions that are synonyms for
<codeclass="descclassname">matplotlib.font_manager.</code><codeclass="descname">is_opentype_cff_font</code><spanclass="sig-paren">(</span><em><spanclass="n">filename</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/font_manager.html#is_opentype_cff_font"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.font_manager.is_opentype_cff_font" title="Permalink to this definition">¶</a></dt>
<dd><p>Return whether the given font is a Postscript Compact Font Format Font
embedded in an OpenType wrapper. Used by the PostScript and PDF backends
that can not subset these fonts.</p>
</dd></dl>
<dlclass="py function">
<dtid="matplotlib.font_manager.json_dump">
<codeclass="descclassname">matplotlib.font_manager.</code><codeclass="descname">json_dump</code><spanclass="sig-paren">(</span><em><spanclass="n">data</span></em>, <em><spanclass="n">filename</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/font_manager.html#json_dump"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.font_manager.json_dump" title="Permalink to this definition">¶</a></dt>
<dd><p>Dump <aclass="reference internal" href="#matplotlib.font_manager.FontManager" title="matplotlib.font_manager.FontManager"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">FontManager</span></code></a><em>data</em> as JSON to the file named <em>filename</em>.</p>
<p>File paths that are children of the Matplotlib data path (typically, fonts
shipped with Matplotlib) are stored relative to that data path (to remain
valid across virtualenvs).</p>
<p>This function temporarily locks the output file to prevent multiple
processes from overwriting one another's output.</p>
</dd></dl>
<dlclass="py function">
<dtid="matplotlib.font_manager.json_load">
<codeclass="descclassname">matplotlib.font_manager.</code><codeclass="descname">json_load</code><spanclass="sig-paren">(</span><em><spanclass="n">filename</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/font_manager.html#json_load"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.font_manager.json_load" title="Permalink to this definition">¶</a></dt>
<dd><p>Load a <aclass="reference internal" href="#matplotlib.font_manager.FontManager" title="matplotlib.font_manager.FontManager"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">FontManager</span></code></a> from the JSON file named <em>filename</em>.</p>
<codeclass="descclassname">matplotlib.font_manager.</code><codeclass="descname">list_fonts</code><spanclass="sig-paren">(</span><em><spanclass="n">directory</span></em>, <em><spanclass="n">extensions</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/font_manager.html#list_fonts"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.font_manager.list_fonts" title="Permalink to this definition">¶</a></dt>
<dd><p>Return a list of all fonts matching any of the extensions, found
recursively under the directory.</p>
</dd></dl>
<dlclass="py function">
<dtid="matplotlib.font_manager.ttfFontProperty">
<codeclass="descclassname">matplotlib.font_manager.</code><codeclass="descname">ttfFontProperty</code><spanclass="sig-paren">(</span><em><spanclass="n">font</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/font_manager.html#ttfFontProperty"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.font_manager.ttfFontProperty" title="Permalink to this definition">¶</a></dt>
<dd><p>Extract information from a TrueType font file.</p>
<dt><strong>font</strong><spanclass="classifier"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">FT2Font</span></code></span></dt><dd><p>The TrueType font file from which information will be extracted.</p>
</dd>
</dl>
</td>
</tr>
<trclass="field-even field"><thclass="field-name">Returns:</th><tdclass="field-body"><dlclass="first last docutils">
<codeclass="descclassname">matplotlib.font_manager.</code><codeclass="descname">win32FontDirectory</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/font_manager.html#win32FontDirectory"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.font_manager.win32FontDirectory" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the user-specified font directory for Win32. This is
<codeclass="descclassname">matplotlib.font_manager.</code><codeclass="descname">win32InstalledFonts</code><spanclass="sig-paren">(</span><em><spanclass="n">directory</span><spanclass="o">=</span><spanclass="default_value">None</span></em>, <em><spanclass="n">fontext</span><spanclass="o">=</span><spanclass="default_value">'ttf'</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/font_manager.html#win32InstalledFonts"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.font_manager.win32InstalledFonts" title="Permalink to this definition">¶</a></dt>
<dd><p>Search for fonts in the specified font directory, or use the
system directories if none given. Additionally, it is searched for user
fonts installed. A list of TrueType font filenames are returned by default,