在mPDF中设置自定义的TTF字体 [英] Setting a custom TTF Font in mPDF

查看:2206
本文介绍了在mPDF中设置自定义的TTF字体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我通过zip文件(不是composer)安装了mPDF 6.0,把一个字体放到ttfonts文件夹中,然后像这样在config_fonts.php中添加这个文件:

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:

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

现在我尝试将字体添加到我的mPDF对象中,如下所示:

Now i tried adding the font to my mPDF object like this:

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

但没有任何变化。有没有错误消息,输出PDF simpy保持不变。

but nothing changes. There is no error message, the output PDF simpy stays the same.

有人知道为什么?

Does anybody know why?

推荐答案

创建不含 c 的mPDF对象作为模式参数。使用空字符串或例如。 UTF-8

Create your mPDF object without c as mode parameter. Use an empty string or eg. UTF-8.

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

c 模式表示PDF将只使用核心PDF字体 - 因此它不会使用任何自定义的外部字体。

c mode means the PDF will only use core PDF fonts - therefore it will not use any custom external fonts.

另见 Fonts&语言/选择配置页面。

这篇关于在mPDF中设置自定义的TTF字体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆