37 lines
878 B
PHP
37 lines
878 B
PHP
<?php
|
|
|
|
require __DIR__ . '/vendor/autoload.php';
|
|
|
|
use Dompdf\Dompdf;
|
|
use Dompdf\Options;
|
|
use FontLib\Font;
|
|
|
|
$fontDir = __DIR__ . '/storage/fonts/';
|
|
$fontCache = __DIR__ . '/storage/fonts/';
|
|
|
|
// Create directories if they don't exist
|
|
if (!is_dir($fontDir)) {
|
|
mkdir($fontDir, 0755, true);
|
|
}
|
|
|
|
// Font file path
|
|
$fontFile = __DIR__ . '/resources/fonts/AbrilFatface-Regular.ttf';
|
|
|
|
if (!file_exists($fontFile)) {
|
|
die("Font file not found: $fontFile\n");
|
|
}
|
|
|
|
// Copy font to storage/fonts
|
|
$destFont = $fontDir . 'AbrilFatface-Regular.ttf';
|
|
copy($fontFile, $destFont);
|
|
|
|
echo "Font copied to: $destFont\n";
|
|
|
|
// Load the font to generate metrics
|
|
$font = Font::load($fontFile);
|
|
$font->parse();
|
|
$font->saveAdobeFontMetrics($fontDir . 'AbrilFatface-Regular.ufm');
|
|
|
|
echo "Font metrics generated successfully!\n";
|
|
echo "Font 'AbrilFatface-Regular' is now available for use in PDFs.\n";
|