I am working with Hindi Text on pdf. Though Hindi text is generating but its showing as misplaced matras. Suppose I have word like 'ज़िन्दगी' but its showing as
If I copy this text and paste on Libre Office Writer then it prints correct. I have tried nearly two fonts with tcpdf. Arial Unicode MS as well as Lohit_hi
$tcpdf->SetFont('arialuni', 'B', 15, 'false');
$html = nl2br($result['Song']['hindi']);
$tcpdf->writeHTMLCell(0, 20, 20, 25, $html);
Why its showing character but misplaced their position.
Hindi Content Not displayed in MS Word etc application. Solution: Install Hindi Unicode Font like Mangal, Arial Unicode MS, Aparajita etc. If you are using Windows XP or older windows OS, then you have to install Hindi Language pack also. After that you will see Hindi content and text in any application.
Example of Hindi Unicode font is - Mangal font, Akshar, Aparajita etc.
Right click Windows Key and click on“Control Panel”. Under the Control Panel, click on“Clock, Language, and Region”. Select language option and click on Add a language button. Select Hindi and click on Add.
If I copy and paste 'ज़िन्दगी' into microsoft word, by default, it shows like this:
It's actually the exact same string of unicode characters (that is, a िन followed by a virama, followed by a द), but it's just rendered in different ways, depending on the font. Unicode fonts have complex logic for deciding when to substitute a certain string of characters for a different glyph, and the font being used by your PDF doesn't support the particular substitution you want.
You just have to find a font that does support that substitution, and make sure that your PDF is using that font. (It might be the case that your current setFont call isn't working correctly, or the font you specify isn't available at the time you set it, so it uses the system's default font for hindi characters, which doesn't support the substitution you're referring to).
Why aren't you using writeHTML() instead of writeHTMLCell() ? Your problem correlates obviously with the cell. Looks a like the line height is wrong or even there is the CSS attribute for background repeat is set (should be background-repeat:none; ). writeHTML() would prevent this.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With