Skip to content

Chrome & Firefox errors when loading generated subset TTF fonts, for all fonts #41

Closed
@oxygen

Description

@oxygen

I have generated a subset font for each font with only the letters from the font's file name.
I was going to use these subset TTF files for a preview of the font.

Using these fonts: https://github.com/google/fonts
All 1736 fonts fails with one of these errors:

(index):1 OTS parsing error: incorrect entrySelector for table directory
(index):1 OTS parsing error: hhea: misaligned table

This is the code I am using to generate the subset files:

$tmp=tempnam(sys_get_temp_dir(), $strFontFamily);
$fontFile=\FontLib\Font::load($arrFont["path"]);
$fontFile->parse();

$fontFile->setSubset($strFontFamily);
$fontFile->reduce();

$fontFile->open($tmp, FontLib\BinaryStream::modeWrite);
$fontFile->encode(array("OS/2"));
$fontFile->close();

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/30616454-chrome-firefox-errors-when-loading-generated-subset-ttf-fonts-for-all-fonts?utm_campaign=plugin&utm_content=tracker%2F317728&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F317728&utm_medium=issues&utm_source=github).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions