php-font-lib icon indicating copy to clipboard operation
php-font-lib copied to clipboard

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

Open consolibyte opened this issue 8 years ago • 5 comments

PHP 7.0.6

The line in question is this:

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

consolibyte avatar Oct 31 '17 16:10 consolibyte

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;
			}

consolibyte avatar Oct 31 '17 16:10 consolibyte

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

bsweeney avatar Nov 19 '17 14:11 bsweeney

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

keith-chargeover avatar Nov 19 '17 14:11 keith-chargeover

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.

bsweeney avatar Nov 23 '17 04:11 bsweeney

I'm also getting this with specific fonts.

onassar avatar Jun 05 '18 21:06 onassar

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.

bsweeney avatar Jan 11 '24 04:01 bsweeney