Error adding new fonts

I have tried adding new fonts into my template. I spoke about this here: Font issue with Pro Reports

I have tried on a different host and clean wordpress installation and it still didn’t work, not sure what is going on. Is there a way to add manually? I have added the fonts to the fonts folder in the /upload folder and edited the dompdf font family files to add them in but it doesn’t seem to work, as I missing something to add the font in manually?

I added this to dompdf_font_family_cache.dist.php
‘stolzl’ =>
‘normal’ => $distFontDir . ‘/Stolzl-Book’,
‘bold’ => $distFontDir . ‘/Stolzl-Bold’

I added this to dompdf_font_family_cache.php
‘stolzl’ => array(
‘normal’ => $fontDir . ‘/Stolzl-Book’,
‘bold’ => $fontDir . ‘/Stolzl-Bold’,

The font files I added are in ttf format.

Thanks in advance.

I have since tried to add a ufm or afm file to this folder too, it seems to work but the letters are all wrong.

Not sure why this is, maybe encoding?

@Kai Hey - I’m just jumping into this thread now. I have read your other thread and this one.

Looking up the procedure that you have described I found this thread here:
(php - Custom Fonts for DOMPDF - Stack Overflow)

I’m not sure if that’s the solution you found as well - I noticed that they also accessed a specific php file through terminal in order to “load in” the new fonts. I believe that domPDF makes it’s own font variants that then are “soft linked” to the css font-family attribute.

I will continue to look into this and see what I can come up with - may you please re-share your custom template again here since the other link is expired?

after thought

Please keep in mind as well that any changes you make to any core MainWP Extension code will be overwritten once updated.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.