llms_get_certificate_fonts()

Retrieves a list of fonts available for use in certificates.


Return Return

(array[]) Array of font definition arrays. The array key is the font's unique id.

  • 'name'
    (string) The human-readable name of the font.
  • 'href'
    (string|null) The href used to load the font or null for system or default fonts.
  • 'css'
    (string|null) The CSS font-family rule value.


Top ↑

Source Source

File: includes/functions/llms.functions.certificate.php

function llms_get_certificate_fonts() {
	/**
	 * Determines whether or not webfonts are loaded from Google CDNs.
	 *
	 * @since 6.11.0
	 *
	 * @param bool $use_g_fonts If `true`, fonts are loaded from Google, otherwise they are loaded from the local site.
	 */
	$use_g_fonts = apply_filters( 'llms_use_google_webfonts', false );
	$serif       = '"Iowan Old Style", "Apple Garamond", Baskerville, "Times New Roman", "Droid Serif", Times, "Source Serif Pro", serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"';

	$fonts = array(

		// Default fonts.
		'sans'                => array(
			'name'       => __( 'Sans-serif', 'lifterlms' ),
			'href'       => null,
			// From https://systemfontstack.com.
			'fontFamily' => '-apple-system, BlinkMacSystemFont, "avenir next", avenir, "segoe ui", "helvetica neue", helvetica, Ubuntu, roboto, noto, arial, sans-serif',
		),
		'serif'               => array(
			'name'       => __( 'Serif', 'lifterlms' ),
			'href'       => null,
			// From https://systemfontstack.com.
			'fontFamily' => $serif,
		),

		// Newspaper-style display fonts.
		'pirata-one'          => array(
			'name'       => 'Pirata One',
			'href'       => $use_g_fonts ? 'https://fonts.googleapis.com/css2?family=Pirata+One&display=swap' : LLMS_PLUGIN_URL . 'assets/css/pirata-one.css?ver=v22',
			'fontFamily' => '"Pirata One", ' . $serif,
		),
		'unifraktur-maguntia' => array(
			'name'       => 'UnifrakturMaguntia',
			'href'       => $use_g_fonts ? 'https://fonts.googleapis.com/css2?family=UnifrakturMaguntia&display=swap' : LLMS_PLUGIN_URL . 'assets/css/unifraktur-maguntia.css?ver=v16',
			'fontFamily' => '"UnifrakturMaguntia", ' . $serif,
		),

		// Cursive-style handwriting fonts.
		'dancing-script'      => array(
			'name'       => 'Dancing Script',
			'href'       => $use_g_fonts ? 'https://fonts.googleapis.com/css2?family=Dancing+Script&display=swap' : LLMS_PLUGIN_URL . 'assets/css/dancing-script.css?ver=v24',
			'fontFamily' => '"Dancing Script", ' . $serif,
		),
		'imperial-script'     => array(
			'name'       => 'Imperial Script',
			'href'       => $use_g_fonts ? 'https://fonts.googleapis.com/css2?family=Imperial+Script&display=swap' : LLMS_PLUGIN_URL . 'assets/css/imperial-script.css?ver=v24',
			'fontFamily' => '"Imperial Script", ' . $serif,
		),

	);

	/**
	 * Filters the list of fonts available to certificates.
	 *
	 * @since 6.0.0
	 *
	 * @param array[] $fonts Array of font definitions, {@see llms_get_certificate_fonts()}.
	 */

	return apply_filters( 'llms_certificate_fonts', $fonts );

}


Top ↑

Changelog Changelog

Changelog
Version Description
6.11.0 Added internal call for certificate fonts, with external option enabled.
6.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.