1. Go to this page and download the library: Download uxcode-fr/font-optimizer 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/ */
uxcode-fr / font-optimizer example snippets
return [
'source' => 'resources/fonts', // directory containing .ttf source files
'destination' => 'public/fonts', // directory where output files will be saved
'unicodes' => 'U+0020-007F,U+00A0-00FF,U+0152-0153,U+20AC,U+2019,U+201C,U+201D', // Unicode ranges to subset
'features' => 'kern,liga', // OpenType features to preserve
'flavor' => 'woff2', // output format: woff2 or woff
'name_ids' => '*', // name table IDs to keep (* = all)
'hinting' => true, // keep hinting instructions
];
return [
'source' => 'resources/fonts',
'destination' => 'public/fonts',
'unicodes' => '*', // keep all glyphs — no subsetting
'features' => '*', // keep all OpenType features
'flavor' => 'woff2',
];