unicode - Arial 粗体的 tFPDF unicode 字符
问题描述
我正在尝试通过 FPDF (tFPDF) 创建 PDF,但我仍然无法使用正确的字符集创建输出。
问题在于捷克字母:ě,š,č,ř,ž,ů 等...
资源:
<?php
require_once('../tfpdf/tfpdf.php');
define("_SYSTEM_TTFONTS", "C:/Windows/Fonts/");
$pdf = new tFPDF('P','mm','A5');
$pdf->SetMargins(8,5,8);
$pdf->AddPage();
// Pracoviště
$pdf->SetFont('Arial', '', 10);
$pdf->Cell(25,12,'Pracoviště:','L',0);
$pdf->Output();
?>
我需要写“Pracoviště:”,但输出是“PracoviÅ¡tÄ›:”。
对于常规的 Arial,我通过以下方式解决了它:
$pdf->AddFont('Arial','','arial.ttf',true);
但它不适用于粗体。
我试过了:
$pdf->AddFont('Arial','','arial.ttf',true); // Arial
$pdf->AddFont('Arial','B','arialbd.ttf',true); // Arial Bold
$pdf->SetFont('Arial', '', 10);
$pdf->Cell(25,12,'Pracoviště:'); // output: Pracoviště:
$pdf->SetFont('Arial', 'B', 10);
$pdf->Cell(25,12,'Pracoviště:'); // output: PracoviÅ¡tÄ›:
有趣的是,如果我使用 Arial Black 文件,它可以工作,但它不是我需要的字体。
$pdf->AddFont('Arial','','arial.ttf',true); // Arial
$pdf->AddFont('Arial','B','ariblk.ttf',true); // Arial Black
$pdf->SetFont('Arial', '', 10);
$pdf->Cell(25,12,'Pracoviště:'); // output: Pracoviště:
$pdf->SetFont('Arial', 'B', 10);
$pdf->Cell(25,12,'Pracoviště:'); // output: Pracoviště: - but Arial Black font, I need Arial Bold
为什么 Arial 有效,Arial Black 也有效,而 Arial Bold 无效?如何解决?
解决方案
推荐阅读
- python - 如何将sklearn管道步骤与不同的arity结合起来?
- python - 使用 numpy 实现线性回归
- android - 如何修复 React-Native Android affineFormats 错误
- node.js - 在 express js 中使用 mongoDB find()
- amazon-web-services - 如何在 AWS 服务器上通过 TightVNC 运行 gnome-desktop?
- ant-media-server - Websocket 不断与新的蚂蚁媒体 SDK 断开连接
- python - 使用数字数据作为色调的 seaborn 中的堆积条形图
- c++ - 使用 Make 从 Linux 中的两个源目录构建 c++ 项目
- excel - Excel:重复相同的值,直到找到一个新值(取决于另一列)?
- amazon-web-services - 将 lambda 函数内联传递给 AWS CloduFormation 模板时,有没有办法解决本地模块依赖关系?