Php TCPDF错误:无法包含字体定义文件:';僵局';

Php TCPDF错误:无法包含字体定义文件:';僵局';,php,tcpdf,html2pdf,Php,Tcpdf,Html2pdf,我有html,它使用一些需要转换为pdf的脚本字体。我在这方面做了很多工作,但当我尝试在pdf中包含脚本字体时,会出现以下错误: TCPDF ERROR: Could not include font definition file: 'stalemate' 原始字体来自Google字体库。根据我找到的说明,我重命名了字体,使其全部为小写,然后使用ttf2ufm实用程序生成矩阵文件。然后,我获取了这些文件,并使用makefont.php实用程序创建了所需的文件,以便将字体包含在TCPDF字体文

我有html,它使用一些需要转换为pdf的脚本字体。我在这方面做了很多工作,但当我尝试在pdf中包含脚本字体时,会出现以下错误:

TCPDF ERROR: Could not include font definition file: 'stalemate'
原始字体来自Google字体库。根据我找到的说明,我重命名了字体,使其全部为小写,然后使用ttf2ufm实用程序生成矩阵文件。然后,我获取了这些文件,并使用makefont.php实用程序创建了所需的文件,以便将字体包含在TCPDF字体文件夹中(stalemate.z、stalemate.ctg.z和stalemate.php)。我也试着把它们放在一个特定的文件夹中,并把电话指向那个文件夹

似乎我有所有正确的文件在所有正确的地方,但仍然得到上述错误。如果我去掉html中该字体的样式,文档PDF就可以了

我在上做了一个较小的测试页面,它从中获取html并将其转换为pdf。以下是php代码:

<?php
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');

?>

它提取的HTML代码是:

<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>

@字体面{font-family:“stallate”;字体重量:400;src:url(/fonts/stallate.otf)格式(“opentype”);}
确保这是工作
这是您的第一个PDF文件


对此有任何想法都很好。

不知道您是否已经解决了此问题,但请查看