tecnickcom / TCPDF

Official clone of PHP library to generate PDF documents and barcodes
https://tcpdf.org
Other
4.18k stars 1.51k forks source link

Problem rendering Khmer fonts #610

Open Ewa55 opened 1 year ago

Ewa55 commented 1 year ago

While generating a pdf file in Khmer some of the text is not showing properly. Some characters are swapped. I have used many Khmer fonts, same error every time.

I used the following fonts:

In khmer_names.txt you can see the font typed correctly khmer_names.txt in khme.pdf file you will see font rendering issues khmer_names.pdf

I will be grateful for any instructions on solving this problem.

'<?php /**

require('tcpdf.php'); define('OUTPUT_FILE', 'khmer_names.pdf');

$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);

$pdf->setFontSubsetting(true);

$pdf->setFont('battambang', '', 20);

$pdf->AddPage();

$text = file_get_contents('khmer_names.txt', false);

$pdf->setTextColor(0, 63, 127);

$pdf->Write(5, $text, '', 0, '', false, 0, false, false, 0);

$pdf->Output('khmer_names.pdf', 'I'); $doc = $pdf->getPDFData(); file_put_contents(OUTPUT_FILE, $doc);

ciaranocogit commented 1 year ago

Hi @nicolaasuni

I understand you are the maintainer of the TCPDF libraries . Are you available for hire to fix what Ewa55 has described for Khmer language?

Many thanks for your attention

Ewa55 commented 10 months ago

Hi, I have new similar problem with Nepali. The Nepali language, like Khmer, is written in the Devanagari script.