title: Laravel DomPDF Google fonts not loading
body: <p>Trying to use Google Fonts with Laravel DomPDF 0.7.* but I'm having a hard time getting them to show. In fact I can't get any custom fonts to work, not just Google Fonts.</p>
  
  <pre><code>&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt;
  &lt;html&gt;
      &lt;head&gt;
          &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8"&gt;
          &lt;link href="https://fonts.googleapis.com/css?family=Caveat" rel="stylesheet"&gt;
          &lt;style type="text/css"&gt;
  
              .signature {
                  font-family: 'Caveat', cursive !important;
                  font-size: 30px;
              }
          &lt;/style&gt;
      &lt;/head&gt;
  
      &lt;body&gt;
          &lt;p class="signature"&gt;Name&lt;/p&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>This is what shows up, it's supposed to be a handwriting font.</p>
  
  <p><a href="https://i.stack.imgur.com/TNqgg.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/TNqgg.png" alt="enter image description here"></a></p>
  
  <p>In <code>dompdf.php</code> config file, the font dir and font cache are both writeable.</p>
  
  <pre><code>"DOMPDF_FONT_DIR" =&gt; storage_path('app/tmp/'), 
  "DOMPDF_FONT_CACHE" =&gt; storage_path('app/tmp/'),
  </code></pre>
  
  <p>Here is the controller code:</p>
  
  <pre><code>public function download(Request $request, string $contractKey)
  {
      $item = Item::findOrFail($contractKey);
  
      $body = @$item-&gt;contract;
  
      $pdf = PDF::loadView('pdf.contract', [
          'body'  =&gt; $this-&gt;cleanContract($body),
          'docId' =&gt; md5($item-&gt;id),
          'item'  =&gt; $item,
          'ip'    =&gt; $ip = @$request-&gt;ips()[1] ?: $request-&gt;ip(),
      ]);
  
      $pdf-&gt;output();
      $dom_pdf = $pdf-&gt;getDomPDF();
  
      $canvas = $dom_pdf-&gt;get_canvas();
      $canvas-&gt;page_text($canvas-&gt;get_width() - 70, $canvas-&gt;get_height() - 30, "Page {PAGE_NUM} of {PAGE_COUNT}", null, 10, [0, 0, 0]);
  
  
      return $pdf-&gt;stream();
  }
  </code></pre>