简体   繁体   English

在mPDF中设置自定义TTF字体

[英]Setting a custom TTF Font in mPDF

i installed mPDF 6.0 via zip file (not composer), put a font into the ttfonts folder and added the file in config_fonts.php like this: 我通过zip文件(不是作曲家)安装了mPDF 6.0,将字体放到ttfonts文件夹中,并将文件添加到config_fonts.php中,如下所示:

"eurostyle" => array(   /* Custom */
    'R' => "eurostyle-normal.ttf"
    )

Now i tried adding the font to my mPDF object like this: 现在,我尝试将字体添加到我的mPDF对象中,如下所示:

$mpdf = new mPDF('c', 'A4-L');
$mpdf -> SetFont('eurostyle');

but nothing changes. 但没有任何变化。 There is no error message, the output PDF simpy stays the same. 没有错误消息,输出PDF simpy保持不变。

Does anybody know why? 有人知道为什么吗?

Create your mPDF object without c as mode parameter. 创建不带c作为模式参数的mPDF对象。 Use an empty string or eg. 使用空字符串或例如。 UTF-8 . UTF-8

$mpdf = new mPDF('', 'A4-L');

c mode means the PDF will only use core PDF fonts - therefore it will not use any custom external fonts. c模式表示PDF将仅使用核心PDF字体-因此它将不使用任何自定义外部字体。

See also the Fonts & Languages/Choosing a configuration page of the manual. 另请参见字体和语言/选择手册的配置页面。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM