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

New test #117

Closed williamdes closed 6 months ago

williamdes commented 1 year ago

I wrote a new test at Debian, feel free to copy it https://salsa.debian.org/php-team/pear/php-font-lib/-/commit/8eaf263e4e46e058c10092bb2fc8f57d166353d7#c7b64e342fbabe70eb0b971e27dbfec490fccf92_0_54

Or to close this issue :)

Yeah I had to remove the font files because of the missing licences for them in sample-fonts

bsweeney commented 1 year ago

I'll need to look at the fonts to see if there's an applicable license. Otherwise, I'll look for something that's compatible with the library license.

williamdes commented 1 year ago

Thank you so much, it helps with packaging The same problem applies for the dompdf library, there is ttf files and afm files without a license for them

bsweeney commented 1 year ago

The AFM files included with Dompdf are for the PDF core fonts. The license for those is in the mustRead.html.

I will look at what we need to do for the DejaVu fonts. The UFM files were generated by the Dompdf team and not provided by the DejaVu team.

williamdes commented 1 year ago

The AFM files included with Dompdf are for the PDF core fonts. The license for those is in the mustRead.html.

I probably missed them, a license file would be great and more explicit

I will look at what we need to do for the DejaVu fonts. The UFM files were generated by the Dompdf team and not provided by the DejaVu team.

Can you provide a way to re-build them? We "can not" accept non human readable built files, we need to re build them from source at Debian

bsweeney commented 1 year ago

The UFM files are human readable. They're just a delimited text file with a format similar to the AFM format. The files were built using php-font-lib so re-building them is straightforward:

$font = FontLib\Font::load("/path/to/file.ttf");
if ($font instanceof FontLib\TrueType\Collection) {
    $font = $font->getFont(0);
}
$font->parse();
$font->saveAdobeFontMetrics(__DIR__ . '/output/' . basename($test_file) . '.ufm');
williamdes commented 1 year ago

Thank you, you can close this issue now or when you cherry-picked my test if you want to

bsweeney commented 1 year ago

I'll keep this open so I don't forget to review that test.

bsweeney commented 8 months ago

Suggestions on how to handle this in php-font-lib?

Intel Clear is licensed under Apache 2.0 https://github.com/intel/clear-sans

Noto fonts are licensed under OFL https://fonts.google.com/noto/specimen/Noto+Sans+Shavian/about

williamdes commented 8 months ago

A folder for fonts in tests with a license file in each subfolder? And if possible a txt with where each font was downloaded?

bsweeney commented 6 months ago

PR #130 adds that new test and modifies the font structure. I also switched from Intel Clear-Light to the W3C font Ahem, which was developed more for layout unit testing but which I thought it may prove useful in future test development since it uses glyph metrics designed for ease of testing.

Let me know if you have any feedback.