<divid="unreleased-message"> You are reading an old version of the documentation (v3.3.2). For the latest version see <ahref="https://matplotlib.org/stable/api/dviread.html">https://matplotlib.org/stable/api/dviread.html</a></div>
<spanid="matplotlib-dviread"></span><h1><codeclass="docutils literal notranslate"><spanclass="pre">matplotlib.dviread</span></code><aclass="headerlink" href="#module-matplotlib.dviread" title="Permalink to this headline">¶</a></h1>
<p>A module for reading dvi files output by TeX. Several limitations make
this not (currently) useful as a general-purpose dvi preprocessor, but
it is currently used by the pdf backend for processing usetex text.</p>
<emclass="property">class </em><codeclass="descclassname">matplotlib.dviread.</code><codeclass="descname">Dvi</code><spanclass="sig-paren">(</span><em><spanclass="n">filename</span></em>, <em><spanclass="n">dpi</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/dviread.html#Dvi"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.dviread.Dvi" title="Permalink to this definition">¶</a></dt>
<p>Read the data from the file named <em>filename</em> and convert
TeX's internal units to units of <em>dpi</em> per inch.
<em>dpi</em> only sets the units and does not limit the resolution.
Use None to return TeX's internal units.</p>
<dlclass="py method">
<dtid="matplotlib.dviread.Dvi.close">
<codeclass="descname">close</code><spanclass="sig-paren">(</span><em><spanclass="n">self</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/dviread.html#Dvi.close"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.dviread.Dvi.close" title="Permalink to this definition">¶</a></dt>
<dd><p>Close the underlying file if it is open.</p>
</dd></dl>
</dd></dl>
<dlclass="py class">
<dtid="matplotlib.dviread.DviFont">
<emclass="property">class </em><codeclass="descclassname">matplotlib.dviread.</code><codeclass="descname">DviFont</code><spanclass="sig-paren">(</span><em><spanclass="n">scale</span></em>, <em><spanclass="n">tfm</span></em>, <em><spanclass="n">texname</span></em>, <em><spanclass="n">vf</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/dviread.html#DviFont"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.dviread.DviFont" title="Permalink to this definition">¶</a></dt>
<dt><strong>size</strong><spanclass="classifier">float</span></dt><dd><p>Size of the font in Adobe points, converted from the slightly
smaller TeX points.</p>
</dd>
<dt><strong>widths</strong><spanclass="classifier">list</span></dt><dd><p>Widths of glyphs in glyph-space units, typically 1/1000ths of
the point size.</p>
</dd>
</dl>
</td>
</tr>
</tbody>
</table>
<dlclass="py attribute">
<dtid="matplotlib.dviread.DviFont.size">
<codeclass="descname">size</code><aclass="headerlink" href="#matplotlib.dviread.DviFont.size" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dlclass="py attribute">
<dtid="matplotlib.dviread.DviFont.texname">
<codeclass="descname">texname</code><aclass="headerlink" href="#matplotlib.dviread.DviFont.texname" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dlclass="py attribute">
<dtid="matplotlib.dviread.DviFont.widths">
<codeclass="descname">widths</code><aclass="headerlink" href="#matplotlib.dviread.DviFont.widths" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
</dd></dl>
<dlclass="py class">
<dtid="matplotlib.dviread.Encoding">
<emclass="property">class </em><codeclass="descclassname">matplotlib.dviread.</code><codeclass="descname">Encoding</code><spanclass="sig-paren">(</span><em><spanclass="o">**</span><spanclass="n">kwargs</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/dviread.html#Encoding"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.dviread.Encoding" title="Permalink to this definition">¶</a></dt>
<p>Create new instance of PsFont(texname, psname, effects, encoding, filename)</p>
<dlclass="py attribute">
<dtid="matplotlib.dviread.PsFont.effects">
<codeclass="descname">effects</code><aclass="headerlink" href="#matplotlib.dviread.PsFont.effects" title="Permalink to this definition">¶</a></dt>
<dd><p>Alias for field number 2</p>
</dd></dl>
<dlclass="py attribute">
<dtid="matplotlib.dviread.PsFont.encoding">
<codeclass="descname">encoding</code><aclass="headerlink" href="#matplotlib.dviread.PsFont.encoding" title="Permalink to this definition">¶</a></dt>
<dd><p>Alias for field number 3</p>
</dd></dl>
<dlclass="py attribute">
<dtid="matplotlib.dviread.PsFont.filename">
<codeclass="descname">filename</code><aclass="headerlink" href="#matplotlib.dviread.PsFont.filename" title="Permalink to this definition">¶</a></dt>
<dd><p>Alias for field number 4</p>
</dd></dl>
<dlclass="py attribute">
<dtid="matplotlib.dviread.PsFont.psname">
<codeclass="descname">psname</code><aclass="headerlink" href="#matplotlib.dviread.PsFont.psname" title="Permalink to this definition">¶</a></dt>
<dd><p>Alias for field number 1</p>
</dd></dl>
<dlclass="py attribute">
<dtid="matplotlib.dviread.PsFont.texname">
<codeclass="descname">texname</code><aclass="headerlink" href="#matplotlib.dviread.PsFont.texname" title="Permalink to this definition">¶</a></dt>
<dd><p>Alias for field number 0</p>
</dd></dl>
</dd></dl>
<dlclass="py class">
<dtid="matplotlib.dviread.PsfontsMap">
<emclass="property">class </em><codeclass="descclassname">matplotlib.dviread.</code><codeclass="descname">PsfontsMap</code><spanclass="sig-paren">(</span><em><spanclass="n">filename</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/dviread.html#PsfontsMap"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.dviread.PsfontsMap" title="Permalink to this definition">¶</a></dt>
<emclass="property">class </em><codeclass="descclassname">matplotlib.dviread.</code><codeclass="descname">Tfm</code><spanclass="sig-paren">(</span><em><spanclass="n">filename</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/dviread.html#Tfm"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.dviread.Tfm" title="Permalink to this definition">¶</a></dt>
<dt><strong>filename</strong><spanclass="classifier">str or path-like</span></dt><dd></dd>
</dl>
</td>
</tr>
<trclass="field-even field"><thclass="field-name">Attributes:</th><tdclass="field-body"><dlclass="first last docutils">
<dt><strong>checksum</strong><spanclass="classifier">int</span></dt><dd><p>Used for verifying against the dvi file.</p>
</dd>
<dt><strong>design_size</strong><spanclass="classifier">int</span></dt><dd><p>Design size of the font (unknown units)</p>
</dd>
<dt><strong>width, height, depth</strong><spanclass="classifier">dict</span></dt><dd><p>Dimensions of each character, need to be scaled by the factor
specified in the dvi file. These are dicts because indexing may
not start from 0.</p>
</dd>
</dl>
</td>
</tr>
</tbody>
</table>
<dlclass="py attribute">
<dtid="matplotlib.dviread.Tfm.checksum">
<codeclass="descname">checksum</code><aclass="headerlink" href="#matplotlib.dviread.Tfm.checksum" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dlclass="py attribute">
<dtid="matplotlib.dviread.Tfm.depth">
<codeclass="descname">depth</code><aclass="headerlink" href="#matplotlib.dviread.Tfm.depth" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dlclass="py attribute">
<dtid="matplotlib.dviread.Tfm.design_size">
<codeclass="descname">design_size</code><aclass="headerlink" href="#matplotlib.dviread.Tfm.design_size" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dlclass="py attribute">
<dtid="matplotlib.dviread.Tfm.height">
<codeclass="descname">height</code><aclass="headerlink" href="#matplotlib.dviread.Tfm.height" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dlclass="py attribute">
<dtid="matplotlib.dviread.Tfm.width">
<codeclass="descname">width</code><aclass="headerlink" href="#matplotlib.dviread.Tfm.width" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
</dd></dl>
<dlclass="py class">
<dtid="matplotlib.dviread.Vf">
<emclass="property">class </em><codeclass="descclassname">matplotlib.dviread.</code><codeclass="descname">Vf</code><spanclass="sig-paren">(</span><em><spanclass="n">filename</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/dviread.html#Vf"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.dviread.Vf" title="Permalink to this definition">¶</a></dt>
This class reuses some of the machinery of <aclass="reference internal" href="#matplotlib.dviread.Dvi" title="matplotlib.dviread.Dvi"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">Dvi</span></code></a>
but replaces the <codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">_read</span></code> loop and dispatch mechanism.</p>
<p>Read the data from the file named <em>filename</em> and convert
TeX's internal units to units of <em>dpi</em> per inch.
<em>dpi</em> only sets the units and does not limit the resolution.
Use None to return TeX's internal units.</p>
</dd></dl>
<dlclass="py function">
<dtid="matplotlib.dviread.find_tex_file">
<codeclass="descclassname">matplotlib.dviread.</code><codeclass="descname">find_tex_file</code><spanclass="sig-paren">(</span><em><spanclass="n">filename</span></em>, <em><spanclass="n">format</span><spanclass="o">=</span><spanclass="default_value">None</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/dviread.html#find_tex_file"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.dviread.find_tex_file" title="Permalink to this definition">¶</a></dt>
<dd><p>Find a file in the texmf tree.</p>
<p>Calls <strongclass="program">kpsewhich</strong> which is an interface to the kpathsea
library <aclass="reference internal" href="#ra043a4f19cd5-1" id="id1">[1]</a>. Most existing TeX distributions on Unix-like systems use
kpathsea. It is also available as part of MikTeX, a popular
distribution on Windows.</p>
<p><em>If the file is not found, an empty string is returned</em>.</p>
<trclass="field-odd field"><thclass="field-name">Parameters:</th><tdclass="field-body"><dlclass="first last docutils">
<dt><strong>filename</strong><spanclass="classifier">str or path-like</span></dt><dd></dd>
<dt><strong>format</strong><spanclass="classifier">str or bytes</span></dt><dd><p>Used as the value of the <codeclass="docutils literal notranslate"><spanclass="pre">--format</span></code> option to <strongclass="program">kpsewhich</strong>.
Could be e.g. 'tfm' or 'vf' to limit the search to that type of files.</p>