Site iconJava PDF Blog

Table order in OTF fonts

As part of our TrueType to OpenType font conversion (we need this for PDF to HTML5 conversion to ensure fonts display on all browsers), I have been playing with lots of raw OpenType font data and tables.

In theory TrueType to OpenType should be easier than Postscript to OpenType as there are more similarities. OpenType is a ‘synthesis’ of TrueType and Postscript and has versions to support both. More of the TrueType data can be reused rather than having to be recalculated.

However, the OpenType tables do need to be arranged in a very specific order. In the actual Header table, the tables are all listed with their lengths and offset location in the OpenType font file. This list needs to be in CASE-SENSITIVE alphabetical order (so OS/2 comes before cmap).

By contrast, the actual order of tables in the File needs to be in a certain order (this is because some tables contain values used by other tables). Here is my current miminum table list for an OpenType font

“head”,
“hhea”,
“maxp”,
“OS/2”,
“hmtx”,
“cmap”,
“loca”,
“glyf”,
“name”,
“post”

When examining OpenType font files, there are several tools available which provide lots of useful information. The most useful I have found so far is the Microsoft Font Validator, although LCDF package contains a very useful otfinfo tool. Do you have a favourite tool for checking OpenType font files?