internal void ReadCMaps()
{
int[] table_location;
tables.TryGetValue("cmap", out table_location);
if (table_location == null)
throw new DocumentException(MessageLocalization.GetComposedMessage("table.1.does.not.exist.in.2", "cmap", fileName + style));
rf.Seek(table_location[0]);
rf.SkipBytes(2);
int num_tables = rf.ReadUnsignedShort();
fontSpecific = false;
int map10 = 0;
int map31 = 0;
int map30 = 0;
//add by james for cmap Ext.b
int mapExt = 0;
for (int k = 0; k < num_tables; ++k) {
int platId = rf.ReadUnsignedShort();
int platSpecId = rf.ReadUnsignedShort();
int offset = rf.ReadInt();
if (platId == 3 && platSpecId == 0) {
fontSpecific = true;
map30 = offset;
}
else if (platId == 3 && platSpecId == 1) {
map31 = offset;
}
else if (platId == 3 && platSpecId == 10)
{
mapExt = offset;
}
if (platId == 1 && platSpecId == 0) {
map10 = offset;
}
}
if (map10 > 0) {
rf.Seek(table_location[0] + map10);
int format = rf.ReadUnsignedShort();
switch (format) {
case 0:
cmap10 = ReadFormat0();
break;
case 4:
cmap10 = ReadFormat4();
break;
case 6:
cmap10 = ReadFormat6();
break;
}
}
if (map31 > 0) {
rf.Seek(table_location[0] + map31);
int format = rf.ReadUnsignedShort();
if (format == 4) {
cmap31 = ReadFormat4();
}
}
if (map30 > 0) {
rf.Seek(table_location[0] + map30);
int format = rf.ReadUnsignedShort();
if (format == 4) {
cmap10 = ReadFormat4();
}
}
if (mapExt > 0) {
rf.Seek(table_location[0] + mapExt);
int format = rf.ReadUnsignedShort();
switch (format) {
case 0:
cmapExt = ReadFormat0();
break;
case 4:
cmapExt = ReadFormat4();
break;
case 6:
cmapExt = ReadFormat6();
break;
case 12:
cmapExt = ReadFormat12();
break;
}
}
}