Search code examples
windowsfontsgdiopentypecompact-font-format

Convert CFF fonts into OpenType fonts programmatically


Does anyone have any pointers where I can find extra information on how to create an opentype wrapper around a CFF font?

Currently I have a parser for CFF files so I can get all sorts of information out of it (cmap, glyph names, widths, names etc etc). Given this information I am unable to create an Opentype (truetype format like) wrapper so I can use the font on Windows using GDI; GDI will not load the Opentype font and the only thing I know is that it fails to load the font.

Does anyone know any additional information, validation applications, example code, get additional information why the font does not load from Windows etc etc?

Note: I am looking for information how to do it, not utilities and/or conversion tools.


Solution

  • Until now, I found three libraries you could reference:

    1. FreeType: mainly in the cff package. Its main entry is cff\cffload.c. The library is now on GitHub.
    2. FontForge: fontforge\parsettf.c, still on sf.net.
    3. fonttools: fonttools\cffLib.py, on GitHub.
    4. ots tools: cff.cc on Google Code

    In parsettf.c, George Williams wrote that "TrueType is a really icky format." ...Now that I understand it better it seems better designed, but the docs remain inconsistent. Sometimes badly so.

    IMO, the cff spec is just as bad. Maybe it is better designed. I might eventually look into it to confirm, but it might just be too old to be good.

    What old things are good? Parents, math and philosophy :) Anything else must be up-to-date!