LearnDash Certificate Font Issues: Question Marks, Accents & How to Fix Them

Affiliate Disclosure: We may be compensated if you use our links to make a purchase. We are extremely selective in who we partner with & only recommend products we believe in. Our affiliate relationships do not influence our recommendations.

Update: 26 Aug 2020
A LearnDash representative has posted a comment below with a better solution. This is what we now recommend.

Having trouble with certain unicode characters on your LearnDash certificates? Do you have students whose names contain letters with special accent marks? Or are you just seeing question marks on your certificates and have no idea why?

LearnDash allows you to offer certificates to your students after successful completion of quizzes and/or courses, but in rare cases, the student’s name might not appear correctly. The most common reason for this is the default font used for PDF generation doesn’t support certain special characters.

Update: 5 Feb 2020: Abdulwahab shared with me a response he received from LearnDash support. Since this was an official response from LearnDash, I’m going to include that solution first.

Recommended ProductKinsta hosting to boost site speed

I’ll keep the initial/old solution further down the page just in case.

 

I’m pasting LearnDash support’s exact response, word-for-word. I have not tried it out, but it worked for Abdulwahab, and it should work on any LearnDash site.

————

In order to use non-english characters on your certificate, you must utilize a Unicode-enabled font.

Here are the steps you can take to set up a unicode font to be used on your site for all your certificates.

Remember to take a complete backup of the site before making any changes.

Recommended Product

Rapyd WordPress Hosting
Rapyd just launched the fastest BuddyBoss, LearnDash & WordPress LMS hosting on the planet. Get 25% OFF with their early bird discount and lock-in up to 2 years of discounted pricing. From the creators of BuddyBoss.

Get 25% OFF Rapyd Today →

1. Create a new folder in our common LearnDash directory:
/wp-content/uploads/learndash/tcpdf/fonts/

2. Next, using FTP or similar, move all the fonts from /wp-content/plugins/sfwd-lms/includes/lib/tcpdf/fonts/ and copy them to /wp-content/uploads/learndash/tcpdf/fonts/

3. In your active theme’s functions.php file (or using the Code Snippets plugin), add the following code snippet:

add_action( 'learndash_init', function() {
	if ( ! defined( 'K_PATH_FONTS' ) ) {
		$wp_upload_dir = wp_upload_dir();
		$basedir = str_replace( '\\', '/', $wp_upload_dir['basedir'] );
		$ld_tcpdf_fonts_dir = trailingslashit( $basedir ) . 'learndash/tcpdf/fonts/';
		define( 'K_PATH_FONTS', $ld_tcpdf_fonts_dir );
	}
});

4. Now you can go about adding custom fonts as you like into this folder and no worries about the next time updating LearnDash.

As a final note, due to how the TCPDF config file is coded in /wp-content/plugins/sfwd-lms/includes/lib/tcpdf/config/tcpdf_config.php, you may see a PHP notice about K_PATH_FONTS already defined. This is because in the tcpdf_config.php file it does not first check if 'K_PATH_FONTS' is possibly already defined.

To create the font files, you can use any of the below tools:

Here is a link to an already converted Unicode font:
👉 Arial Unicode Font


Recommended Product

Uncanny Automator logo
Automate your LMS site with over 150+ plugins & apps. Uncanny Automator is the perfect no-code automation tool to replace dozens of WordPress plugins.

 • Supports LearnDash, Tutor LMS, LifterLMS, and most membership plugins
 • Trusted by 30,000 companies

Get 10% OFF with code affiliate10-dwarfel

👇 Here’s the initial/old solution 👇

Shoutout: Kudos to Ken & Patrick from the LearnDash LMS Tips & Tricks Facebook Group for raising the issue and finding the solution.

Quick Background on Certificate Generation

…or just jump right to the solution.

I just recently learned this myself, but it’s helpful to have a basic understanding on how LearnDash generates certificates. Here’s the super-simple, non-technical explanation.

LearnDash uses a third-party script called TCPDF to take the information you enter on a certificate in WordPress and convert it into a PDF that is generated on the fly. This script is included with the LearnDash plugin, and it comes with a handful of pre-determined defaults. One of those defaults is the font. Herein lies the issue.

LearnDash Default Certificate Font

By default, LearnDash sets the TCPDF default font to Helvetica. If you want to see it for yourself, open this file:

wp-content/plugins/sfwd-lms/includes/vendor/tcpdf/config/tcpdf_config.php
TCPDF default font code
Here’s the actual code that sets the default font for TCPDF in the config file

The version of Helvetica that comes with TCPDF in LearnDash doesn’t support every single character in the UTF-8 character set. I did some testing, and here’s an example of similar characters that it supports & doesn’t support.

  • Supports: è, é, ê, ë
  • Does not support: ē, ė, ę

I also tested it using the default serif font, adding <span style="font-family: serif;"> around the characters, but I got the same result as above.

How to Change the Default Certificate Font

I didn’t test every single unicode character (that’d be crazy 🤯), but I did test all the versions of the e above with the following fonts. I’m hopeful that if a font supports those characters, it should support the rest. Here’s what I know works:

Font Family Support
Open Sans Yes
Roboto Yes
Raleway Yes
Libre Baskerville Yes
Merriweather Yes
Montserrat Yes
Lato No

I only tested the “Regular” 400 weight version of each font. You can download a .zip file of all the TCPDF files for the above fonts. Choose one you like. Then skip to step #4 below.

LearnDash also has a TCPDF version of Arial here.

If you try this with other fonts, please let us know in the comments.

1. Download New Font from Google Fonts

  1. Navigate to fonts.google.com
  2. Search for the font you want to use (we’re using Open Sans in this example)
  3. Click the + icon to add it to your selection
  4. Click the download icon to download it to your computer

2. Convert Font from TTF to TCPDF Format

  1. Locate the .TTF file on your computer
  2. Navigate to fonts.snm-portal.com
  3. Drag’n’drop the .TTF file into the drop zone
  4. Check the box that says you have the rights to convert this font

3. Download TCPDF Font Files

  1. Make note of the Fontname value. You’ll need this in a second.
  2. Right-click and Save As for each of the three files:
    • opensans.z
    • opensans.ctg.z
    • opensans.php

4. Copy TCPDF Files to LearnDash

Using SFTP, or your method of choice, upload those three files into this directory:

wp-content/plugins/sfwd-lms/includes/vendor/tcpdf/fonts/

5. Update TCPDF Config File

Finally, you need to edit this file:

wp-content/plugins/sfwd-lms/includes/vendor/tcpdf/config/tcpdf_config.php

Search for this line:

define ('PDF_FONT_NAME_MAIN', 'helvetica');

Replace it with this line:

define ('PDF_FONT_NAME_MAIN', 'opensans');

You would change opensans to whatever your Fontname is.

IMPORTANT! Any time you update LearnDash to a new version, your code will be erased. You’ll likely need to upload the font files again, and edit the config file. Currently, there is no way around this, so save those 3 files.

Certificates in LearnDash 3.0

LearnDash 3.0 is scheduled for release sometime in Q1 2019. The CEO, Justin, has mentioned there will be improvements to LearnDash certificates. I’m hoping there might be some built in font choices, or at least better support for changing the default font without editing the plugin files.


Speaking of LearnDash certificates: Patrick has a LearnDash certificate tracker plugin you can download for free here. (Offered “as-is”. No support.)

Previous

How to Hide or Move LearnDash Progress Dots

Next

How to Display Course Title Over the Image in LearnDash Course Grid

25 Comments

  1. Kakybat

    very useful post!!!

  2. only24

    Hi! If you want to continue update your plugin you can define font in wp_config.php file in root of your site.

  3. Vitaly

    Very nice post!

  4. Ashraf Reda

    Very thanks, it solves 80% of the issue.
    I still search for Arabic font which it’s letters display correctly.

  5. Thank you for updating your valuable post.
    I used this method with Arabic font and works fine.

    • yassin

      hello i have the same problem how do you solve it

  6. Hi,
    When i add your code to my functions.php file in the child them of astra i get this error:
    “There has been a critical error on your website”.

    • Not sure what to tell you. This was the official solution provided by LearnDash, and it worked for some people that I know tried it out.

      It’s possible you’re putting it in the wrong place within your functions.php file. I’m not sure. Maybe ask LearnDash support for help.

  7. thanks alot. I’ve solved “urdu” language problem using your method.

  8. Pete

    Hi Dave,

    Any idea whether LearnDash has resolved this font issue? It’s crazy that you would need to go through all that just to display languages other than English on certificates; especially considering LearnDash is promoted as a global LMS!! They need to get their sh*t together!

    Appreciate if you could share any insight on this.

    • Hi Pete,

      They did upgrade to the most recent version of TCPDF in the latest update (LearnDash 3.2), so I think that changed some things, including the default font used.

      So this article might be outdated now, or the solution (if there is a problem) might be different. I haven’t had time to evaluate where things are with their newest release.

      It might be worth checking out, or asking on the LearnDash Facebook Group.

  9. John

    Dave,
    Thank you for the solution but as of Aug. 24, 2020, it didn`t work for me on a couple tries. 🙁
    Even tried installing OpenSans .

    Learndash still can`t handle UTF-8 (Japanese) character encoding in certificates? That is really surprising an more than a bit disappointing. This has got to be on the list of fixes very soon.

    I`ll have to shelf foreign language certificates until LD fixes this. I have no desire to redo this each time an update comes.

    As Dave mentions, “Any time you update LearnDash to a new version, your code will be erased. “

    • When LearnDash released version 3.2 about a month ago, they did a major update of the TCPDF library, which is what LearnDash uses to generate certificates. I’m guessing this is why the method I’ve outlined here no longer works.

      The changelog says, “Updated TCPDF library to most recent version, also new add-ons for legacy TCPDF library support and All TCPDF fonts.” I haven’t dug into it further to know exactly what was done.

  10. Jarret

    We have a much easier solution now fortunately in the form of a plugin:

    https://www.dropbox.com/s/j2iv4n8f918goe0/learndash-learndash-tcpdf-fonts.zip?dl=0

    You download this, install and activate and then just set the font-family with some inline CSS styling like explained in the LearnDash Default Certificate Font section of this. Has support for both versions before LearnDash 3.2 as well 3.2 and above.

    Plugin is rather large though at 60+ mb in size due to the font files. So some people may have issues with uploading this through their WP admin. If they do, they need to contact host and ask them to increase post_max_size and upload_max_filesize settings in PHP to higher than 70mb.

    If their host can’t do that, they can extract the folder from the zip file, then upload into their /wp-content/plugins directory through FTP/SFTP or a hosting control panel such as cPanel or similar and then just activate the plugin through WP admin.

    • Thanks Jarret. I’ve hosted the file myself and included a link at the top of the post down to this comment.

  11. I have what’s wrong, but I don’t know what the solution is. Sentences that contain the letter “Ő” are not displayed in learndash. What is the solution?

    • Is this happening only with certificates? Or is it happening everywhere on your LearnDash site?

      If it’s happening everywhere, sorry but I have no idea what would cause an entire sentence not to appear. If a single character doesn’t appear, it could mean that you’re using a font which doesn’t support that character or language, but I’ve never heard of an entire sentence disappearing because of a single character.

  12. Gergo

    I have installed the buddyboss learndash combo on a sub domain and it works perfectly. But I have to run on this. I tried deleting the learndash completely and putting it back on but it didn’t help. What do I need to delete to get a brand new installation? I turned off the other plugins to see if that’s the problem. But it didn’t get good either. I deleted learndasht with the WP DB CLEANER pro plugin. But after reinstallation, he showed the lessons in the same way e.g.
    I can send a guest editor entry or video so that if “Ő” letter is written, the answer will disappear.

    • To manually delete a WordPress installation, you should delete all files on the server. This includes about 15 files in the root directory, along with the /wp-admin/, /wp-includes/ and /wp-content/ folders. In addition, you should either delete the database or DROP all the tables in the database.

      You would then set up a completely new installation of WordPress through your host.

      But depending on your host, you should have an option to delete the WordPress install from your hosting control panel, and just reinstall a fresh version of WordPress with no content.

  13. Eli

    Hi
    Using the plugin in the comment has allwoed me to use the pre intall fonts in the plugins like arialuni – However, I need to use my own fonts so I used the website to convert the fonts to tcpdf and uploaded them to both folders of the plugin however (I tried this with 2 diffrent fonts but didn’t work with both. Any ideas how can I get them to work?

    • Sorry Eli but I’m not sure. I haven’t revisited this since I posted it almost 2 years ago, except to update it with some new plugin info from LearnDash. But I haven’t tried out any custom fonts for a certificate in a long time.

  14. yassin

    hello the arabic appear in ????????? ANY HELP

    • These solutions are very old and I’m not sure they’ll work anymore, or that they are the proper way to handle arabic characters. If you’re having trouble, I would reach out to LearnDash support. They’ll be able to help you best.

Leave a Reply

Your email address will not be published. Required fields are marked *