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

Fixes a problem with php 7.4 #76

Closed LinkingYou closed 4 years ago

LinkingYou commented 4 years ago

This would fix the issue #75

carlospauluk commented 4 years ago

Please, merge!

eduardoturconi commented 4 years ago

Why is it taking so long to merge?

MatthiasKuehneEllerhold commented 4 years ago

Please merge and release... !

poldixd commented 4 years ago

Hm, the last commit of this package is almost two years ago :-(

marijnbent commented 4 years ago

I think someone needs to fork this

carlospauluk commented 4 years ago

I think someone needs to fork this

Totally agree!

carlospauluk commented 4 years ago

Please see: https://github.com/dompdf/dompdf/issues/2063

andrefedalto commented 4 years ago

I'm using dompdf through laravel and having the same issue. One workaround I could find is:

  1. Apply the fix by @LinkingYou locally on vendor\phenx\php-font-lib\src\FontLib\AdobeFontMetrics.php:142;
  2. Set your font folder for dompdf to a folder in your repository;
  3. Run your script to build the pdf locally, this will make dompdf generate all font temp files (ttf, ufm, php) in your font folder;
  4. Commit these files to your repository;
  5. Revert the local changes in AdobeFontMetrics.php;
  6. 🎉 dompdf will now use the parsed fonts instead of parsing them again. Remember you have to repeat all the steps here for each new font you use
jeliasson commented 4 years ago

@PhenX Can you kindly release master to 0.5.2? This will allow us to have it fixed in e.g. dompdf/dompdf.

enumag commented 4 years ago

@jeliasson There are more things wrong with 7.4, see https://github.com/PhenX/php-font-lib/pull/77. Also it would be good to have 7.4 compatibility verified on travis, see https://github.com/PhenX/php-font-lib/pull/74. In my opinion it makes no sense to make a release until these are merged.

jeliasson commented 4 years ago

@enumag It would surely be nice to have all 7.4 issues fixed in the same release, but considering there are downstream packages that seems to benefit from this merge alone I think it would not hurt to throw in a minor release. Anyway, let's hope for a few merges and a release bump soon.

sandervanhooft commented 4 years ago

+1 for a hot fix (minor release); many integrations are (partially) broken by this issue.

That being said, I don't have the full picture of what's involved (or anyone's time schedule).

bastihilger commented 4 years ago

What @sandervanhooft said. I also would like to kindly ask for a commit just addressing this one issue, if in any way possible.

jeliasson commented 4 years ago

Following up on what @LinkingYou suggested, here is a donkey-patch based off @andrefedalto's contribution (31cad9151aa2a7070e73bc53dc2d104fdce7e0c6).

# Donkey patch vendor/phenx/php-font-lib/src/FontLib/AdobeFontMetrics.php
cat vendor/phenx/php-font-lib/src/FontLib/AdobeFontMetrics.php | sed "s/\$tree\W\=\W\$kern\[\"tree\"\]\;/\$tree \= is_array\(\$kern\) \? \$kern\[\"tree\"\]\ : null\;/g" > ./donkey-patch.php && mv ./donkey-patch.php vendor/phenx/php-font-lib/src/FontLib/AdobeFontMetrics.php

# Verify output of donkey patch
cat vendor/phenx/php-font-lib/src/FontLib/AdobeFontMetrics.php | grep '$tree = '

Hope it helps someone!

dj3plles commented 4 years ago

This helps @jeliasson

ghost commented 4 years ago

@jeliasson Thanks a lot! This really helped

ngunyimacharia commented 4 years ago

Really hope this is permanently closed soon.

PhenX commented 4 years ago

Hello, 0.5.2 already has this fix, nothing was pushed to master since its release. What can I do more ?

ngunyimacharia commented 4 years ago

Had not noticed, left this thread before it was pushed. Thank you