In setting up our installation of dompdf 0.7.0 using the provided load_font.php file, some fonts did not install properly using the the script, and were throwing the following error:
Warning: unpack(): Type n: not enough input, need 2, have 0 in /home/rpgbardc/public_html/dompdf_070/lib/php-font-lib/src/FontLib/BinaryStream.php on line 183
I have done some looking into this, and it looks like as the font setup occurs, during the Adobe Font Metrics generation step, problematic fonts are not returning any records in the AdobeFontMetrics::write method AdobeFontMetrics.php line 65, causing the foreach loop immediately after to fail. In my case, the $font variable is an instance of the class declared in /FontLib/TrueType/File.php, and in looking at the getData method of that class, it looks like the instance's $this->data[ 'name' ] property is unset, so the method returns null. In inspecting the $this->data array on these fonts, it is empty.
$this->data seems to come from the getData method, which calls the parseTableEntries method, which calls parseHeader. In this method, sometimes $this->header is already set up, but if so $this->header->data is empty, and other times $this->header is not set up, so it is setup in the method, but inspecting the header after it is created, the header has NULL set for its data property. This is as far as I have tracked it down so far, and I have not looked into the inner workings of the /FontLib/TrueType/File::parseHeader method to figure out why the data array is not being set up.
Let me know if you have any ideas why this would be problematic for certain fonts, and if it is helpful we have been able to install these fonts successfully in dompdf 0.6.2, so this appears to be unique to the beta at this time. I'm happy to help if I'm able, and will try to continue to troubleshoot things on my end.
thanks,
Dan Steeby