2017 © Pedro PelĂĄez
 

library php-font-lib

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

image

phenx/php-font-lib

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

  • Saturday, April 14, 2018
  • by PhenX
  • Repository
  • 23 Watchers
  • 502 Stars
  • 9,093,547 Installations
  • PHP
  • 16 Dependents
  • 0 Suggesters
  • 139 Forks
  • 21 Open issues
  • 10 Versions
  • 9 % Grown

The README.md

PHPUnit tests, (*1)

PHP Font Lib

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, (*2)

This project was initiated by the need to read font files in the DOMPDF project., (*3)

Usage Example

Base font information

$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 Metrics Generation

$font = FontLib\Font::load('fontfile.ttf');
$font->parse();
$font->saveAdobeFontMetrics('fontfile.ufm');

Create a font subset

$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();

The Versions

14/04 2018

dev-master

9999999-dev https://github.com/PhenX/php-font-lib

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

  Sources   Download

LGPL-3.0

The Development Requires

by Fabien MĂ©nager

13/09 2017

0.5.1

0.5.1.0 https://github.com/PhenX/php-font-lib

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

  Sources   Download

LGPL-3.0

The Development Requires

by Fabien MĂ©nager

11/02 2017

0.5

0.5.0.0 https://github.com/PhenX/php-font-lib

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

  Sources   Download

LGPL-3.0

The Development Requires

by Fabien MĂ©nager

06/05 2015

0.4

0.4.0.0 https://github.com/PhenX/php-font-lib

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

  Sources   Download

LGPL-3.0

by Fabien MĂ©nager

19/03 2014

0.3.1

0.3.1.0 https://github.com/PhenX/php-font-lib

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

  Sources   Download

LGPL-3.0

by Fabien MĂ©nager

02/03 2014

0.3

0.3.0.0 https://github.com/PhenX/php-font-lib

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

  Sources   Download

LGPL-3.0

by Fabien MĂ©nager

01/02 2014

0.2.2

0.2.2.0 https://github.com/PhenX/php-font-lib

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

  Sources   Download

LGPL

by Fabien MĂ©nager

23/02 2013

0.2.1

0.2.1.0 https://github.com/PhenX/php-font-lib

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

  Sources   Download

LGPL

by Fabien MĂ©nager

21/02 2013

0.2

0.2.0.0 https://github.com/PhenX/php-font-lib

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

  Sources   Download

LGPL

by Fabien MĂ©nager

13/11 2012

0.1.1

0.1.1.0 https://github.com/PhenX/php-font-lib

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

  Sources   Download

LGPL

by Fabien MĂ©nager