A file with .otf extension refers to OpenType font format. OTF font format is more scalable and extends the existing features of TTF formats for digital typography. Developed by Microsoft and Adobe, OTF combines the features of PostScript and TrueType font formats. This makes OTF format to accommodate majority writing systems and that is why it is uniformly used on major computer platforms. The OpenType font format is supported by Mac OS X and Windows 2000 and later.
The requirement of OpenType fonts originated as a requirement for a more expressive font format that could handle fine typography. In addition, it was aimed to meet the requirements of complex behaviour of many of the world’s writing systems. Microsoft attempted to license Apple’s advanced typography technology, known as GX Typography, in the early 1990’s. This didn’t go well and as a result, Microsoft started enhancing its owns TrueType font technology in 1994. The modifications also included to introduce a more suitable font format that also meets the features of Adobe’s Type 1 (PostScript) font formats.
Adobe, in 1996, joined Microsoft in its efforts to supersede both Apple’s TrueType and its own Type 1 font formats. This resulted in combination of both underlying font formats to overcome the limitations and add new extensions. This new technology was introduced the same year with the name OpenType.
OTF File Format Specifications
OTF specifications are available publicly by Microsoft and can be referred to from developer’s perspective. Like TTF, it uses the same ‘sfnt’ container structure and is compatible with the TrueType specifications. Data inside an OpenType font file is used for different purposes such as calculating the text layout, defining glyphs as TrueType or Compact Font Format (CFF) outlines, providing monochromatic or color bitmaps or SVG documents as alternate glyph descriptions, and meta-data information.
OTF Data Types
OTF files use the following data types which are all in Big Endian.
8-bit unsigned integer.
8-bit signed integer.
16-bit unsigned integer.
16-bit signed integer.
24-bit unsigned integer.
32-bit unsigned integer.
32-bit signed integer.
32-bit signed fixed-point number (16.16)
int16 that describes a quantity in font design units.
uint16 that describes a quantity in font design units.
16-bit signed fixed number with the low 14 bits of fraction (2.14).
Date and time represented in number of seconds since 12:00 midnight, January 1, 1904, UTC. The value is represented as a signed 64-bit integer.
Array of four uint8s (length = 32 bits) used to identify a table, design-variation axis, script, language system, feature, or baseline
Short offset to a table, same as uint16, NULL offset = 0x0000
Long offset to a table, same as uint32, NULL offset = 0x00000000
Packed 32-bit value with major and minor version numbers. (See Table Version Numbers.)
OTF Tables Directory
An OTF file starts with a table directory. This directory is the top-level collection of the tables in the font file. Depending on the number of fonts in a file, the table directory may be located at different location in the file. For example, in case the font file has only one font, the table directory starts at the byte 0 of the file. In case of multiple OpenType Fonts collection,
the table directory beginning is indicated in the TTCHeader.
0x00010000 or 0x4F54544F (‘OTTO’)
Number of tables.
Maximum power of 2 less than or equal to numTables, times 16 ((2**floor(log2(numTables))) * 16, where “**” is an exponentiation operator).
entrySelector Log2 of the maximum power of 2 less than or equal to numTables (log2(searchRange/16), which is equal to floor(log2(numTables))).
numTables times 16, minus searchRange ((numTables * 16) - searchRange).
Table records array—one for each top-level table in the font
For each top-level table in the font, there is a Table Record which consists of the following fields.
Checksum for this table.
Offset from beginning of font file.
length Length of this table.
Each table in the OpenType font file is represented by names known as table tags. It is a must for all the records in the array to be sorted in ascending order by tag.