Last active
October 13, 2017 12:58
-
-
Save hlashbrooke/11402653 to your computer and use it in GitHub Desktop.
Sensei Certificates: Use custom font in certificate PDFs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Custom fonts MUST be uploaded to the following directory: | |
* /wp-content/plugins/sensei-certificates/lib/tfpdf/font/unifont/ | |
* | |
* All custom fonts MUST be TrueType fonts (.ttf) | |
* | |
* Only one custom font can be used and it will override ALL fonts in ALL templates | |
**/ | |
add_filter( 'sensei_certificates_custom_font', 'certificates_custom_font', 10, 1 ); | |
function certificates_custom_font( $font ) { | |
// Font family and file name MUST be supplied | |
$font = array( | |
'family' => 'FontFamily', | |
'file' => 'font-file.ttf', | |
); | |
// Sepcifying font size is optional - if it is left out the then the sizes specified in the template will be used | |
$font['size'] = 18; | |
return $font; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Since update to latest Sensei this function causes an error when previewing/accessing the Sensei Certificates from either admin or customer interface. # #