I am trying to generate PDF with the german word "möchte" (the letter ö is the issue here).. using the font that I added(Open Sans) in /ttfonts
folder and set it on config_fonts.php
..
"open_sans" => array(
'B' => "OpenSans-Bold.ttf",
'BI' => "OpenSans-BoldItalic.ttf",
'EB' => "OpenSans-ExtraBold.ttf",
'EBI' => "OpenSans-ExtraBoldItalic.ttf",
'I' => "OpenSans-Italic.ttf",
'L' => "OpenSans-Light.ttf",
'LI' => "OpenSans-LightItalic.ttf",
'R' => "OpenSans-Regular.ttf",
'SB' => "OpenSans-Semibold.ttf",
'SBI' => "OpenSans-SemiboldItalic.ttf",
'useOTL' => 0xFF,
'useKashida' => 75,
)
I also read https://mpdf.github.io/fonts-languages/fonts-in-mpdf-6-x.html and tried modifying config_lang2fonts.php
.. I even set it everything to open_sans
$unifont = "open_sans";
return array($coreSuitable ,$unifont);
PS: The font file Open Sans I downloaded is already no subsetting.
But the output is still not like as I expected, it shows:
PHP
$mpdf = new mPDF('','A4','','open_sans' , 30 , 12 , 12 , 12 , 10 , 10);
Mark Up
@font-face{
font-family:open_sans;
src: url('mypath/mpdf60/ttfonts/OpenSans-Regular.ttf');
}
I tried using the default fonts of mPDF like dejavusans, It works perfectly. But what I need is Open Sans. Did I miss a configuration in mPDF or what? What is the problem?
The fact that you see a regular o
followed by an unknown character strongly suggests the second character is a single non-spacing diaeresis, not available in the font you are using.
Checking the character sets of DejaVu Sans and Open Sans proves my hunch is right. DejaVu Sans does contain a 'COMBINING DIAERESIS' U+0308: ¨
. OpenSans does not.
Use Unicode Normalization on your input text to replace the sequence o+¨
with its composite character ö
U+00F6
. The same goes for ä
U+00E4
and ü
O+00FC
.