utils icon indicating copy to clipboard operation
utils copied to clipboard

load_font lost previous fonts

Open Cyrille37 opened this issue 8 years ago • 1 comments

Hi, While trying to add several fonts to my projet I discover that load_font.php create the file dompdf_font_family_cache.php. This file is then used while rendering.

So when I added a second font with load_font.php then the file dompdf_font_family_cache.php missing the first added font, and render missing this first font.

How do you manage this case ?

The only solution I found is, before using load_font, copying dompdf_font_family_cache.php, then extract previous font definition, then copy it in the newly generated dompdf_font_family_cache.php.

Cheers.

Cyrille37 avatar Aug 20 '17 09:08 Cyrille37

Hi there. I found a workaround here:

Add this in function install_font_family as followings:

...
function install_font_family($dompdf, $fontname, $normal, $bold = null, $italic = null, $bold_italic = null) {
  $fontMetrics = $dompdf->getFontMetrics();
  $fontMetrics->loadFontFamilies();
...

boxsnake avatar Dec 31 '24 14:12 boxsnake