Forum


Replies: 2   Views: 2115
Class 'phpdocx\libs\font_metrics' not found
Topic closed:
Please note this is an old forum thread. Information in this post may be out-to-date and/or erroneous.
Every phpdocx version includes new features and improvements. Previously unsupported features may have been added to newer releases, or past issues may have been corrected.
We encourage you to download the current phpdocx version and check the Documentation available.

Posted by shay.leydon@724.com.au  · 29-01-2019 - 01:15

version : phpdocx-advanced-8.5-ns

I have seen the previous topic on this missing class however i cannot find it, it is not in lib/pdf/include/font_metrics.php as mentioned https://www.phpdocx.com/help/forum/default/topic/1636

Classes/Phpdocx/Libs/DOMPDF_lib.php

line 3864

    $font = Font_Metrics::get_font($family, $subtype);

 

Posted by admin  · 29-01-2019 - 07:56

Hello,

That error appears when trying to use a not supported font family. Although the next release of phpdocx will remove it, you can update the method replacing this line:

$font = Font_Metrics::get_font($family, $subtype);

with:

$font = $family;

And:

$family = null;
if ($DEBUGCSS)  print '(default)';
$font = Font_Metrics::get_font($family, $subtype);

with:

$family = null;
//if ($DEBUGCSS)  print '(default)';
$font = $family;

Also remove the Exception in the same method:

throw new Exception("Unable to find a suitable font replacement for: '" . $this->_props["font_family"] ."'");

Regards.

Posted by admin  · 16-04-2019 - 17:40

Hello,

The Font_Metrics class exception when trying to use a not valid font was removed with the release of phpdocx 9.

Regards.