The indexToLoc table stores the offsets to the locations of the glyphs in the font, relative to the beginning of the glyphData table. In order to compute the length of the last glyph element, there is an extra entry after the last valid index.
By definition, index zero points to the “missing character,” which is the character that appears if a character is not found in the font. The missing character is commonly represented by a blank box or a space. If the font does not contain an outline for the missing character, then the first and second offsets should have the same value. This also applies to any other characters without an outline, such as the space character. If a glyph has no outline, then loca[n] = loca [n+1]. In the particular case of the last glyph(s), loca[n] will be equal the length of the glyph data ('glyf') table. The offsets must be in ascending order with loca[n] <= loca[n+1].
Most routines will look at the 'maxp' table to determine the number of glyphs in the font, but the value in the 'loca' table must agree.
There are two versions of this table: a short version, and a long version. The version is specified in the indexToLocFormat entry in the 'head' table.
|Offset16||offsets[n]||The actual local offset divided by 2 is stored. The value of n is numGlyphs + 1. The value for numGlyphs is found in the 'maxp' table.|
|Offset32||offsets[n]||The actual local offset is stored. The value of n is numGlyphs + 1. The value for numGlyphs is found in the 'maxp' table.|
Note that the local offsets should be 32-bit aligned. Offsets which are not 32-bit aligned may seriously degrade performance of some processors.
This page was last updated 4 January 2017.
Comments to the MST group: how to contact us.