Example #1
-1
        if (!copy($src, $dest)) {
            throw new Exception("Unable to copy '{$src}' to '{$dest}'");
        }
        $entry_name = mb_substr($dest, 0, -4);
        echo "Generating Adobe Font Metrics for {$entry_name}...\n";
        $font_obj = Font::load($dest);
        $font_obj->saveAdobeFontMetrics("{$entry_name}.ufm");
        $entry[$var] = $entry_name;
    }
    // Store the fonts in the lookup table
    $fontMetrics->setFontFamily($fontname, $entry);
    // Save the changes
    $fontMetrics->saveFontFamilies();
}
// If installing system fonts (may take a long time)
if ($_SERVER["argv"][1] === "system_fonts") {
    $fontMetrics = $dompdf->getFontMetrics();
    $fonts = $fontMetrics->getSystemFonts();
    foreach ($fonts as $family => $files) {
        echo " >> Installing '{$family}'... \n";
        if (!isset($files["normal"])) {
            echo "No 'normal' style font file\n";
        } else {
            install_font_family($dompdf, $family, @$files["normal"], @$files["bold"], @$files["italic"], @$files["bold_italic"]);
            echo "Done !\n";
        }
        echo "\n";
    }
} else {
    call_user_func_array("install_font_family", array_merge(array($dompdf), array_slice($_SERVER["argv"], 1)));
}