To expand the selected answer (o11y_75) when converting your fonts, you need to use a specific name to include bold and italic options as well. This way you add only one font definition like this
$html2pdf->AddFont('opensans', 'normal', 'opensans.php'); $html2pdf->setDefaultFont('opensans');
When you convert fonts, name them, for example, as follows:
default: opensans bold: opensansb italic: opensansi bold italic: opensansbi
note that for the original name you add b, i and bi for each case. I did not find documentation on this issue, but I followed the nomenclature found on fonts that were already with TCPDF, and it worked.
source share