FontForge is a great tool for converting fonts. I needed to convert a lot of OpenType fonts to TrueType or Type 1 format to use them with Apache FOP, as FOP doesn't yet support OpenType fonts with CFF glyph formats. Doing the conversion in one FontForge script didn't work well, because (a) it leaked memory until it got OOM-killed and (b) it only used one CPU. So I wrote a helper shell script to control the job - posted here in case anyone else needs it later.
- Runs multiple FontForge processes ($CPUS) for faster conversion;
- Limits each FontForge process to converting 10 fonts before a new one is spawned, limiting memory leaks while avoiding too much launch overhead
- Filters the conversion log to eliminate messages I'm not so interested in seeing. You can tune the filter (awk script) to your taste.
You can grab it here (raw text download)
Thanks for this: I've incorporated it into packaging up a ttf-stix deb for internal use (for fop as well), by running it at deb build time. Could you make the license explicit? (GPL, BSD, etc.) Also, it seems the blog post stripped some quotes around __END__ ? (At least, to make it work for me, I had to quote those to suppress substitution of the HERE doc text)ReplyDelete
Ross: Annotated to make it clear this is a public domain release.ReplyDelete
Ross: You're right, shell metachars must be escaped within here document text. It should be fixed now.ReplyDelete
Craig: yup, looks better. The cool trick I just learned about HERE docs though, when looking this up, is that if you quote the limit string itself (__END__ in this case) it suppresses expansion for that text - nice way to avoid all the sprinkling of backslashes.ReplyDelete
The other really weird thing: start the limit string w/ a dash (-) will suppress initial tabs, so you can indent your HERE doc.
Ross: Thanks for the tip; I hadn't spotted either of those handy here doc tricks, so thanks.ReplyDelete