Format 2: High-byte mapping through table
This subtable is useful for the national character code standards used for Japanese, Chinese, and Korean characters. These code standards use a mixed 8/16-bit encoding, in which certain byte values signal the first byte of a 2-byte character (but these values are also legal as the second byte of a 2-byte character). Character codes are always 1-byte. The glyph set is limited to 256.
In addition, even for the 2-byte characters, the mapping of character codes to glyph index values depends heavily on the first byte. Consequently, the table begins with an array that maps the first byte to a 4-word subHeader. For 2-byte character codes, the subHeader is used to map the second byte’s value through a subArray, as described below. When processing mixed 8/16-bit text, subHeader 0 is special: it is used for single-byte character codes. When subHeader zero is used, a second byte is not needed; the single byte value is mapped through the subArray.
Type Name Description
USHORT format Format number is set to 2.
USHORT length Length in bytes.
USHORT version Version number (starts at 0)
USHORT subHeaderKeys[256] Array that maps high bytes to subHeaders: value is subHeader index * 8.
4 words struct subHeaders[ ] Variable-length array of subHeader structures.
4 words-struct subHeaders[ ]
USHORT glyphIndexArray[ ] Variable-length array containing subarrays used for mapping the low byte of 2-byte characters.
A subHeader is structured as follows:
Type Name Description
USHORT firstCode First valid low byte for this subHeader.
USHORT entryCount Number of valid low bytes for this subHeader.
SHORT idDelta See text below.
USHORT idRangeOffset See text below.
The firstCode and entryCount values specify a subrange that begins at firstCode and has a length equal to the value of entryCount. This subrange stays within the 0–255 range of the byte being mapped. Bytes outside of this subrange are mapped to glyph index 0 (missing glyph).The offset of the byte within this subrange is then used as index into a corresponding subarray of glyphIndexArray. This subarray is also of length entryCount. The value of the idRangeOffset is the number of bytes past the actual location of the idRangeOffset word where the glyphIndexArray element corresponding to firstCode appears.
Finally, if the value obtained from the subarray is not 0 (which indicates the missing glyph), you should add idDelta to it in order to get the glyphIndex. The value idDelta permits the same subarray to be used for several different subheaders. The idDelta arithmetic is modulo 65536.
格式2 : 映射通过桌的高字节
这subtable为用于日本,中国和韩国字符的民族特性代码标准是有用的。 这些代码标准使用一个混杂的8/16位内码,某一字节重视信号2字节字符的第一个字节(但是这些价值也是法律的作为2字节字符的第二个字节)。 字符码总是1字节。 纵的沟纹集合被限制到256。
另外,甚而为2字节字符,映射字符码到纵的沟纹给定值沉重取决于第一个字节。 结果,桌从映射第一个字节对4词subHeader的列阵开始。 为2字节字符码, subHeader用于通过subArray映射第二字节的价值,如下所述。 当处理混杂的8/16位文本时, subHeader 0是特别的: 它为唯一字节字符码使用。 When subHeader zero is used, a second byte is not needed; the single byte value is mapped through the subArray.
首先键入命名
描述USHORT firstCode合法的低字节为这subHeader。
USHORT合法的低字节的entryCount数字为这subHeader。
短的idDelta看文本如下。
USHORT idRangeOffset看文本如下。
firstCode和entryCount价值指定开始在firstCode并且有长度相等与entryCount的价值的subrange。 这subrange在被映射的字节的0-255范围之内停留。 字节在这subrange外面被映射到纵的沟纹索引0 (错过的纵的沟纹)。字节的垂距在这subrange之内然后使用作为索引到对应subarray里glyphIndexArray。 这subarray也是长度entryCount。 idRangeOffset的价值是字节数通过idRangeOffset词实际地点,对应于firstCode的glyphIndexArray元素出现。
Finally, if the value obtained from the subarray is not 0 (which indicates the missing glyph), you should add idDelta to it in order to get the glyphIndex. The va