dompdf / php-font-lib

A library to read, parse, export and make subsets of different types of font files.
GNU Lesser General Public License v2.1
1.74k stars 255 forks source link

Chrome errors when loading generated subset TTF fonts, for all fonts #42

Closed oxygen closed 8 years ago

oxygen commented 8 years ago

I have generated a subset font for each font with only the letters from the font's file name. I was going to use these subset TTF files for a preview of the font.

Using these fonts: https://github.com/google/fonts All 1736 fonts fails with one of these errors:

(index):1 OTS parsing error: incorrect entrySelector for table directory (index):1 OTS parsing error: hhea: misaligned table

This is the code I am using to generate the subset files:

` $tmp=tempnam(sys_get_temp_dir(), $strFontFamily); $fontFile=\FontLib\Font::load($arrFont["path"]); $fontFile->parse();

$fontFile->setSubset($strFontFamily); $fontFile->reduce();

$fontFile->open($tmp, FontLib\BinaryStream::modeWrite); $fontFile->encode(array("OS/2")); $fontFile->close(); `

oxygen commented 8 years ago

Double post. Original: https://github.com/PhenX/php-font-lib/issues/41