mpdf / mpdf.github.io

mPDF documentation
https://mpdf.github.io
Other
508 stars 160 forks source link

mPDF not loading custom Persian font correctly (BMitra, IRANSans, ...) for Farsi text #206

Closed rhadi01 closed 2 months ago

rhadi01 commented 2 months ago

I'm having trouble getting mPDF to properly render Farsi (Persian) text using custom fonts like BMitra and IRANSans.

Problem: https://i.sstatic.net/Y4FkQ4x7.png پیوست is correct! The main issue is that when I try to generate a PDF with Farsi content, mPDF either fails to load the specified font, or the text appears in a different font altogether. Additionally, I tried enabling OpenType Layout (OTL) features like useOTL and useKashida, but I received an error stating that my font does not support OTL tables:

I attempted using the IRANSans font, but the issue persisted. Here is the relevant part of my PHP code: https://stackoverflow.com/questions/78877952/mpdf-not-loading-custom-persian-font-correctly-bmitra-iransans-for-farsi