private void FillDiffMap(PdfDictionary encDic, CMapToUnicode toUnicode)
{
PdfArray diffs = encDic.GetAsArray(PdfName.DIFFERENCES);
if (diffs != null)
{
diffmap = new IntHashtable();
int currentNumber = 0;
for (int k = 0; k < diffs.Size; ++k)
{
PdfObject obj = diffs[k];
if (obj.IsNumber())
{
currentNumber = ((PdfNumber)obj).IntValue;
}
else
{
int[] c = GlyphList.NameToUnicode(PdfName.DecodeName(((PdfName)obj).ToString()));
if (c != null && c.Length > 0)
{
uni2byte[c[0]] = currentNumber;
byte2uni[currentNumber] = c[0];
diffmap[c[0]] = currentNumber;
}
else
{
if (toUnicode == null)
{
toUnicode = ProcessToUnicode();
if (toUnicode == null)
{
toUnicode = new CMapToUnicode();
}
}
string unicode = toUnicode.Lookup(new byte[] { (byte)currentNumber }, 0, 1);
if ((unicode != null) && (unicode.Length == 1))
{
this.uni2byte[unicode[0]] = currentNumber;
this.byte2uni[currentNumber] = unicode[0];
this.diffmap[unicode[0]] = currentNumber;
}
}
++currentNumber;
}
}
}
}