1. Go to this page and download the library: Download jdz/fontmanager library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
jdz / fontmanager example snippets
use JDZ\FontManager\FontsDb;
use JDZ\FontManager\Providers\GooglefontsProvider;
use JDZ\FontManager\Providers\MrandtlfProvider;
use JDZ\FontManager\Exceptions\FontException;
$fontsDb = new FontsDb(__DIR__ . '/fonts', ['ttf', 'woff2', 'woff']);
$fontsDb
->addProvider(new MrandtlfProvider())
->addProvider(new GooglefontsProvider()) // API key from $_ENV['GOOGLE_FONTS_API_KEY'], or pass it
->load() // index the local folder (it must exist)
->loadDistantFonts(); // add the provider catalogs (needed before install())
$subsets = ['latin', 'latin-ext'];
try {
$fontsDb->install('Roboto', 300, null, $subsets);
$fontsDb->install('Montserrat/700italic@latin,latin-ext');
} catch (FontException $e) {
echo $e->getFontError();
}
$font = $fontsDb->get('Roboto', 'light', null, $subsets);
// (object) [id, family, style, weight, display, version, local,
// files => ['ttf' => '…', 'woff2' => '…', 'woff' => '…']]
// or false when the variant is not installed
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.