Created
February 25, 2018 12:22
-
-
Save Dinamiko/d925d927ae5617fcbb7baa0af6731423 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
/** | |
* 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