Instantly share code, notes, and snippets.

Embed
What would you like to do?
Sensei Certificates: Use custom font in certificate PDFs
<?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;
}
?>
@parhaam

This comment has been minimized.

Copy link

parhaam commented Jul 9, 2017

Hi
Persian letters are written from right to left and joined in the certificate sensie plugin, pdf certificates are written in Persian letters separated from one another and left to right. How to fix this problem.

@beags121

This comment has been minimized.

Copy link

beags121 commented Oct 12, 2017

Since update to latest Sensei this function causes an error when previewing/accessing the Sensei Certificates from either admin or customer interface. # #

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment