@@ -8,15 +8,14 @@ This library can be used to:
88 * Extract advanced info (horizontal metrics, glyph names, glyph shapes, etc)
99 * Make an Adobe Font Metrics (AFM) file from a font
1010
11- You can find a demo GUI [ here] ( http://pxd.me/php-font-lib/www/font_explorer.html ) .
12-
1311This project was initiated by the need to read font files in the [ DOMPDF project] ( https://github.com/dompdf/dompdf ) .
1412
1513Usage Example
1614-------------
1715
16+ ### Base font information
1817```
19- $font = \FontLib\Font::load('../../ fontfile.ttf');
18+ $font = \FontLib\Font::load('fontfile.ttf');
2019$font->parse(); // for getFontWeight() to work this call must be done first!
2120echo $font->getFontName() .'<br>';
2221echo $font->getFontSubfamily() .'<br>';
@@ -27,3 +26,21 @@ echo $font->getFontWeight() .'<br>';
2726echo $font->getFontPostscriptName() .'<br>';
2827$font->close();
2928```
29+
30+ ### Font Metrics Generation
31+ ```
32+ $font = FontLib\Font::load('fontfile.ttf');
33+ $font->parse();
34+ $font->saveAdobeFontMetrics('fontfile.ufm');
35+ ```
36+
37+ ### Create a font subset
38+ ```
39+ $font = FontLib\Font::load('fontfile.ttf');
40+ $font->setSubset("abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ.:,;' (!?)+-*/== 1234567890"); // characters to include
41+ $font->reduce();
42+ touch('fontfile.subset.ttf');
43+ $font->open('fontfile.subset.ttf', FontLib\BinaryStream::modeReadWrite);
44+ $font->encode(array("OS/2"));
45+ $font->close();
46+ ```
0 commit comments