// set default monospaced font
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
// set margins
$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
// set default font subsetting mode
$pdf->setFontSubsetting(true);
// set font
$pdf->SetFont($font, '', 12);
// add a page
$pdf->AddPage();
// get esternal file content
$utf8text = "月落烏啼霜滿天\n江楓漁火對愁眠\n姑蘇城外寒山寺\n夜半鐘聲到客船";
// write the text
$pdf->Write(5, $utf8text, '', 0, '', false, 0, false, false, 0);
//Close and output PDF document
$pdf->Output('example_008.pdf', 'I');
## Related Reference
[https://learn.microsoft.com/en-us/typography/opentype/spec/otff](https://learn.microsoft.com/en-us/typography/opentype/spec/otff)
> All tables must begin on four-byte boundaries, and any remaining space between tables must be padded with zeros. The length of each table should be recorded in the table record with the actual length of data, not the padded length.
This PR also fix a bug about subset.
Please review tcpdf_fonts.php line 1386.
CheckSumAdjustment write to wrong position.
It cause unpredictable behavior.
Fix Composite Glyph Output
Problem Reproduction
// add test font $font = TCPDF_FONTS::addTTFfont('kaiu.ttf');
// create new PDF document $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
// remove default header/footer $pdf->setPrintHeader(false); $pdf->setPrintFooter(false);
// set default monospaced font $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
// set margins $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
// set default font subsetting mode $pdf->setFontSubsetting(true);
// set font $pdf->SetFont($font, '', 12);
// add a page $pdf->AddPage();
// get esternal file content $utf8text = "月落烏啼霜滿天\n江楓漁火對愁眠\n姑蘇城外寒山寺\n夜半鐘聲到客船";
// write the text $pdf->Write(5, $utf8text, '', 0, '', false, 0, false, false, 0);
//Close and output PDF document $pdf->Output('example_008.pdf', 'I');