A library to read, parse, export and make subsets of different types of font files
Brian Sweeney 991d6a954f Set minimum PHP version to 7.1 for unit testing | 6 месяцев назад | |
---|---|---|
.github | 6 месяцев назад | |
maps | 13 лет назад | |
src | 6 месяцев назад | |
tests | 6 месяцев назад | |
.gitattributes | 10 месяцев назад | |
.gitignore | 10 месяцев назад | |
AUTHORS.md | 6 месяцев назад | |
LICENSE | 10 лет назад | |
README.md | 10 месяцев назад | |
SECURITY.md | 10 месяцев назад | |
composer.json | 6 месяцев назад | |
phpunit.xml.dist | 10 месяцев назад |
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();