簡體   English   中英

無法在TFPDF中顯示泰米爾字體

[英]Unable to display Tamil font in TFPDF

我正在嘗試使用TFPDF以PDF格式顯示泰米爾語內容。 我已經下載了泰米爾語字體TSCu_SaiIndira.ttf,並將其存儲在路徑C:\\wamp\\www\\tfpdf\\font\\unifont 記事本中存儲的泰米爾語單詞為“பெயர்கள்”。 當我運行下面的代碼時,它以不同的字母打印

<?php
require('tfpdf.php');

$pdf = new tFPDF();
$pdf->AddPage();

// Add a Unicode font (uses UTF-8)
$pdf->AddFont('DejaVu','','TSCu_SaiIndira.ttf',true);
$pdf->SetFont('DejaVu','',14);

// Load a UTF-8 string from a file and print it
$txt = file_get_contents('HelloWorld.txt');
$pdf->Write(8,$txt);

// Select a standard font (uses windows-1252)
$pdf->SetFont('Arial','',14);
$pdf->Ln(10);
$pdf->Write(5,'The file size of this PDF is only 12 KB.');

$pdf->Output();
?>

我是編碼新手。 我已經閱讀了有關相關問題的所有答案,但沒有任何結果。

在此代碼中:

$pdf->AddFont('DejaVu','','TSCu_SaiIndira.ttf',true);
$pdf->SetFont('DejaVu','',14);

您正在使用'DejaVu'作為字體系列名稱,這是不正確的。 我做了一個快速測試,並且:

$pdf->AddFont('TSCu_SaiIndira','','TSCu_SaiIndira.ttf', true);
$pdf->SetFont('TSCu_SaiIndira','',14);

為我工作。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM