<h3 dir="auto">Bug report</h3>
<p dir="auto"><strong>Bug summary</strong></p>
<p dir="auto">Using tex (<code class="notranslate">rcParams["text.usetex"] = True</code>) results in an error because of a font name not being valid in current master. Works fine with matplotlib 2.2.3.</p>
<p dir="auto"><strong>Code for reproduction</strong></p>

<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="import matplotlib.pyplot as plt
plt.rcParams[&quot;text.usetex&quot;] = True

plt.plot([1,2,3])
plt.show()"><pre class="notranslate"><code class="notranslate">import matplotlib.pyplot as plt
plt.rcParams["text.usetex"] = True

plt.plot([1,2,3])
plt.show()
</code></pre></div>
<p dir="auto"><strong>Actual outcome</strong></p>

<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="  File &quot;d:\***\matplotlib\lib\matplotlib\dviread.py&quot;, line 736, in __init__
    with open(filename, 'rb') as file:
OSError: [Errno 22] Invalid argument: 'D:/Programme/Office/MiKTeX/fonts/tfm/public/cm/cmr10.tfm\r'"><pre class="notranslate"><code class="notranslate">  File "d:\***\matplotlib\lib\matplotlib\dviread.py", line 736, in __init__
    with open(filename, 'rb') as file:
OSError: [Errno 22] Invalid argument: 'D:/Programme/Office/MiKTeX/fonts/tfm/public/cm/cmr10.tfm\r'
</code></pre></div>
<p dir="auto">I would suspect the <code class="notranslate">\r</code> simply does not belong at the end of the string.</p>
<details>
 <summary>Complete Traceback</summary>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Traceback (most recent call last):
  File &quot;d:\***\matplotlib\lib\matplotlib\backends\backend_qt5.py&quot;, line 519, in _draw_idle
    self.draw()
  File &quot;d:\***\matplotlib\lib\matplotlib\backends\backend_agg.py&quot;, line 399, in draw
    self.figure.draw(self.renderer)
  File &quot;d:\***\matplotlib\lib\matplotlib\artist.py&quot;, line 34, in draw_wrapper
    return draw(artist, renderer, *args, **kwargs)
  File &quot;d:\***\matplotlib\lib\matplotlib\figure.py&quot;, line 1649, in draw
    renderer, self, artists, self.suppressComposite)
  File &quot;d:\***\matplotlib\lib\matplotlib\image.py&quot;, line 137, in _draw_list_compositing_images
    a.draw(renderer)
  File &quot;d:\***\matplotlib\lib\matplotlib\artist.py&quot;, line 34, in draw_wrapper
    return draw(artist, renderer, *args, **kwargs)
  File &quot;d:\***\matplotlib\lib\matplotlib\axes\_base.py&quot;, line 2623, in draw
    mimage._draw_list_compositing_images(renderer, self, artists)
  File &quot;d:\***\matplotlib\lib\matplotlib\image.py&quot;, line 137, in _draw_list_compositing_images
    a.draw(renderer)
  File &quot;d:\***\matplotlib\lib\matplotlib\artist.py&quot;, line 34, in draw_wrapper
    return draw(artist, renderer, *args, **kwargs)
  File &quot;d:\***\matplotlib\lib\matplotlib\axis.py&quot;, line 1186, in draw
    renderer)
  File &quot;d:\***\matplotlib\lib\matplotlib\axis.py&quot;, line 1124, in _get_tick_bboxes
    extent = tick.label1.get_window_extent(renderer)
  File &quot;d:\***\matplotlib\lib\matplotlib\text.py&quot;, line 902, in get_window_extent
    bbox, info, descent = self._get_layout(self._renderer)
  File &quot;d:\***\matplotlib\lib\matplotlib\text.py&quot;, line 312, in _get_layout
    ismath=ismath)
  File &quot;d:\***\matplotlib\lib\matplotlib\backends\backend_agg.py&quot;, line 206, in get_text_width_height_descent
    s, fontsize, renderer=self)
  File &quot;d:\***\matplotlib\lib\matplotlib\texmanager.py&quot;, line 466, in get_text_width_height_descent
    page = next(iter(dvi))
  File &quot;d:\***\matplotlib\lib\matplotlib\dviread.py&quot;, line 244, in __iter__
    while self._read():
  File &quot;d:\***\matplotlib\lib\matplotlib\dviread.py&quot;, line 302, in _read
    self._dtable[byte](self, byte)
  File &quot;d:\***\matplotlib\lib\matplotlib\dviread.py&quot;, line 162, in wrapper
    return method(self, *[f(self, byte-min) for f in get_args])
  File &quot;d:\***\matplotlib\lib\matplotlib\dviread.py&quot;, line 442, in _fnt_def
    self._fnt_def_real(k, c, s, d, a, l)
  File &quot;d:\***\matplotlib\lib\matplotlib\dviread.py&quot;, line 447, in _fnt_def_real
    tfm = _tfmfile(fontname)
  File &quot;d:\***\matplotlib\lib\matplotlib\dviread.py&quot;, line 1035, in _fontfile
    return cls(filename) if filename else None
  File &quot;d:\***\matplotlib\lib\matplotlib\dviread.py&quot;, line 736, in __init__
    with open(filename, 'rb') as file:
OSError: [Errno 22] Invalid argument: 'D:/Programme/Office/MiKTeX/fonts/tfm/public/cm/cmr10.tfm\r'"><pre class="notranslate"><code class="notranslate">Traceback (most recent call last):
  File "d:\***\matplotlib\lib\matplotlib\backends\backend_qt5.py", line 519, in _draw_idle
    self.draw()
  File "d:\***\matplotlib\lib\matplotlib\backends\backend_agg.py", line 399, in draw
    self.figure.draw(self.renderer)
  File "d:\***\matplotlib\lib\matplotlib\artist.py", line 34, in draw_wrapper
    return draw(artist, renderer, *args, **kwargs)
  File "d:\***\matplotlib\lib\matplotlib\figure.py", line 1649, in draw
    renderer, self, artists, self.suppressComposite)
  File "d:\***\matplotlib\lib\matplotlib\image.py", line 137, in _draw_list_compositing_images
    a.draw(renderer)
  File "d:\***\matplotlib\lib\matplotlib\artist.py", line 34, in draw_wrapper
    return draw(artist, renderer, *args, **kwargs)
  File "d:\***\matplotlib\lib\matplotlib\axes\_base.py", line 2623, in draw
    mimage._draw_list_compositing_images(renderer, self, artists)
  File "d:\***\matplotlib\lib\matplotlib\image.py", line 137, in _draw_list_compositing_images
    a.draw(renderer)
  File "d:\***\matplotlib\lib\matplotlib\artist.py", line 34, in draw_wrapper
    return draw(artist, renderer, *args, **kwargs)
  File "d:\***\matplotlib\lib\matplotlib\axis.py", line 1186, in draw
    renderer)
  File "d:\***\matplotlib\lib\matplotlib\axis.py", line 1124, in _get_tick_bboxes
    extent = tick.label1.get_window_extent(renderer)
  File "d:\***\matplotlib\lib\matplotlib\text.py", line 902, in get_window_extent
    bbox, info, descent = self._get_layout(self._renderer)
  File "d:\***\matplotlib\lib\matplotlib\text.py", line 312, in _get_layout
    ismath=ismath)
  File "d:\***\matplotlib\lib\matplotlib\backends\backend_agg.py", line 206, in get_text_width_height_descent
    s, fontsize, renderer=self)
  File "d:\***\matplotlib\lib\matplotlib\texmanager.py", line 466, in get_text_width_height_descent
    page = next(iter(dvi))
  File "d:\***\matplotlib\lib\matplotlib\dviread.py", line 244, in __iter__
    while self._read():
  File "d:\***\matplotlib\lib\matplotlib\dviread.py", line 302, in _read
    self._dtable[byte](self, byte)
  File "d:\***\matplotlib\lib\matplotlib\dviread.py", line 162, in wrapper
    return method(self, *[f(self, byte-min) for f in get_args])
  File "d:\***\matplotlib\lib\matplotlib\dviread.py", line 442, in _fnt_def
    self._fnt_def_real(k, c, s, d, a, l)
  File "d:\***\matplotlib\lib\matplotlib\dviread.py", line 447, in _fnt_def_real
    tfm = _tfmfile(fontname)
  File "d:\***\matplotlib\lib\matplotlib\dviread.py", line 1035, in _fontfile
    return cls(filename) if filename else None
  File "d:\***\matplotlib\lib\matplotlib\dviread.py", line 736, in __init__
    with open(filename, 'rb') as file:
OSError: [Errno 22] Invalid argument: 'D:/Programme/Office/MiKTeX/fonts/tfm/public/cm/cmr10.tfm\r'
</code></pre></div>
</details>
<hr>
<p dir="auto"><strong>Expected outcome</strong></p>
<p dir="auto">No Error.</p>
<p dir="auto"><strong>Matplotlib version</strong></p>

<ul dir="auto">
<li>Operating system: Windows 8.1</li>
<li>Matplotlib version: master</li>
<li>Matplotlib backend (<code class="notranslate">print(matplotlib.get_backend())</code>): Qt5Agg</li>
<li>Python version: 3.6</li>
</ul>
<h3 dir="auto">Bug report</h3>
<p dir="auto">I like to test my code against the bleeding edge version of matplotlib (by installing it in a conda virtual environment) on my work machine (Windows PC). Since I do not have admin rights to install the necessary tools to build from source, I download the wheels from appveyor and use pip install.</p>
<p dir="auto">The following code snippet (representing a part of my working code) started giving an error after I installed "matplotlib-3.0.0rc1+424.g19420b97.dirty-cp36-cp36m-win_amd64.whl" (which corresponds to Merge pull request <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="363272624" data-permission-text="Title is private" data-url="https://github.com/matplotlib/matplotlib/issues/12253" data-hovercard-type="pull_request" data-hovercard-url="/matplotlib/matplotlib/pull/12253/hovercard" href="https://github.com/matplotlib/matplotlib/pull/12253">#12253</a> from anntzer/kpathsea-encoding FIX: Handle utf-8 output by kpathsea on Windows). The wheel which was built for the commit before that, matplotlib-3.0.0rc1+420.gb2c89917.dirty-cp36-cp36m-win_amd64.whl works fine (I reinstalled it and the code snippet works).</p>
<p dir="auto">I am not sure if this is the right way to test the bleeding edge code (when you do not have admin rights to install the tools necessary to build from source). If the procedure I am following is not correct, please feel free to close the issue.</p>

<p dir="auto"><strong>Code for reproduction</strong></p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="import matplotlib.pyplot as plt
import numpy as np
from matplotlib import rc
rc('text', usetex=True)
rc('text.latex', preamble=r'\usepackage{fourier}, \usepackage[T1]{fontenc}')
fig, ax = plt.subplots()
ax.plot(np.arange(10))
fig.savefig('test.pdf')"><pre class="notranslate"><span class="pl-k">import</span> <span class="pl-s1">matplotlib</span>.<span class="pl-s1">pyplot</span> <span class="pl-k">as</span> <span class="pl-s1">plt</span>
<span class="pl-k">import</span> <span class="pl-s1">numpy</span> <span class="pl-k">as</span> <span class="pl-s1">np</span>
<span class="pl-k">from</span> <span class="pl-s1">matplotlib</span> <span class="pl-k">import</span> <span class="pl-s1">rc</span>
<span class="pl-en">rc</span>(<span class="pl-s">'text'</span>, <span class="pl-s1">usetex</span><span class="pl-c1">=</span><span class="pl-c1">True</span>)
<span class="pl-en">rc</span>(<span class="pl-s">'text.latex'</span>, <span class="pl-s1">preamble</span><span class="pl-c1">=</span><span class="pl-s">r'\usepackage{fourier}, \usepackage[T1]{fontenc}'</span>)
<span class="pl-s1">fig</span>, <span class="pl-s1">ax</span> <span class="pl-c1">=</span> <span class="pl-s1">plt</span>.<span class="pl-en">subplots</span>()
<span class="pl-s1">ax</span>.<span class="pl-en">plot</span>(<span class="pl-s1">np</span>.<span class="pl-en">arange</span>(<span class="pl-c1">10</span>))
<span class="pl-s1">fig</span>.<span class="pl-en">savefig</span>(<span class="pl-s">'test.pdf'</span>)</pre></div>

<p dir="auto"><strong>Actual outcome</strong></p>

<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="OSError: [Errno 22] Invalid argument: 'C:/Program Files/MiKTeX 2.9/fonts/tfm/jknappen/ec/ecss1000.tfm
\r'"><pre class="notranslate"><code class="notranslate">OSError: [Errno 22] Invalid argument: 'C:/Program Files/MiKTeX 2.9/fonts/tfm/jknappen/ec/ecss1000.tfm
\r'
</code></pre></div>
<p dir="auto"><strong>Expected outcome</strong></p>


<p dir="auto"><strong>Matplotlib version</strong></p>

<ul dir="auto">
<li>
<p dir="auto">Operating system: Windows 10</p>
</li>
<li>
<p dir="auto">Matplotlib version: 3.0.0rc1+424.g19420b97.dirty</p>
</li>
<li>
<p dir="auto">Matplotlib backend (<code class="notranslate">print(matplotlib.get_backend())</code>): Qt5Agg</p>
</li>
<li>
<p dir="auto">Python version:</p>
</li>
<li>
<p dir="auto">Jupyter version (if applicable):</p>
</li>
<li>
<p dir="auto">Other libraries:</p>
</li>
</ul>