TCPDF ERROR: Could not include font definition file: 'stalemate'
The original font is from the Google Fonts library. Per instructions I have found, I renamed the font so that it was all lowercase, then made the matrix files using the ttf2ufm utility. I then took these files and used the makefont.php utility to make the needed files for the font to be included in the TCPDF font folder (stalemate.z, stalemate.ctg.z and stalemate.php). I have also tried putting them in a specific folder and pointing the call to that as well.
Seems like I have all the right files in all the right places and still get the above error. If I take out the style for that font on the html, the document PDFs just fine.
I have made a smaller test page at http://mattodesigns.com/pdfconverter.php, which take the html from http://mattodesigns.com/sample.html and converts it to a pdf. The following is the php code:
require_once 'html2pdf_v4.03/html2pdf.class.php';
$url = 'http://mattodesigns.com/sample.html';
$source = file_get_contents($url);
$html = str_replace(array("\r", "\n", "\t"), '', $source);
$orientation = 'P';
$format = 'A4';
$margins = array(0,0,0,0);
$html2pdf = new HTML2PDF($orientation, $format, 'en', true, 'UTF-8', $margins);
$html2pdf->addFont('stalemate', '', 'stalemate.php');
$html2pdf->WriteHTML($html);
$html2pdf->Output('first_PDF_file.pdf');
The HTML code that it pulls is:
<html>
<head>
<style>
@font-face {font-family: "stalemate"; font-weight: 400; src: url(/fonts/stalemate.otf) format("opentype");}
</style>
</head>
<body>
<h1>Make Sure this is working</h1>
<p style="font-family: 'stalemate', cursive ;">This is your first PDF File</p>
</body>
</html>
Addition: I found out that if I use setDefaultFont('stalemate') the font itself will load, but then all the text on the page is now just Stalemate. I need to have multiple fonts on the same page. Is this possible or is it just one font per document written?