2 Attachment(s)
Bangla (Unicode) font not rendering correctly in tcpdf
I am facing a problem with generating pdf in php by using TCPDF library. I need to show the bangla font correctly. I tried to add some bangla font(i.e. SolaimanLipi.ttf, SutonnyOMJ.ttf, Siyamrupali.ttf, Nikosh.ttf and so on). I can see the bangla font on pdf but the font is not display correctly. Its misplaced the word.
By adding this font I see the on the /fonts/ directory there successfully created 3 file “solaimanlipi.ctg.z”,”solaimanlipi.php” and “solaimanlipi.z”. As well as I can see the bangla font on pdf, but this font is misplaced/scattered. I am attaching a picture what I actually see.
This is how it should look (From browser screenshot):
Attachment 130051
Here is the code to show above result:
Code:
<?php
$strData = file_get_contents('./data3.txt');
?>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8" />
<style>
@font-face
{
font-family: myUniFont;
src: url(./SolaimanLipi_22-02-2012.ttf);
}
</style>
</head>
<body>
<span style="font-family: myUniFont;"><?php echo $strData; ?></span>
</body>
</html>
I use below code to use that very same font in my pdf:
Code:
$strBNFont = TCPDF_FONTS::addTTFfont('./SolaimanLipi_22-02-2012.ttf', 'TrueTypeUnicode', '', 32);
$pdf->SetFont($strBNFont, '', 8, '', 'false');
And It is how it look like in PDF: :(
Attachment 130053
Please advice me how can I display the bangla font correctly.
thanks in advance
best regards
Re: Bangla (Unicode) font not rendering correctly in tcpdf
1 Attachment(s)
Re: Bangla (Unicode) font not rendering correctly in tcpdf
i have attached all files that may help you to figure out the issue..
thanks in advance
best regards