0
votes

I have a set of OTF font files and I need to showcase the fonts by dynamically rendering the text into images with different OpenType features turned on and off. The text will be input by a website user in a manner like here or here.

Now, I need an advice on a library that is capable of achieving that. Any language suitable for web development will do (PHP, Python, Ruby whatever).

All the OTF fonts currently contain Postscript outlines but I can convert them to contain TTF outlines if there is no other option.

I am aware of the Python library for FontForge but I'm still looking for other less heavy options.

2

2 Answers

3
votes

There is HarfBuzz, but it is a C library and needs a bit of knowledge about fonts and text rendering. It is bundled with command line utilities that just does what you are asking for, but they depend on FreeType and Cairo.

0
votes

I've ended up with the following:

I set text and font size, and choose the OpenType features in a plain TeX document, render it with xetex, and finally convert the resulting PDF into PNG with pdftoppm.

The overall process takes about 0.2 sec which is rather long but quite suitable for my needs.