名称 最后更新
..
maps 正在载入提交数据...
sample-fonts 正在载入提交数据...
src/FontLib 正在载入提交数据...
tests/FontLib 正在载入提交数据...
.gitattributes 正在载入提交数据...
.gitignore 正在载入提交数据...
.htaccess 正在载入提交数据...
.travis.yml 正在载入提交数据...
LICENSE 正在载入提交数据...
README.md 正在载入提交数据...
bower.json 正在载入提交数据...
composer.json 正在载入提交数据...
index.php 正在载入提交数据...
phpunit.xml.dist 正在载入提交数据...

PHP Font Lib

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