dompdf/php-font-lib

Undefined index: glyf - phenx/php-font-lib/src/FontLib/TrueType/File.php, line 329

consolibyte opened this issue · 6 comments

PHP 7.0.6

The line in question is this:

  /**
   * @param $name
   *
   * @return Table
   */
  public function getTableObject($name) {
    return $this->data[$name];
  }

This seems to be somehow related to these styles -- if I remove these styles from my DomPDF document, the error goes away:

@font-face {
				font-family: 'Basis Grotesque';
				font-style: normal;
				font-weight: 400;
				src: url('/chargeover/fonts/basis-grotesque-regular-pro.otf');
			}

			@font-face {
				font-family: 'Basis Grotesque';
				font-style: bold;
				font-weight: 700;
				src: url('/chargeover/fonts/basis_grotesque_bold.otf');
			}

			* {
				font-family: "Basis Grotesque", sans-serif;
			}

			div, td {
				font-family: "Basis Grotesque", sans-serif;
				color: black;
				vertical-align: top;
			}

Dompdf doesn't support OTF fonts at present. Do you have TTF versions?

That's interesting... since the OTF versions were working fine up until I upgraded to DomPDF 8.0.1.

I do have the TTF versions, but they result in the same error message. However, the TTF versions I have were converted from the OTF versions. I have attached both versions.

Archive.zip

I'd be curious to see a sample HTML document and the resulting render from before. But you might open an issue in the Dompdf project since that's a concern not directly related to this error. With Dompdf 0.8.0 we added more checks in the font management portion of Dompdf to prevent processing of non-TTF files. Still, in earlier version I wouldn't expect Dompdf to process the font correctly.

I'm also getting this with specific fonts.

Not that this error occurs when attempting to subset a font that does not include a glyf table. A number of OpenType fonts use the CFF table instead. For full support ensure any font you're attempting to parse includes a glyf table.

Watch #10 for updates.