TTF subsetting in PDF: Type 42 fonts

Here’s a proof-of-concept PR that uses fonttools to subset TrueType fonts:

The fonttools library is a nontrivial dependency, but not huge either. It could also replace our type1font parsing code. It doesn’t have code for subsetting Type-1 fonts, but the subsetting support would probably be easier to write using fonttools. It supports OpenType and CFF fonts too, so it probably wouldn’t be too much work to add some kind of support for those in the vector backends. I don’t think it can replace FreeType for the bitmap backends, though.

Do you think it would be worth it to spend more time on this? I.e. would a more polished PR have a chance of getting merged?

Here’s one issue about this that got closed as wontfix:

Oh, I actually attempted this a few weeks ago, but didn’t get into the details of exporting the subset into PDF (just the, can fonttools subset what we want bit), and it was a bit hacky anyway.

I think you’d want to ask @anntzer.lee, as I believe he has some prototypes for removing ttconv as well.

I do, but that would only do type-3 subsetting in pure python (it’s quite short), not type-42.