final int glyphIdArrayOffset = (int) getReader().getFilePointer();
// Parse the table entries and build a CMap4 from them.
final String encodingName = "internal-"
+ this.ttfFont().getPostscriptName();
final Cmap04 cmap04 = psServer.makeCmap04(encodingName, segCountX2 / 2);
for (int i = 0; i < startCount.length; i++) {
if (rangeOffset[i] == 0) {
cmap04.addEntry(startCount[i],
endCount[i],
(char) (startCount[i] + deltas[i]));
} else {
final char[] computedIndexes = new char[endCount[i]
- startCount[i] + 1];
for (int j = startCount[i]; j <= endCount[i]; j++) {
final int glyphOffset
= glyphIdArrayOffset
+ ((rangeOffset[i] / 2)
+ (j - startCount[i])
+ i - segCountX2 / 2)
* 2;
getReader().seek(glyphOffset);
final char glyphIndex =
(char) ((getReader().readUnsignedShort()
+ deltas[i]) & Character.MAX_VALUE);
computedIndexes[j - startCount[i]] = glyphIndex;
}
cmap04.addEntry(startCount[i],
endCount[i], computedIndexes);
}
getLogger().debug(i + ": " + startCount[i] + " - "
+ endCount[i]);
}