Home > OS >  How to disable Ligatures/Diacritics functionality in mpdf?
How to disable Ligatures/Diacritics functionality in mpdf?

Time:07-13

I generate PDFs with MPDF 8.1.1. These PDF include email addresses. But it looks like the "Combining Diacritics" functionality or the "Ligatures" of the font rendering destroys some of them. I provide UTF8 encoded text.

For example, if the address contains ffl, it replaces this by a glyph and turns the email address invalid.

I tried to instantiate mPDF with allow_charset_conversion=false like this

$pdf = new Mpdf\Mpdf([
  'PDFA' => true,
  'PDFAauto' => true,
  'allow_charset_conversion' => false
]);

But it continues to destroy emails.

What is the correct way to disable that "Combining Diacritics" functionality or "Ligatures" replacement?

CodePudding user response:

The mPDF documentation gives this CSS style to disable ligatures:

/* disable common ligatures, usually on by default */
.noligs { font-feature-settings: "liga" 0; }

Alternatively you can use 'useOTL' => 0 to disable all OTL features on a font.

  • Related