LMS & eLearning

How to Add Custom Fonts to the LearnDash Certificate Builder

Upload a brand typeface to the LearnDash Certificate Builder: which files it accepts, the Regular, Bold, Italic and Bold Italic slots, where the fonts are stored, how to select them, and what to do about missing glyphs.

How to Add Custom Fonts to the LearnDash Certificate Builder

Classic LearnDash certificates are limited to the handful of fonts bundled with TCPDF, which is why so many certificates look alike. The Certificate Builder add-on renders with mPDF and includes a Fonts page where an administrator uploads TrueType files, after which the typeface appears in the builder's font selector. This guide covers the LearnDash Certificate Builder fonts upload end to end, including the parts the settings page does not explain: what the files must contain, how the four style slots are used, and why a font can upload fine and still print boxes.

What ships by default

The builder's PDF component configures mPDF with three families from its own bundle: FreeSans, FreeSerif and FreeMono, with FreeSerif as the document default and FreeSans as the backup for characters a chosen font lacks. The builder block itself defaults to DejaVu Sans Condensed. These cover Latin, Greek and Cyrillic well, which is enough for many sites, but they are not anybody's brand typeface, and they have no script or display styles for the name line that designers usually want.

Preparing the font files

The uploader accepts TrueType font files, and it validates each one by reading its tables with mPDF's font analysis class before storing it, so a renamed file or a web-only format is rejected with an error rather than accepted and broken. In practice that means:

  • Use .ttf files. Convert OpenType, WOFF or WOFF2 files to TTF with a font tool first; a web font kit downloaded for CSS use is usually the wrong format.
  • Check the licence permits embedding in PDFs. Most open fonts do; some commercial desktop licences do not.
  • Gather up to four files for the family: Regular, Bold, Italic and Bold Italic. Only Regular is required; the form refuses the upload without it. Missing styles are synthesised by mPDF when a block asks for bold or italic, which looks acceptable for emphasis and poor for headlines, so upload the real Bold if the design uses it.
  • Give the family a label. If you leave it blank the builder uses the family name read from the Regular file.

Uploading

Go to LearnDash LMS > Certificates > Fonts. The page is only available to users with the manage_options capability, which on a single site means administrators. Fill in the label, choose the Regular file and any of the other three, and submit. The builder copies the files into its own folder under the uploads directory, records the family in the option learndash_certificate_builder_fonts, and lists it in a table with a column per style and a remove link. Removing a family deletes the entry and its files; a certificate that still names the removed family falls back to the default.

If the upload fails with a message about the file not being a font, open it in a font viewer to confirm it is a genuine TrueType file, and try re-exporting it. If it fails silently, check the PHP upload size limit; a full CJK font can exceed a small upload_max_filesize.

Selecting the font in a certificate

Edit the certificate, select the outer Certificate Builder block, and choose the family in its font setting. The choice applies to the whole certificate; individual headings and paragraphs inherit it. There is no per-block font selector in the builder, so a design that mixes a serif body with a script name line needs the script line as part of the background image, or a small custom block, rather than two uploaded fonts. Bold and italic come from the block toolbar and map to the Bold and Italic files you uploaded.

Save, then preview. The editor canvas does not load the uploaded font, so the on-screen preview still shows a system font; only the generated PDF uses the real file. Judge spacing and wrapping from the PDF.

Missing glyphs and fallbacks

A character the chosen font lacks is drawn from the backup font, FreeSans, which is why a certificate in an elegant serif can show one plain sans-serif letter in a learner's name. If a whole script is missing, for example a learner with a name in Devanagari or Arabic on a Latin-only font, mPDF falls back for the entire run. Upload a font that covers the scripts your learners use, or pick a wide-coverage family such as Noto for the name line. For right-to-left scripts, mPDF handles direction automatically once the font has the glyphs.

A box or question mark where a letter should be means neither the chosen font nor the backup has the character. Check the learner's display name for unusual characters, and consider a filter on the name value that normalises it; the learndash_usermeta_shortcode_field_value_display filter described in our certificate shortcodes reference is the place.

Adjusting mPDF directly

For anything the Fonts page cannot do, the builder exposes the mPDF instance through the learndash_certificate_builder_mpdf filter before the PDF is written. You can change the default font, add a font directory the uploader does not know about, or tweak substitution behaviour:

add_filter( 'learndash_certificate_builder_mpdf', function ( $mpdf ) {
    // Prefer our uploaded brand family when a block does not set one.
    $mpdf->SetDefaultFont( 'brandserif' );
    return $mpdf;
} );

The family key is the sanitised label shown on the Fonts page. Keep such code in a small plugin rather than the theme so it survives a theme change. Our comparison of the builder and classic certificates covers the other filters the add-on offers.

Performance and caching

mPDF builds a cache of font metrics on first use, in a writable temp directory. On a host with a read-only plugin directory the first PDF after a font upload can be slow or fail; subsequent ones are fast. If every download is slow, check that the temp directory is writable and not being cleared by a cleanup job. Large fonts also enlarge every PDF because the used glyphs are embedded; subsetting is on by default, so a typical certificate stays well under a megabyte.

Classic certificates

None of this applies to classic certificates, which use TCPDF's bundled fonts only. Adding a font to TCPDF is possible but involves converting the file with TCPDF's tools and shipping the result in a custom location, which is more work than switching the certificate to the builder. If a font is the only reason for the switch, our Certificate Builder getting started guide shows how little the switch involves.

When to get help

Uploading a licensed TTF and picking it in the block is a ten-minute job. Get a developer involved for multi-script sites where the font must change per learner, for per-block font mixing, or for converting a brand's OpenType-only typeface safely. Those fall under our LearnDash services, and a LearnDash developer can set up a complete font stack for the builder in a short engagement.

Frequently asked questions

Can I upload Google Fonts to the Certificate Builder?

Yes, as long as you download the TTF files rather than linking the stylesheet. Google's download provides TTFs under the Open Font License, which allows PDF embedding.

Why does my uploaded font not show in the editor preview?

The editor uses browser fonts and does not load the uploaded file. The PDF does. Check the result from a generated PDF, not the canvas.

Can different certificates use different fonts?

Yes. The font is chosen per certificate in the builder block, so one certificate can use the brand serif and another a sans-serif.

Who can upload fonts?

Users with the manage options capability, which is administrators on a single site and super administrators on a network. Group leaders and instructors cannot.

Add WorldWin Coder to your preferred sources

Add worldwincoder.com as a preferred source on Google, or open this article in your AI assistant to use it as a source.

· Developers and project managers

Articles written and reviewed by the developers and project managers at WorldWin Coder, who build and maintain websites, web applications and mobile apps on WordPress, Moodle, PHP, Laravel, CodeIgniter and Flutter.

Keep reading

Have something to build, fix or move?

Tell us where you are. A developer reads every inquiry, and you get next steps and a free quote within one business day.