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.73k stars 256 forks source link

Subset fails: OTS parsing error: hhea: misaligned table #119

Closed OlegKunitsyn closed 6 months ago

OlegKunitsyn commented 1 year ago

Any subset of OpenSans-Regular.ttf throws an error in FF and Chrome: OTS parsing error: hhea: misaligned table

bsweeney commented 1 year ago

Any issues during subset creation? I'm able to create a subset but during the process there's a parsing issue. This could be the cause of the invalid formatting of the subset.

Undefined offset: XXX in D:\code\php-font-lib\php-font-lib\src\FontLib\Glyph\OutlineComposite.php on line 230

(the specific offset depends on the subset)

bsweeney commented 9 months ago

It looks like the mis-aligned table issue is actually caused by a lack of table padding in the generated font. Tables are supposed to conform to a 4-byte block size (i.e. the size of the table should be a multiple of 4). If the table doesn't fully fill a block php-font-lib should be padding it out but it was not.