dompdf/php-font-lib
PHP font library used by dompdf to read, parse, and manipulate font files (TrueType, OpenType, WOFF). Provides glyph metrics, font subsetting, and embedding support, enabling accurate text rendering in generated PDFs and other font-processing tasks.
This library can be used to:
This project was initiated by the need to read font files in the DOMPDF project.
$font = \FontLib\Font::load('fontfile.ttf');
$font->parse(); // for getFontWeight() to work this call must be done first!
echo $font->getFontName() .'<br>';
echo $font->getFontSubfamily() .'<br>';
echo $font->getFontSubfamilyID() .'<br>';
echo $font->getFontFullName() .'<br>';
echo $font->getFontVersion() .'<br>';
echo $font->getFontWeight() .'<br>';
echo $font->getFontPostscriptName() .'<br>';
$font->close();
$font = FontLib\Font::load('fontfile.ttf');
$font->parse();
$font->saveAdobeFontMetrics('fontfile.ufm');
$font = FontLib\Font::load('fontfile.ttf');
$font->parse();
$font->setSubset("abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ.:,;' (!?)+-*/== 1234567890"); // characters to include
$font->reduce();
touch('fontfile.subset.ttf');
$font->open('fontfile.subset.ttf', FontLib\BinaryStream::modeReadWrite);
$font->encode(array("OS/2"));
$font->close();
How can I help you explore Laravel packages today?