I am using Dompdf to generate and send a PDF via email from my Wordpress site. I am attempting to use a custom font and the normal
font-weight is working correctly, but bold
is not.
Here's what my HTML variable looks like:
$html =
'<html>
<body>
<style>
@font-face {
font-family: "Proxima Nova";
font-weight: normal;
font-style: normal;
src: url(' . get_template_directory() . '/fonts/ProximaNova-Reg.woff2) format("woff2"), url(' . get_template_directory() . '/fonts/ProximaNova-Reg.woff) format("woff");
}
@font-face {
font-family: "Proxima Nova";
font-weight: bold;
font-style: normal;
src: url(' . get_template_directory() . '/fonts/ProximaNova-Bold.woff2) format("woff2"), url(' . get_template_directory() . '/fonts/ProximaNova-Bold.woff) format("woff");
}
body,html {font-family:"Proxima Nova";}
</style>
<table>
<thead>
<tr>
<th>Test</th>
<th>Test</th>
<th>Test</th>
</tr>
</thead>
<tbody>
<tr>
<td>Test</td>
<td>Test</td>
<td>Test</td>
</tr>
</tbody>
</table>
</body>
</html>';
When I open the generated PDF, the td
s are correctly displayed in the Proxima Nova font, but the th
s are not. The weird thing is that if I just email the HTML to myself using wp_mail
the bold font works correctly. It's only in the PDF that it doesn't work. Any ideas?
I do not have the font installed locally
th{font-weight: bold;}
to see if that kicks it in. – Chris Haas