Closed ren1244 closed 8 months ago
Some character render wrong position.
The image shows text rendering before fixing and after fixing.
https://learn.microsoft.com/en-us/typography/opentype/spec/hmtx
If numberOfHMetrics is less than the total number of glyphs, then the hMetrics array is followed by an array for the left side bearing values of the remaining glyphs.
using font:fonts.zip
<?php require(__DIR__ . '/vendor/autoload.php'); use Dompdf\Dompdf; $html = <<<EOT <style> @font-face { font-family: "noto"; src: url("fonts/NotoSerifTC-Regular.ttf") format('truetype'); font-weight: normal; font-style: normal; } body{ font-family: 'noto'; } </style> <p>當一個有趣的人</p> EOT; $dompdf = new Dompdf([ 'chroot' => __DIR__ ]); $dompdf->loadHtml($html); $dompdf->render(); $dompdf->stream('demo.pdf', [ 'Attachment' => 0 ]);
Some character render wrong position.
The image shows text rendering before fixing and after fixing.
Related specification documents
https://learn.microsoft.com/en-us/typography/opentype/spec/hmtx
Testing code
using font:fonts.zip