Skip to content

Instantly share code, notes, and snippets.

@Dinamiko
Created February 25, 2018 12:22
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Dinamiko/d925d927ae5617fcbb7baa0af6731423 to your computer and use it in GitHub Desktop.
Save Dinamiko/d925d927ae5617fcbb7baa0af6731423 to your computer and use it in GitHub Desktop.
<?php
/**
* Define the directory with the font via fontDir configuration key.
*/
add_filter( 'dkpdf_mpdf_font_dir', function ( $font_dir ) {
// path to wp-content directory
$wp_content_dir = trailingslashit( WP_CONTENT_DIR );
array_push( $font_dir, $wp_content_dir . 'fonts' );
return $font_dir;
});
/**
* Define the font details in fontdata configuration variable
*/
add_filter( 'dkpdf_mpdf_font_data', function( $font_data ) {
$font_data['montserrat'] = [
'R' => 'Montserrat-Regular.ttf',
];
return $font_data;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment