A library to read, parse, export and make subsets of different types of font files.

Installs: 19 353 457

Dependents: 36

Suggesters: 0

Security: 0

Stars: 1 205

Watchers: 21

Forks: 192

Open Issues: 26

0.5.1 2017-09-13 16:14 UTC

This package is auto-updated.

Last update: 2020-01-27 19:40:19 UTC


Build Status

This library can be used to:

  • Read TrueType, OpenType (with TrueType glyphs), WOFF font files
  • Extract basic info (name, style, etc)
  • Extract advanced info (horizontal metrics, glyph names, glyph shapes, etc)
  • Make an Adobe Font Metrics (AFM) file from a font

You can find a demo GUI here.

This project was initiated by the need to read font files in the DOMPDF project.

Usage Example

$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>';