@font-face or custom font does not work in PHP pdf generator class
<p>I am using <code>dompdf</code> to generate PDFs from inputs.
The code I use:</p>

<pre><code>require_once (STYLESHEETPATH.'/dompdf/include/autoload.inc.php');
set_include_path(STYLESHEETPATH.'/dompdf');

require_once STYLESHEETPATH.'/dompdf/dompdf_config.inc.php';

$dompdf = new DOMPDF();

$html = '
&lt;html&gt;
 &lt;body&gt;
  &lt;h1&gt;Hello &lt;i&gt;'. $fullname.'&lt;/i&gt; &lt;/h1&gt;
  &lt;p&gt; your father is &lt;b&gt;'.$fathername.'&lt;/b&gt;
 &lt;/body&gt;
&lt;/html&gt;';

$dompdf-&gt;load_html($html);
$dompdf-&gt;render();

$dompdf-&gt;stream("tck.pdf"); ?&gt;
</code></pre>

<p>This works very fine and generates a pdf called <code>tck.pdf</code></p>

<p>Now I want to style the fonts in the pdf so I've tried</p>

<pre><code>require_once (STYLESHEETPATH.'/dompdf/include/autoload.inc.php');
set_include_path(STYLESHEETPATH.'/dompdf');

require_once STYLESHEETPATH.'/dompdf/dompdf_config.inc.php';

$dompdf = new DOMPDF();

$html = '
&lt;html&gt;
    &lt;head&gt;
        &lt;style&gt;
            @font-face {
              font-family: "Open Sans";
              font-style: normal;
              font-weight: 400;
              src: url(http://themes.googleusercontent.com/static/fonts/opensans/v8/cJZKeOuBrn4kERxqtaUH3aCWcynf_cDxXwCLxiixG1c.ttf) format("truetype");
            }
        &lt;/style&gt;
    &lt;/head&gt;
 &lt;body&gt;
  &lt;h1&gt;Hello &lt;i&gt;'. $fullname.'&lt;/i&gt; &lt;/h1&gt;
  &lt;p&gt; your father is &lt;b&gt;'.$fathername.'&lt;/b&gt;
 &lt;br/&gt;
  &lt;span style="font-family:webfontregular;"&gt;bar code will be here&lt;/span&gt;
    &lt;div style="font-family:"Open Sans";"&gt;Open Sans&lt;/div&gt;
 &lt;/body&gt;
&lt;/html&gt;';

$dompdf-&gt;load_html($html);
$dompdf-&gt;render();

$dompdf-&gt;stream("tck.pdf"); ?&gt;
</code></pre>

<p>But it does not work and giving an error as follow :</p>

<pre><code>Fatal error: Class 'Font' not found in /home4/q0i4l0g2/public_html/tck/wp-content/themes/kallyas-child/dompdf/include/font_metrics.cls.php on line 356
</code></pre>

<p>I've noticed that whenever I use "@font-face" I am getting this error.
Why is that?
How can I make it work?</p>

<p>As per the accepted answer in this question <a href="https://stackoverflow.com/questions/24412203/dompdf-and-set-different-font-family">Dompdf and set different font-family</a> this should work I think but it does not.</p>